ueberdosis / tiptap

The headless rich text editor framework for web artisans.
https://tiptap.dev
MIT License
26.6k stars 2.23k forks source link

[Bug]: editor.commands.selectAll() does in fact not select all #5516

Open Edunity-Learning opened 3 weeks ago

Edunity-Learning commented 3 weeks ago

Affected Packages

core

Version(s)

2.6.4

Bug Description

Pressing Mod-a in the editor does not select the entire table if its the first node, and therefore Mod-a delete deletes everything except the first table cell. The video below shows the bug. This behaviour can be reproduced by dragging a table to the first position in the tiptap showcase editor (or any other tiptap editor)

https://github.com/user-attachments/assets/b3280e7e-75be-4efb-a99f-34861974fb1d

Browser Used

Chrome

Code Example URL

No response

Expected Behavior

Pressing Mod-a and deletion afterwards should delete all nodes

Additional Context (Optional)

I fixed the problem by manually creating a text selection instead of using editor.commands.setTextSelection(), so the problem is caused by the implementation of "setTextSelection". The commented out version does not work image

https://github.com/user-attachments/assets/97ae1183-18c0-4611-8e80-6090ea99579b

Dependency Updates

Nantris commented 3 weeks ago

What's the state.selection.from after commands.selectAll?

Edunity-Learning commented 2 weeks ago

@Nantris what do you mean ? Where does it says "state.selection.from" ?

Nantris commented 2 weeks ago

It's a property of the editor object.

Edunity-Learning commented 2 weeks ago

oh i misread you message. I think it was 4, if i remember it correctly