Dispatching 'compsitionend' transaction

hi marijn!

following up on Editor crashing when used as controlled component in react - #9 by marijn, we figured out how we can handle composition events using the editor as controlled input in react.

I had to add one line in the EditContextManager, though, and wanted to ask if you see potential issues including that.
the change would be in the compositionend handler, adding view.dispatch({ userEvent: 'input.type.compose.end' }) at the very end of the callback.

could also be any other transaction, just something we can react to and where the editor view’s compositionStarted is updated already.
e.g. entering ´ would trigger a transaction with editorView.transactionStarted = true, then adding o or just hitting Enter would trigger a transaction with editorView.transactionStarted = false.
without the addition of that one line, we’d only get a transaction with the updated transactionStarted flag when typing another character (that is not starting a composition again…) and couldn’t trigger the onChange callback for the controlled scenario in time.

would it be possible to include that?

best,
peter

quick addition: I could actually use the composing flag of the editor view, but it would be waaaaaay nicer with a dedicated input.type.compose.end transaction.

@marijn reminder :slightly_smiling_face: :pray:

Due to the messy nature of composition events, it’s rather complicated to do something like this in a robust way that guarantees events are delivered in the correct order. As such, I’d recommend you keep using the workaround you found.

hmm… damn… alright - workaround it is then. thx anyway!