decaporg / decap-cms

A Git-based CMS for Static Site Generators
https://decapcms.org
MIT License
17.83k stars 3.04k forks source link

Deleting a bullet point in rich text editor crashes CMS #7123

Open LHSnow opened 7 months ago

LHSnow commented 7 months ago

Describe the bug

When editing main content using the rich text editor (markdown widget), deleting a bullet point causes the editor to crash and replace the entire CMS with an error page.

The console reports Uncaught Error: Cannot find a descendant at path [3,0,1] in node (or whatever the nested xpath position of the bullet point was, I am assuming).

The page contains the entire text in json format and after that in markdown, for ease of keeping unsaved edits for later (nice!).

To Reproduce

  1. Make several bullet points in the rich text editor, for example
    • alpha
    • bravo
  2. Delete "alpha", leaving the bullet empty
  3. Hit backspace to delete the bullet
  4. See error

Expected behavior

Bullet point should disappear and the caret should stay on an empty line

Applicable Versions:

CMS configuration

- label: 'Content'
  name: 'body'
  widget: 'markdown'
  required: false
  i18n: true

Additional

This error does not occur in the demo Slate editor, but does nothing when hitting backspace, a behavior which is also unintuitive, i.e. having to klick on the bullet point button to delete the empty point. Would it go away with a dependency update or is the bug caused by Decap? I did notice at Discord that we are moving towards Plate instead, but is there a dependency update that could be done in the meantime. I'd rather have a somewhat unintuitive behavior than a broken one.

nathancatania commented 6 months ago

I am also hitting this error. Hopefully I can provide some additional details that will help.

Crash log

get@http://127.0.0.1:8888/assets/external/unpkg.com/decap-cms@%5E3.0.0/dist/decap-cms.js:485:2731209 leaf@http://127.0.0.1:8888/assets/external/unpkg.com/decap-cms@%5E3.0.0/dist/decap-cms.js:485:2731814 leaf@http://127.0.0.1:8888/assets/external/unpkg.com/decap-cms@%5E3.0.0/dist/decap-cms.js:485:2721273 marks@http://127.0.0.1:8888/assets/external/unpkg.com/decap-cms@%5E3.0.0/dist/decap-cms.js:485:2721793 2826/t.default@http://127.0.0.1:8888/assets/external/unpkg.com/decap-cms@%5E3.0.0/dist/decap-cms.js:477:15111 hasMark@http://127.0.0.1:8888/assets/external/unpkg.com/decap-cms@%5E3.0.0/dist/decap-cms.js:473:11045 render@http://127.0.0.1:8888/assets/external/unpkg.com/decap-cms@%5E3.0.0/dist/decap-cms.js:473:3329 As@http://127.0.0.1:8888/assets/external/unpkg.com/decap-cms@%5E3.0.0/dist/decap-cms.js:485:2187548 Os@http://127.0.0.1:8888/assets/external/unpkg.com/decap-cms@%5E3.0.0/dist/decap-cms.js:485:2187346 El@http://127.0.0.1:8888/assets/external/unpkg.com/decap-cms@%5E3.0.0/dist/decap-cms.js:485:2230681 wu@http://127.0.0.1:8888/assets/external/unpkg.com/decap-cms@%5E3.0.0/dist/decap-cms.js:485:2218886 yu@http://127.0.0.1:8888/assets/external/unpkg.com/decap-cms@%5E3.0.0/dist/decap-cms.js:485:2218814 vu@http://127.0.0.1:8888/assets/external/unpkg.com/decap-cms@%5E3.0.0/dist/decap-cms.js:485:2218675 au@http://127.0.0.1:8888/assets/external/unpkg.com/decap-cms@%5E3.0.0/dist/decap-cms.js:485:2215482 uu@http://127.0.0.1:8888/assets/external/unpkg.com/decap-cms@%5E3.0.0/dist/decap-cms.js:485:2215871 qi@http://127.0.0.1:8888/assets/external/unpkg.com/decap-cms@%5E3.0.0/dist/decap-cms.js:485:2156746 52967/iu/<@http://127.0.0.1:8888/assets/external/unpkg.com/decap-cms@%5E3.0.0/dist/decap-cms.js:485:2213423

This is currently running on ocalhost, but the crash is occurring on my live site as well.

To reproduce

Images

Screenshot 2024-03-18 at 4 23 41 pm

Screenshot 2024-03-18 at 4 24 00 pm

LHSnow commented 4 months ago

Potentially related to #7152

LHSnow commented 4 months ago

I have not been able to reproduce this since upgrading to 3.1.10, have you, @nathancatania ?

mohab-sameh commented 4 months ago

@LHSnow I'm able to consistently reproduce this on 3.1.10.

alehuo commented 3 months ago

Can reproduce also on 3.1.10.

demshy commented 1 month ago

this should be fixed in version 3.2.1, @mohab-sameh or @nathancatania do you mind testing it out to confirm?

did not address the other bug at this time (the one that keeps the link when enter-ing to new bullet)

mohab-sameh commented 1 month ago

@demshy sure thing. I'll test and report back. Please let me know when you address that one as well and I'll help with testing.

mohab-sameh commented 2 weeks ago

@demshy sorry for the very late response. I'm still able to reproduce this bug. When I delete a bullet point that has a hyperlink, it crashes just like before.