Skip to content

Commit b400ecf

Browse files
mattygSomaticIT
authored andcommitted
feat: dispatch event 'ready' when editorview initialized
1 parent ff22b5f commit b400ecf

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/lib/CodeMirror.svelte

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
3737
const is_browser = typeof window !== "undefined";
3838
const dispatch = createEventDispatcher<{ change: string }>();
39+
const dispatchReady = createEventDispatcher<{ ready: string }>();
3940
4041
let element: HTMLDivElement;
4142
let view: EditorView;
@@ -56,7 +57,10 @@
5657
5758
$: on_change = nodebounce ? handle_change : debounce(handle_change, 300);
5859
59-
onMount(() => (view = create_editor_view()));
60+
onMount(() => {
61+
view = create_editor_view();
62+
dispatchReady(view);
63+
});
6064
onDestroy(() => view?.destroy());
6165
6266
function create_editor_view(): EditorView {

0 commit comments

Comments
 (0)