Open guugg opened 11 months ago
Description
const serialize = (value: Descendant[]): string => { editor.children = value; const markdownNodesce = MarkdownSerializer.transformWithEditor(editor); const markdownce = MarkdownSerializer.toMarkdownWithEditor(editor, markdownNodesce); console.log('查看:', value); return markdownce; }; ... ... <> <EditableProvider editor={editor} value={initialValue} onChange={value => { const isAstChange = editor.operations.some( op => 'set_selection' !== op.type ) if (isAstChange) { //序列化markdown格式 localStorage.setItem("content", serialize(value)); } }} > <ToolbarComponent className='flex-wrap' editor={editor} disabled={readOnly} /> <ContentEditable /> </EditableProvider> </>
Recording
保存时 => 获取数据时
Sandbox 沙盒
https://stackblitz.com/edit/stackblitz-starters-axy4bv
Description
Recording
保存时 => 获取数据时
Sandbox 沙盒
https://stackblitz.com/edit/stackblitz-starters-axy4bv