Pasting does not fire tbwchange
See original GitHub issueIssue Description
Informations
It seems that when you paste text into the editor, the tbwchange
event is not fired at all unless you have the removeformatPasted
option set to true. In the issue #579 it was reported that the tbwchange
event was not fired for IE 11 when this flag is set to true, and the fix was to simply add the trigger but this does not resolve this issue.
I have been able to fix it on our local copy of trumbowyg by changing the code at line 690 from
setTimeout(function () {
t.semanticCode(false, true);
t.$c.trigger('tbwpaste', e);
}, 0);
to
setTimeout(function () {
t.semanticCode(false, true);
t.$c.trigger('tbwpaste', e);
t.$c.trigger('tbwchange', e);
}, 0);
And removing the t.$c.trigger('tbwchange', e);
on line 679 as this would no longer be necessary.
I am unsure whether this has any further implications to other things but this resolves the issue.
I’ve tested this on Chrome for Windows and Mac, both of which showed the issue. The only way to make the value actually change was to leave the input field, then give it focus again.
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (2 by maintainers)
The simple workaround is to hook your code up to the tbwpaste event as well as tbwchange (and possibly tbwblur too if you want to be fully belt and braces).
Done in next version which will be deployed soon.