Inline NodeView with text content doesn't handle deletion correctly when last character is deleted #1365

Open
opened 2023-03-27 14:09:11 +02:00 by bdbch · 3 comments
bdbch commented 2023-03-27 14:09:11 +02:00 (Migrated from github.com)

Hey guys. I'm currently looking into an issue with our NodeViews not handling the deletion of text content correctly when an inline node view has content: 'text*' in it's schema.

See this issue:
https://github.com/ueberdosis/tiptap/issues/3451

You can see inside the codesandbox provided (https://codesandbox.io/s/dazzling-james-xn3fnn?file=/src/App.js) that the node length will stay 1 when each character is deleted one by one or 0 if it's deleted by SelectAll => Backspace.

After that, the state for the node doesn't seem to update anymore (the nodes length stays 1/0 and the changes done inside are not written into the state).

This doesn't happen, if the content is set to paragraph* for example since then it seems the schema is working correctly.

Now the question would be - is it actually correct to use text directly in a Node? From what I've seen it feels like the state drops the node internally whenever the content is empty - but our node view renderer is not reflecting that change?

Would love to hear some insight - don't need a direct solution but maybe a heads up on what could happen here and if this is even correct Prosemirror behavior / usage.

Thanks! 😀

Hey guys. I'm currently looking into an issue with our NodeViews not handling the deletion of text content correctly when an inline node view has `content: 'text*'` in it's schema. See this issue: https://github.com/ueberdosis/tiptap/issues/3451 You can see inside the codesandbox provided (https://codesandbox.io/s/dazzling-james-xn3fnn?file=/src/App.js) that the node length will stay 1 when each character is deleted one by one **or** 0 if it's deleted by SelectAll => Backspace. After that, the state for the node doesn't seem to update anymore (the nodes length stays 1/0 and the changes done inside are not written into the state). This doesn't happen, if the content is set to `paragraph*` for example since then it seems the schema is working correctly. Now the question would be - is it actually correct to use text directly in a Node? From what I've seen it feels like the state drops the node internally whenever the content is empty - but our node view renderer is not reflecting that change? Would love to hear some insight - don't need a direct solution but maybe a heads up on what could happen here and if this is even correct Prosemirror behavior / usage. Thanks! 😀
marijnh commented 2023-03-27 15:49:25 +02:00 (Migrated from github.com)

Can this issue be reproduced without the React/Tiptap stuff?

Can this issue be reproduced without the React/Tiptap stuff?
bdbch commented 2023-03-28 17:08:32 +02:00 (Migrated from github.com)

I'll give it a shot, I'll come back to this issue tomorrow

I'll give it a shot, I'll come back to this issue tomorrow
Nantris commented 2023-05-18 22:30:15 +02:00 (Migrated from github.com)

@bdbch could you update on this issue?

@bdbch could you update on this issue?
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
prosemirror/prosemirror#1365
No description provided.