Alex-D / Trumbowyg

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

IOS: Using keyboard dictation the text is updated but the change event is not notified #1230

Open dpierangeli opened 3 years ago

dpierangeli commented 3 years ago

I'm using Trumbo 2.24.0 on an Ipad (ios 14.5).

I've used the tbwchange event, but when a user uses dictation to write into the editor the event isn't fired.

Safari 14.1.2

How to reproduce?

use this on an ipad: https://jsfiddle.net/9bv72kh0/

and use dictation on the keyboard to write into the editor. The event will not be fired

dpierangeli commented 3 years ago

I've also see that calling $("editor").trumbowyg('html') doesn't get the inserted text (is present in the editor). If the user write a character with the keyboard then all the text is present in $("editor").trumbowyg('html') .

Alex-D commented 3 years ago

I think I need to add something like that: https://github.com/Alex-D/Trumbowyg/issues/162#issuecomment-849308087 Can you try this and check if you get the event triggered?

dpierangeli commented 3 years ago

Yes, that event is fired (one event for letter, apparently), but in the event (or after, by using a timer) the value of the component is not updated.

I use

$("editor").trumbowyg('html')

to read the value and it returns empty string (in the 'UI' i see the dictated value).

There is a function to call to force the update of the component from the 'UI'? If the user opens the keyboard and presses a key the value is then correct.

lanciaDemente commented 3 years ago

I have the same problem too.

There is a way to retrieve UI value?

Alex-D commented 3 years ago

You can create a plugin to access to the Trumbowyg internal functions, then call trumbowyg.syncCode() on any event you want :)

Alex-D commented 1 year ago

Maybe this bug be fixed in 2.27.2? The code: https://github.com/Alex-D/Trumbowyg/pull/1364/files