TypeCellOS / TypeCellOS/BlockNote
Can't select a single block
Personne n'a encore pris cette issue.
- Langage dominant
- TypeScript
- Étoiles
- 10.2k
- Forks
- 772
- Merge moyen
- 3 j 11 h
- PR mergées (30 j)
- 17
Description
What’s broken?
It is not possible to select a single block via the setSelection function or seemingly any other way. Passing the same block or block id throws the error:
Attempting to set selection with the same anchor and head blocks (id ${startBlockId}).
The following also does not set the selection for the given block:
editor.setTextCursorPosition(block.id, "start");
editor.focus();
What did you expect to happen?
editor.setSelection(block.id); or editor.setSelection(block.id, block.id); should select a single block from its start to its end.
Steps to reproduce
- Using the setSelection function pass it the same block id for the
startBlockandendBlock. - The error is thrown, rather than the block being selected from beginning to end.
BlockNote version
0.47.1
Environment
React 18.2
Additional context
I'm currently trying to build a custom SideMenu button that on click selects the corresponding block and opens a custom FormattingToolbar that uses editor.getSelection().
Contribution
- I'd be interested in contributing a fix for this issue
Sponsor
- I'm a sponsor and would appreciate if you could look into this sooner than later 💖
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Start with the setSelection API described in the linked cursor-selections documentation and reproduce the issue using identical startBlock and endBlock IDs. Check the related setTextCursorPosition behavior and ensure selecting one block works from its start through its end without throwing; verify the custom SideMenu and FormattingToolbar use case through editor.getSelection().
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- react, typescript
- Domaine
- frontend
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- Calme
- Clarté
- Plutôt claire
- Accessibilité débutants
- 58/100