Create new EditorContent component

This commit is contained in:
Jon Staab
2025-02-03 20:57:47 -08:00
parent 7d4ba6c806
commit fedc99b0f0
7 changed files with 59 additions and 39 deletions
+22
View File
@@ -0,0 +1,22 @@
<script lang="ts">
import {onDestroy, onMount} from "svelte"
const {editor} = $props()
let element: HTMLElement
onMount(() => {
if (element) {
element.append(...(Array.from(editor.options.element.childNodes) as any))
editor.setOptions({element})
editor.contentElement = element
}
})
onDestroy(() => {
editor.contentElement = null
editor.setOptions({element: null})
})
</script>
<div bind:this={element}></div>