Skip to content

Bug: TablePlugin: Delete key commands handling - $deleteCellHandler doen't check is current selection in target table #6972

Closed

Description

@Ulop

Lexical version: 0.21.0

Steps To Reproduce

  1. Open playground
  2. Remove all content
  3. Append first table
  4. Append some text
  5. Append second table
  6. Select all cell's of second table
  7. Press Del

The current behavior

First table removed

The expected behavior

Second table removed

Most command handlers in TableSelectionHelpers.ts check via $isSelectionInTable is current selection($getSelection()) point to target table node passed to applyTableHandlers.
This check is missing in the $deleteCellHandler method.

This results in the command handler being triggered only for the first table registered for subsequent commands.

for (const command of DELETE_KEY_COMMANDS) {
    tableObserver.listenersToRemove.add(
      editor.registerCommand<KeyboardEvent>(
        command,
        $deleteCellHandler,
        COMMAND_PRIORITY_CRITICAL,
      ),
    );
  }
table_remove.mp4

Activity

  1. added
    good first issue
    tables
    on Dec 17, 2024
  2. etrepum commented on Dec 17, 2024

    @etrepum
    Collaborator

    Since you've already isolated this to the location of the bug, do you want to submit a PR for it? Should be a straightforward contribution

  3. HardikRathod123 commented on Dec 18, 2024

    @HardikRathod123

    hey @etrepum, can I pick this issue up? new to open source and would like to start with the library I used in the past

  4. Ulop commented on Dec 18, 2024

    @Ulop
    ContributorAuthor

    Since you've already isolated this to the location of the bug, do you want to submit a PR for it? Should be a straightforward contribution

    Yes, I'm want to submit

  5. etrepum commented on Dec 18, 2024

    @etrepum
    Collaborator

    hey @etrepum, can I pick this issue up? new to open source and would like to start with the library I used in the past

    There are a handful of other issues tagged good first issue that you can look through, I think @Ulop is going to handle this one since they have already done most of the work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issuetables

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions