Reputation: 21
I have a html table where I show one instance of tinyMCE editor in a cell, one at a time. Meaning, the user sees one tinyMCE editor in a cell at a time and when they press tab, the editor is deleted from the current cell (value from the editor is copied to the cell) and editor is shown in the next cell. There are other tinyMCE editors on the page and all of the editors share the same tool bar.
I am using an older version of tinyMCE - 3.5.10 and cannot upgrade anytime soon for legacy reasons.
Everything works fine if I do not use certain HTML elements like font color and background color. Then I keep running into one of these two errors
tiny_mce.js:5 Uncaught TypeError: Cannot read property 'getBookmark' of null
at Object.beforeChange (tiny_mce.js:5)
at Editor.<anonymous> (tiny_mce.js:5)
at Dispatcher.dispatch (tiny_mce.js:5)
at DOMUtils.c (tiny_mce.js:5)
at j (tiny_mce.js:5)
at HTMLDocument.y (tiny_mce.js:5)
OR
Uncaught TypeError: Cannot read property 'createRange' of undefined
at Selection.getRng (tiny_mce.js:5)
at l (tiny_mce.js:5)
at Selection.getBookmark (tiny_mce.js:5)
at Object.beforeChange (tiny_mce.js:5)
at Editor.<anonymous> (tiny_mce.js:5)
at Dispatcher.dispatch (tiny_mce.js:5)
at DOMUtils.c (tiny_mce.js:5)
at j (tiny_mce.js:5)
at HTMLDocument.y (tiny_mce.js:5)
I am removing the editor with tinyMCE.execCommand('mceRemoveControl', false, "myeditor"); and adding with tinyMCE.execCommand('mceAddControl', true, "myeditor");
What is the correct way to completely remove an editor and add it back, with the same ID?
Upvotes: 2
Views: 512