Alex-D / Trumbowyg

A lightweight and amazing WYSIWYG JavaScript editor under 10kB
https://alex-d.github.io/Trumbowyg
MIT License
3.97k stars 606 forks source link

Add spelling fix change event handling #1364

Closed abrom closed 1 year ago

abrom commented 1 year ago

All modern browsers trigger the input event and assign e.originalEvent.inputType to 'insertReplacementText' when applying spelling fixes, except for Safari, which uses e.originalEvent.inputType of 'insertText' and e.originalEvent.data of null.

With this in mind, we can have the tbwchange Trumbowyg event triggered on the editor when a spelling fix from the browser context menu is applied.

To test this, insert a textarea on a page and initialize, listening to the tbwchange event. Without the fix applying a spelling fix will not see the tbwchange event fired. With the fix, you see the tbwchange event fired

fixes #1363

Alex-D commented 1 year ago

Thanks :)

abrom commented 1 year ago

No, worries! Thank you for such a great project 😄