Bug: RichTextPlugin#initialEditorState breaks AutoFocusPlugin
See original GitHub issueWhen using both RichTextPlugin
combined with the initialEditorState
prop, AutoFocusPlugin stops working
Lexical version: 0.3.0
Steps To Reproduce
- Have a
RichTextPlugin#initialEditorState
function and see AutoFocusPlugin stop auto focusing.
Link to code example:
In the below sandbox you can toggle / untoggle the prop and notice when clicking “refresh” in the web view, autofocus will either work or not
https://codesandbox.io/s/many-lexical-autofocus-forked-q74c9w?file=/src/Editor.js:2847-2960
The current behavior
The presence of initialEditorState, prevents AutoFocusPlugin
from properly auto focusing
The expected behavior
Autofocus should work regardless of whether or not initialEditorState
is used
Issue Analytics
- State:
- Created a year ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Forcing focus breaks plugins · Issue #800 · draft-js ... - GitHub
A new editor component is created; The plugins component takes the initial state and adds all decorators from active plugins and then calls...
Read more >Rich text custom field | WordPress.org
Is there any way that I can have a rich text custom field (line and paragraph breaks)? In this support thread… ... Plugin...
Read more >Configure the Rich Text Editor plug-ins - Experience League
Learn to configure the Adobe Experience Manager Rich Text Editor plug-ins to enable individual functionalities.
Read more >Autofocus of Draftjs test editor - Stack Overflow
If your editor is initiated with some default value then doing just this.refs.editor.focus() will have cursor at starting of the text.
Read more >Options - Froala
Defines the fonts that appear under the Font Family button from the rich text editor's toolbar. CODE EXAMPLE. Copy new FroalaEditor('.selector', { fontFamily:...
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
Modifying the above function with the below snippet worked!
@trueadm in my private repo, my function looks like this:
And the bug still occurs … I can play around with a
$createParagraphNode()
call ifstr
is empty?