codex-team / codex-team/editor.js
Does not focus block when using insert()
- Lingua principale
- TypeScript
- Stelle
- 31.9k
- Fork
- 2.2k
- Merge medio
- 1g 13h
- PR unite (30g)
- 2
Descrizione
Hi there, thanks so much for your work on this!
I'm using `insert()` to add a new block when a user clicks a button:
```js
insert(blockType) {
// need to be explicit with index, otherwise editor.js adds block at the beginning...
const index = editor.blocks.getBlocksCount() + 1
editor.blocks.insert(blockType, {}, {}, index, true)
}
```
```vue
- Title
- Text
```
Even though I set the last param (`needToFocus`) to `true`, it doesn't focus the newly inserted block.
Of course, you can use the Caret API to focus the last inserted block like so:
```js
editor.caret.setToLastBlock('start', 0)
```
... but then what is the `needToFocus` param for in the `insert()` method? :)
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Inizia dal punto di ingresso della Blocks API per insert() e segui come viene gestito il suo argomento needToFocus, quindi confrontalo con la chiamata alla Caret API mostrata nel report. Riproduci il comportamento usando l'esempio di clic di Vue e verifica che l'inserimento di un blocco con needToFocus impostato su true porti il focus sul nuovo blocco come documentato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript, typescript
- Ambito
- frontend
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100