Files
flotilla/src/app/editor/EditorContent.svelte
T
2025-02-05 10:47:56 -08:00

24 lines
440 B
Svelte

<script lang="ts">
import {onDestroy, onMount} from "svelte"
const {editor} = $props()
let element: HTMLElement
onMount(() => {
if (editor.options.element) {
element?.append(editor.options.element)
}
if (editor.options.autofocus) {
;(element?.querySelector("[contenteditable]") as HTMLElement)?.focus()
}
})
onDestroy(() => {
editor.destroy()
})
</script>
<div bind:this={element}></div>