TypeCellOS / TypeCellOS/BlockNote

Selecting blocks without content

Open
#1,516 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug:P3
Dominant language
TypeScript
Stars
10.2k
Forks
772
Avg merge
3d 11h
Merged PRs (30d)
17

Description

Is your feature request related to a problem? Please describe.

The user may want to select a range of blocks, even if they do not contain content (e.g. image blocks).

For instance, the user may wish to delete all of those blocks at the same time. However, this is only possible if the start and end of the selection are blocks with content. In some edge cases, e.g. when using "Ctrl-A" on a document where the first block does not contain content (e.g. an image block), no selection is made, so e.g. "Ctrl-A" + "Ctrl-C", "Ctrl-A" + "Backspace" etc. do not work.

I tried to handle this manually but editor.setSelection requires that both start and end blocks are content blocks.

Describe the solution you'd like

Ideally, it would be nice if editor.setSelection supports all block types. But I'm not sure how well this would work with TipTap so some custom logic to track the selected nodes may be necessary.

I'm happy to look into this more if someone could point me in the right direction :)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the editor.setSelection entry point and trace how selections are represented through the TipTap integration, especially for Ctrl-A. Determine how ranges can include blocks without content, then verify that selecting image or other empty blocks enables Ctrl-C and Backspace across the range.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.