Open crazycodestar opened 1 year ago
The problem is that this line changes the editor options every time the content changes (you type something) and therefor the editor instance gets destroyed and re-created which causes loosing focus on the editor.
const editor = createTiptapEditor(() => ({
element: ref,
extensions: [
StarterKit,
],
content: content();, // <== here
}));
If you just want to keep the content
signal in sync with the editor HTML you can use the build-in onUpdate
method:
function App() {
let ref!: HTMLDivElement;
const [content, setContent] = createSignal("");
createTiptapEditor(() => ({
element: ref,
extensions: [
StarterKit,
],
onUpdate: ({ editor }) => setContent(editor.getHTML()),
}));
return <div id="editor" ref={ref} />;
}
so I was wondering if there was some sort of way to get this to work