Unable to programmatically select a single inline element
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 48/100
- Tipo de issue
- Funcionalidade
- Clareza
- Razoavelmente clara
- Status de atividade
- Pouca atividade
- Stack de tecnologia
- typescript
- Domínio
- frontend
Direção de pesquisa
Start with packages/core/src/api/blockManipulation/selections/selection.ts and the editor.setSelection entry point mentioned in the issue. Trace how single inline selections are represented and why forcing a ProseMirror selection opens the formatting toolbar. Done means a single inline element can be selected through editor.setSelection and callers can control whether the formatting toolbar opens.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
What’s broken?
At OpenProject, we're building an extension to have custom work package links for the BlockNote editor.
However, currently the behaviour when clicking on such an inline link is broken:
- The user expects after clicking on the element that when Ctrl-C and Ctrl-V are pressed, the work package link is copied
- The user expects after clicking on the element and pressing "del" or "backspace" that the element is removed from the document
It would be easy to solve both expectations, if we could select a single inline block. However, this is not possible at the moment via BlockNote, because it's not possible to select a single inline content.
Furthermore, when we force selection via ProseMirror, BlockNote opens a formatting toolbar. This toolbar does not make sense in our case, since you can't e.g. change font boldness or italics on our custom inline work package link.
What did you expect to happen?
What we need is:
- Be able to select a single inline element via
editor.setSelection - Be able to pass in if we want the formatting toolbar to open or not, e.g. showFormattingToolbar: true|false
Steps to reproduce
- Write your own extension with inline elements
- Try
editor.setSelectionon a single inline element
BlockNote version
0.51.3
Environment
No response
Additional context
We would like to solve this in a clean way 🙂 At the moment we're exploring the following options:
- Set selection via ProseMirror (solves our requirements but opens formatting toolbar)
- Attach our own handlers which intercept copy-paste, keypress etc. when the inline element was clicked (and remove the handlers when the focus is removed)
If you see other good ways to solve our problem, we're happy about suggestions!
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 💖
- Linguagem predominante
- TypeScript
- Estrelas
- 10.2k
- Forks
- 772
- Merge médio
- 3d 11h
- PRs com merge (30d)
- 17
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de TypeCellOS/BlockNote
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
TypeCellOS/BlockNote#3098 ·
-
Off-By-One `RangeError` Crash and Text Duplication in `StyleManager.editLink` and `deleteLink` Abertaneeds-triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
TypeCellOS/BlockNote#3073 ·
-
needs-triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
TypeCellOS/BlockNote#3072 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
TypeCellOS/BlockNote#2949 · 1 comentário ·
-
a11y
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
TypeCellOS/BlockNote#2855 ·
Todas as issues de TypeCellOS/BlockNote
Issues semelhantes
-
comp/dashboard P3 type/bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 86/100
NousResearch/hermes-agent#117722 ·
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 76/100
-
code-quality refactoring
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
langchain-ai/deepagents#6450 ·