How can we improve the writing flow and its stability? #2421
Labels
Framework
Issues related to broader framework topics, especially as it relates to javascript
[Type] Question
Questions about the design or development of the editor.
There are several open issues discussing the writing flow and the breaks happening when writing/navigating between the Post title and the blocks. Also, the current implementation is kind of dispatched across different components but not very well organized, we can't easily track what's happening. It feels "fragile".
Current State
So our current state (pseudo-code) is something close to this:
Inside these components we do some hacks to navigate from blocks to post-title using arrows but we're not consistent, the opposite is not possible because this would mean, we'd have to duplicate logic across components.
We also can't ensure a continuous writing flow easily between PostTitle and The content (Pressing enter in the title should create an empty text block, clicking backspace should remove the empty text block and move back to the title)
I think we should bring some organisation into this to allow these features (and more). Not sure exactly how, but our current code is not scalable properly.
Proposal
Maybe something like this:
What's all this? There're two main concepts:
The writing flow:
WritingFlow
component declaring a new "writing flow" and keeping its state.WritingZone
component declaring a new "writing zone" inside the parent "WritingFlow".These two components should monitor Arrow/Enter/Backspace clicks inside each writing zone and focus the right writing zone accordingly (focus the first or the last tabbable inside these zones according to the key pressed)
Maybe also a helper HigherOrderComponent could be called
monitorSelection
tracking if the activeElement is inside the wrapped component and providing things likeisSelected
,isTyping
...cc @iseulde @aduth
The text was updated successfully, but these errors were encountered: