chore(control): save text and url

This commit is contained in:
E44
2026-01-19 18:57:56 +01:00
parent 4d5d9849da
commit 671c74f25d
2 changed files with 12 additions and 3 deletions
@@ -20,6 +20,12 @@
import { Color } from '@tiptap/extension-text-style';
import Highlight from '@tiptap/extension-highlight';
let {
text = $bindable()
}: {
text: string;
} = $props();
type TextEditOption = {
onclick: () => void;
is_selected: () => boolean;
@@ -128,15 +134,17 @@
Highlight.configure({
multicolor: true
})
],
],
content: text,
onTransaction: ({ editor }) => {
// Increment the state signal to force a re-render
editor_state = { editor };
},
autofocus: true
});
editor_state.editor.commands.selectAll();
});
onDestroy(() => {
if (editor_state.editor) text = editor_state.editor.getHTML();
editor_state.editor?.destroy();
});