Well, as usual when blending different libraries we run into trouble...at least I did.
It's when you have updatePanels, pages flipped with Ajax...loading info in and out...
When using TinyMce on textareas I sometimes get an error while using the code: "tinyMCE.saveTrigger(false, true);" which must be used before a postback. So that the textarea returns into normal state and we can get the info out of it....
The error looks like "t.win.document has no properties"
Annoying...isn't it!?¿
Though thanks to google, I found a some different solutions.
The solution for me was to make sure that each TinyMCE panel gets setup correctly, and deleted BEFORE a pageflip occur. We can do that with an array in our major javascript file to keep track of which MCE elements we have active.
| 1 |
|
| 2 |
// [ Javascript ]
|
| 3 |
|
| 4 |
var activeEditors = new Array()
|
| 5 |
|
| 6 |
function activateEditor(id) {
|
| 7 |
activeEditors[activeEditors.length] = id;
|
| 8 |
toggleEditor(id);
|
| 9 |
}
|
| 10 |
|
| 11 |
function deactivateEditors() {
|
| 12 |
for(x=0;x<activeEditors.length;x++) {
|
| 13 |
toggleEditor(activeEditors[x]);
|
| 14 |
}
|
| 15 |
activeEditors.length = 0;
|
| 16 |
}
|
| 17 |
|
| 18 |
// functions
|
| 19 |
function toggleEditor(id) {
|
| 20 |
var elm = document.getElementById(id);
|
| 21 |
|
| 22 |
if (tinyMCE.getInstanceById(id) == null)
|
| 23 |
tinyMCE.execCommand('mceAddControl', false, id);
|
| 24 |
else
|
| 25 |
tinyMCE.execCommand('mceRemoveControl', false, id);
|
| 26 |
}
|
| 27 |
|
| 28 |
// [ End Of Javascript ]
|
| 29 |
|
| 30 |
|