<!--
Copyright: Ankitects Pty Ltd and contributors
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
-->
<script lang="ts">
    import NoteEditor from "./NoteEditor.svelte";
    import ButtonGroupItem from "../components/ButtonGroupItem.svelte";
    import PreviewButton from "./PreviewButton.svelte";
    import type { NoteEditorAPI } from "./NoteEditor.svelte";

    const api: Partial<NoteEditorAPI> = {};
    let noteEditor: NoteEditor;

    export let uiResolve: (api: NoteEditorAPI) => void;

    $: if (noteEditor) {
        uiResolve(api as NoteEditorAPI);
    }
</script>

<NoteEditor bind:this={noteEditor} {api}>
    <svelte:fragment slot="notetypeButtons">
        <ButtonGroupItem>
            <PreviewButton />
        </ButtonGroupItem>
    </svelte:fragment>
</NoteEditor>
