-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed as not planned
Description
Describe the problem
For example usign Tip-Tap editor
`<script>
import { onMount, onDestroy } from 'svelte';
import { Editor } from '@tiptap/core';
import StarterKit from '@tiptap/starter-kit';
let element;
let editor;
onMount(() => {
editor = new Editor({
element: element,
extensions: [StarterKit],
content: '<p>Hello World! ποΈ </p>',
onTransaction: () => {
// force re-render so `editor.isActive` works as expected
editor = editor
},
});
});
onDestroy(() => {
if (editor) {
editor.destroy();
}
});
</script>`
editor = editor;
this no longer does anything.
if anyone is in the same boat my current approach is
let editor = $state<() => Editor>();
onMount(() => {
let _editor = new Editor({
element: element,
extensions: [StarterKit],
content: '<p>Hello World! ποΈ </p>',
onTransaction: () => {
// force re-render so `editor.isActive` works as expected
let _editor = editor();
editor = ()=>_editor;
},
});
editor = () => _editor;
});
Describe the proposed solution
trigger(editor)
so it calls update on everywhere where it is used. on DOM, $derived,$effect and so on.
Importance
nice to have
Jerboas86
Metadata
Metadata
Assignees
Labels
No labels