Re: [w3c/editing] Should execCommand dispatch beforeinput or not? (#200)

@johanneswilm, our extension allows users to define small text shortcuts, that are replaced with a longer snippet/templates when typed. Think of it like Emmet but for non-coders. For example, when you type "/ty" you could set it to be replaced with "Thank you so much for your feedback."

To be clear, all our snippet pastes are in direct response to explicit user interaction. The user types in a user-defined shortcut or triggers the snippet via a context menu. You can check out the extension here (https://chrome.google.com/webstore/detail/text-blaze/idgadaccgipmpannjkmfddolnnhmeklj).

We have very good compatibility across editors as we follow the specs as closely as possible in how we simulate the paste events to insert the user defined snippet. However, the example I highlight above is one where it currently isn't possible for us to match the correct event order. This only conflicts with the Trix editor for now, but as more editors start to leverage `beforeinput` it's possible more incompatibilities may arise.

Note that we do need to use `execCommand` rather than dispatching all the `paste`, `beforeinput` and `input` events ourselves as many editors just let these events pass through to be handled by the native browser functionality. Since our dispatched events in this case would not have the `trusted` bit set, the browser would not execute a paste based on them breaking many editors. The execCommand events do have the `trusted` bit set.




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

Received on Tuesday, 7 January 2020 09:08:16 UTC