flotilla/src/app/editor/EditorContent.svelte

24 lines
440 B
Svelte
Raw Normal View History

2025-02-05 16:54:04 +00:00
<script lang="ts">
import {onDestroy, onMount} from "svelte"
const {editor} = $props()
let element: HTMLElement
onMount(() => {
2025-02-05 18:47:56 +00:00
if (editor.options.element) {
element?.append(editor.options.element)
}
if (editor.options.autofocus) {
;(element?.querySelector("[contenteditable]") as HTMLElement)?.focus()
2025-02-05 16:54:04 +00:00
}
})
onDestroy(() => {
2025-02-05 18:47:56 +00:00
editor.destroy()
2025-02-05 16:54:04 +00:00
})
</script>
<div bind:this={element}></div>