Javascript 获得;“操作不安全”;通过tinymce.EditorManager.execCommand(';mceAddControl';,false,newId)添加tinymce时出错;
编辑:查看我的答案以了解发现的问题和解决方案。这是由于iframe调用上下文,尽管它是同一个域 我不明白为什么会发生这种错误。我将经历以下步骤:Javascript 获得;“操作不安全”;通过tinymce.EditorManager.execCommand(';mceAddControl';,false,newId)添加tinymce时出错;,javascript,tinymce,Javascript,Tinymce,编辑:查看我的答案以了解发现的问题和解决方案。这是由于iframe调用上下文,尽管它是同一个域 我不明白为什么会发生这种错误。我将经历以下步骤: 删除tinyMCE编辑器 更改textarea的id 使用新id将tinymce编辑器添加到该文本区域 代码 //Remove the tinyMCE editor for this text area (CHANGING TO "true" DOESN't HELP) tinyMCE.EditorManager.execCommand('mceRem
//Remove the tinyMCE editor for this text area (CHANGING TO "true" DOESN't HELP)
tinyMCE.EditorManager.execCommand('mceRemoveControl',false, myTextArea.id );
//Change the id
myTextArea.id = newId;
//Add a tiny mce editor (CHANGING TO "true" DOESN't HELP)
tinyMCE.EditorManager.execCommand('mceAddControl',false, newId);
最后一个抛出错误
操作不安全
。为什么?如何解决这个问题?对于任何面临类似问题的人,下面是问题所在以及我是如何解决的:
问题
//Remove the tinyMCE editor for this text area (CHANGING TO "true" DOESN't HELP)
tinyMCE.EditorManager.execCommand('mceRemoveControl',false, myTextArea.id );
//Change the id
myTextArea.id = newId;
//Add a tiny mce editor (CHANGING TO "true" DOESN't HELP)
tinyMCE.EditorManager.execCommand('mceAddControl',false, newId);
window.parent.myObject.handleResponse({})代码>
handleResponse
中,我被删除并添加了tinymce编辑器setInterval
启动一个“观察者”,检查要设置的响应值window.parent.myObject.handleResponse({})代码>只需设置该响应值