autofocus only works if Editor is created with a mobiledoc
See original GitHub issueThis currently will not autofocus, because there is no document, therefore nowhere to place the cursor:
const editor = new Mobiledoc.Editor({
placeholder: 'Write here...',
autofocus: true
})
This works:
const editor = new Mobiledoc.Editor({
placeholder: 'Write here...',
autofocus: true,
mobiledoc: {
version: '0.3.0',
markups: [],
atoms: [],
cards: [],
sections: [[1, "p", [[0, [], 0, ""]]]]
}
})
Auto-creating a blank mobiledoc if not provided may have some unwanted side effects. Perhaps offering a public constant to a blank doc could be a compromise:
const editor = new Mobiledoc.Editor({
placeholder: 'Write here...',
autofocus: true,
mobiledoc: Mobiledoc.BlankMobiledoc
})
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:5 (1 by maintainers)
Top Results From Across the Web
autofocus in html input tag only works once. Is there a way I ...
I'm working on an in-browser editor that requires quick editing of single words. I'm trying to implement it by replacing specific words with ......
Read more >bustlelabs/mobiledoc-kit
We're using mobiledoc to create image cards that contain captions. To create these captions, we're rendering a new mobiledoc editor.
Read more >react-mobiledoc-editor: Documentation
react-mobiledoc-editor supports the creation of Mobiledoc Cards as React ... Please note that by itself, Container only renders an empty root-level ...
Read more >Use Mobiledoc-Kit to build an auto-linking text editor
In this post I'll showcase one of the useful editing hooks that the Mobiledoc API offers: onTextInput . I'll create a text editor...
Read more >Autofocus only works in Liveview mode. HELP!
Autofocus is struggling to operate in general when I'm looking through the ... However this is my only autofocusing lens made for FF, ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Minor nit: autofocus only works if Editor is created with a mobiledoc with sections. That is to say, the
EMPTY_MOBILEDOC
in ember-mobiledoc-editor will not suffice.Also ran into this issue.