editor-js / document-model

❗️WIP❗️
Apache License 2.0
10 stars 2 forks source link

Composition events support #66

Open ilyamore88 opened 7 months ago

ilyamore88 commented 7 months ago

Implement composition input types support in Block Tool Adapter.

https://github.com/editor-js/document-model/blob/main/packages/dom-adapters/src/BlockToolAdapter/index.ts#L109

ilyamore88 commented 7 months ago

Browsers differences

The beforeinput event has two input types for composition. It is insertCompositionText and insertFromComposition. When the user starts typing, he uses Option + ` combination. It fires the beforeinput event with the input type insertCompositionText. Then, the user can type the symbol he wants to use in the composition.

Safari

When the user types some symbol, we receive a beforeinput event with the inputType insertFromComposition. Demo:

https://github.com/editor-js/document-model/assets/37909603/a76e7edf-b55b-4e22-8fab-4d6dc3053e6e

Chrome

When the user types some symbol, we receive a beforeinput event with the inputType insertCompositionText. Demo:

https://github.com/editor-js/document-model/assets/37909603/846b3f3f-840e-48b5-ac4c-2d1f447ad627

Bug report: https://bugs.chromium.org/p/chromium/issues/detail?id=1022204