vendredi 27 octobre 2017

Edit text in Facebook Messenger contenteditable

To compose messages in Messenger, Facebook uses <div contenteditable="true"></div> as the input element. When I open browser devtools and change the text of the message I'm currently composing, it immediately reverts back to the previous text.

I'm making a Find & Replace extension (http://ift.tt/2yMiElQ) that needs to be able to insert text into the contenteditable but simply changing the DOM node is immediately reverted by their JavaScript.

Is there any other way to simulate typing in the input text (using a browser extension or JavaScript in general)?

UPDATE: I can duplicate the DOM node and then the JavaScript listeners are removed, but then the internal JavaScript variables are never updated with my new text.




Aucun commentaire:

Enregistrer un commentaire