editable icon indicating copy to clipboard operation
editable copied to clipboard

有序,无序列表序列markdown时错误。

Open guugg opened this issue 1 year ago • 0 comments

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

保存时 => 获取数据时

屏幕截图 2023-09-08 161047.png

Sandbox 沙盒

https://stackblitz.com/edit/stackblitz-starters-axy4bv

guugg avatar Sep 08 '23 08:09 guugg