I'm developing a chrome extension that should alter the text contents of a content editable div in chrome. It's working perfectly on websites like gmail, but has a problem on facebook, that after the contents have been altered and then you close the dialog containing the div and then open it, all changes are removed and only the text entered manually via keyboard stay.
I change the text via javascript as follows:
document.getSelection().anchorNode.textContent = "something";
It goes like this:
but after closing the dialog and opening it again, only the manually entered text is shown.
As mentioned above, this problem only on facebook. It looks like that the dom is being monitored and any changes made to it are removed.
Still, other extensions could alter the contents of this div like Grammarly. How is this possible? Do you need permission from facebook or something like that for your extension to work?