BUGFIX: Update formattingUnderCursor
when CKEditor focus changes
#3325
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
refs: #3224
The Problem
Peek.2023-01-05.14-00.-.3224.webm
While investigating #3224, I noticed that the
EditorToolbar
sometimes receives the wrongformattingUnderCursor
when another node is being selected. In fact, in those cases, theEditorToolbar
received theformattingUnderCursor
corresponding to the previous selection.By debugging the events triggered by CKEditor I was able to find out that in those cases a
change:isFocused
event got triggered, but nochange
event, which would have updated theformattingUnderCursor
.The Solution
This PR makes sure that
formattingUnderCursor
is properly updated whenchange:isFocused
occurs through CKEditor. It does so by calling thehandleUserInteractionCallback
that is also called when thechange
event occurs.Though I was unable to reproduce the original problem described in #3224, it would be very well explicable, if that problem was solved by this measure as well. It would be helpful, if someone who is able to reproduce the issue could verify this :)