-
I am unable to find any method of getting content from the editor in SvelteKit, and methods listed in the other Q&A do not work in this scenario. <script>
import {
Composer,
ContentEditable,
ToolbarRichText,
ActionBar,
RichTextPlugin,
HistoryPlugin,
ListPlugin,
CheckListPlugin,
HorizontalRulePlugin,
ImagePlugin,
} from 'svelte-lexical';
import { HeadingNode, QuoteNode, ListNode, ListItemNode, HorizontalRuleNode, ImageNode } from 'svelte-lexical';
import PlaygroundEditorTheme from './themes/PlaygroundEditorTheme';
import { onMount } from 'svelte';
let composer;
const config = {
theme: PlaygroundEditorTheme,
nodes: [HeadingNode, ListNode, ListItemNode, QuoteNode, HorizontalRuleNode, ImageNode],
onError: (error) => {
throw error;
},
};
</script>
<Composer initialConfig={config} bind:this={composer}>
<div class="editor-shell">
<ToolbarRichText />
<div class="editor-container">
<div class="editor-scroller">
<div class="editor">
<ContentEditable />
</div>
</div>
<RichTextPlugin />
<HistoryPlugin />
<ListPlugin />
<CheckListPlugin />
<HorizontalRulePlugin />
<ImagePlugin />
<ActionBar />
</div>
</div>
</Composer> |
Beta Was this translation helpful? Give feedback.
Answered by
umaranis
Jul 6, 2023
Replies: 1 comment 2 replies
-
Hi @enesbala5 , The simplest option is to upgrade to version 0.3.3 and follow the instruction here afterwards. Another option is to create a svelte component and place it inside the composer. The new component can get the access to Lexical Editor from svelte context |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
umaranis
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @enesbala5 ,
The simplest option is to upgrade to version 0.3.3 and follow the instruction here afterwards.
Another option is to create a svelte component and place it inside the composer. The new component can get the access to Lexical Editor from svelte context
getContext('editor')
.