Skip to content

Commit

Permalink
Implement unused setHTML
Browse files Browse the repository at this point in the history
  • Loading branch information
TravisSpomer committed Dec 19, 2024
1 parent a5a9576 commit a586e11
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/lib/components/Editor.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,20 @@
return html
}
// *** DO WE NEED A SETHTML HERE FOR NOW? if !editor then just set value and bail
/**
Replaces the entire contents of the editor with new HTML.
(In theory this is redundant to just setting the value property, but this component doesn't support changing the value after construction.)
*/
export function setHTML(html: string): void
{
if (!editor)
{
// If the editor hasn't been initialized yet, setting value is sufficient, since we use that to initialize the editor.
value = html
return
}
editor.commands.setContent(html)
}
/** Focuses the editor. */
export function focus(options?: Parameters<HTMLDivElement["focus"]>[0]): void
Expand Down

0 comments on commit a586e11

Please sign in to comment.