editor icon indicating copy to clipboard operation
editor copied to clipboard

[BUG] Copy paste list from MacOS Pages app throw an error

Open dmowski opened this issue 2 years ago • 4 comments

  • [X] I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
  • [X] I have read the documentation and cannot find an answer.

Describe the bug When copy pasting List elements from docx file on MacOs, changes are not applied.

To Reproduce

  1. Go to mdxeditor.dev demo

  2. Open provided document listCopyPaste.docx image

  3. Copy/Paste content into Editor

  4. Open browser console

  5. See error: image

TypeError: Cannot read properties of undefined (reading 'children')

Expected behavior No error in console, on change event triggered

Desktop:

  • OS: MacOS
  • Browser: Chrome

Additional context I found, that errors happened on module src/exportMarkdownFromLexical.ts:100 Function: isParent

Additionally I checked that mdastParent! is undefined image

src/exportMarkdownFromLexical.ts:100

I've tried to update lexical libs to 0.17.1 - doesn't help

If someone would suggest what to do to fix it, or how to better research it I will be thankful. For now, I am new at that code base, and it's little difficult to fix it fast for me

dmowski avatar Sep 11 '24 15:09 dmowski

@dmowski this is this issue: https://github.com/mdx-editor/editor/issues/178. Nested lists are very painful. I want to fix this, but it's not very simple, especially with copy paste. The AST is the culprit.

petyosi avatar Sep 11 '24 15:09 petyosi

@dmowski forgot to mention - thank you for the sponsorship. I will see if I can at least prevent the error, even if this means losing the indentation, which IMO is far more acceptable.

petyosi avatar Sep 11 '24 16:09 petyosi

@dmowski forgot to mention - thank you for the sponsorship. I will see if I can at least prevent the error, even if this means losing the indentation, which IMO is far more acceptable.

Nice, Thanks. yes, it will be nice to prevent losing data, even if formatting will be broken (that's ok).

In my case, end user see editor on page with auto saving functionality, and they may put something to editor and close the tab. With error, onChange event doesn't trigger and nothing to save

dmowski avatar Sep 11 '24 16:09 dmowski

:tada: This issue has been resolved in version 3.11.4 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

github-actions[bot] avatar Sep 14 '24 07:09 github-actions[bot]