我对 tinymce 和 UpdatePanel 有疑问,我发布这个是因为没有其他解决方案对我有用。
这是我的代码:
function pageLoad() {
console.log("pageLoad called");
tinyMCE.init({
theme: "advanced",
plugins: "preview,paste",
theme_advanced_toolbar_location: "top",
theme_advanced_toolbar_align: "left",
theme_advanced_buttons1: "undo,redo,|,bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,fontselect,fontsizeselect,forecolor,backcolor",
theme_advanced_buttons2: "cut,copy,paste,pastetext,pasteword,|,link,unlink,|,removeformat,cleanup,preview",
theme_advanced_buttons3: ""
});
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_beginRequest(function (sender, args) {
var inst = tinyMCE.getInstanceById('<%= txtContenidoCorreo.ClientID %>');
if (typeof inst !== 'undefined' && inst !== null) {
console.log('removing');
//tinyMCE.triggerSave();
//tinyMCE.execCommand('mceFocus', false, '<%= txtContenidoCorreo.ClientID %>');
tinyMCE.execCommand('mceRemoveControl', false, '<%= txtContenidoCorreo.ClientID %>');
console.log('removed');
}
});
prm.add_endRequest(function (sender, args) {
var inst = tinyMCE.getInstanceById('<%= txtContenidoCorreo.ClientID %>');
if (!inst) {
console.log('initializing');
tinyMCE.execCommand('mceAddControl', false, '<%= txtContenidoCorreo.ClientID %>');
console.log('initialized');
}
});
}
经过几个异步请求后,我在 IE9 和 IE10 中收到此错误:
SCRIPT70:权限被拒绝。
发生此错误的确切行是:
result = this.bodyElement || this.getDoc().body;
这是堆栈跟踪:
getBody@/JavaScript/tiny_mce/tiny_mce_src.js:14548:11
获取内容@/JavaScript/tiny_mce/tiny_mce_src.js:14458:30
保存@/JavaScript/tiny_mce/tiny_mce_src.js:14377:4
{匿名}()@(/JavaScript/tiny_mce/tiny_mce_src.js:13466:17)
dispatch@/JavaScript/tiny_mce/tiny_mce_src.js:562:4
eventHandler@/JavaScript/tiny_mce/tiny_mce_src.js:14905:5
executeHandlers@/JavaScript/tiny_mce/tiny_mce_src.js:4731:6
我正在使用 Tinymce 3.5.8