Skip to content

When cut content with ctrl + x there is problem with tablesΒ #291

@shiz-ceo

Description

@shiz-ceo

Problem

When the user wants to cut the content and the starting point is a table, a small bug occurs: the table is not completely deleted, only one cell remains. As I understand it, this is related to deleteSelection.

if (cut) view.dispatch(view.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent", "cut"))

If we select not only the table, but also, for example, the text from below, then we set the default TextSelection.

Screen.Recording.2025-08-09.133149.mp4

If we select only the table, everything works well, the content disappears, but the table remains, because CellSelection comes into play.

Screen.Recording.2025-08-09.134233.mp4

It all lies in how the replace method works for TextSelection and CellSelection, to be honest, I do not know how to fix this behavior. Alternatively, you can check for a table, but this method is not universal for other cases (with the same nested structure as a table or for other wrappers of the Selection class).

Other behaviors

  • Google docs
Screen.Recording.2025-08-09.135008.mp4
  • MS Word
Screen.Recording.2025-08-09.135139.mp4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions