There are many scripts that change the value of the textarea. But CodeMirror does not react to these changes in any way. What are the options to send new text to CodeMirror?
Topic on Extension talk:CodeMirror
How to send a command to CodeMirror from JS?
Hi, can you elaborate on this a bit with an example? Thanks.
A script changes the content of the textarea. What function needs to be called by the script to update the CodeMirror output?
Does https://phabricator.wikimedia.org/T174811 sound like what you're looking for? Please add your comments to that ticket or create a new one if that's different from what you're seeking. We'll get around to this in a while after conquering some more troublesome bugs. Thank you.
I found a solution:
- program calls "$( '#wpTextbox1' ).data( 'wikiEditor-context' ).modules.toolbar.$toolbar.find( 'a.tool[rel=CodeMirror]' ).click();" to disable CodeMirror
- program modifies the text in the textarea
- program call "$( '#wpTextbox1' ).data( 'wikiEditor-context' ).modules.toolbar.$toolbar.find( 'a.tool[rel=CodeMirror]' ).click();" to enable CodeMirror
Not elegant, but works for me.