Re: [w3c/editing] Universal interface to modify content in a JS editor from unrelated JS code. (Issue #551)

johanneswilm left a comment (w3c/editing#551)

Hey @GaurangTandon I tried your version, but unfortunately it seems to fail for every editor when I click execCommand. In the sources then I read you linked up another button to first run the beforeinput event and later the paste.

It seems clear that the beforeinput event is clearly the best match and so also in your code you try the beforeinput event first. And the semantically correct inputType for the kinds of text operations your extensions is doing is in most cases will be "insertReplacementText". 

The problem then is that some older editors still don't listen to the beforeinput event, so you need a backup for legacy editors. You may be right be right that in those cases, execCommand can work for some of those cases - even if it throws random ` `s in there. Hopefully it doesn't crash the editor.

But as you wrote in that script, the execCommand would only come after you tried out the beforeinput event. So why should they be coupled together? 



-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/editing/issues/551#issuecomment-6048059416
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/editing/issues/551/6048059416@github.com>

Received on Wednesday, 7 October 2026 22:22:48 UTC