Javascript 多金属丝
我最近在开发包含多个tinymes的页面时遇到了一个问题Javascript 多金属丝,javascript,jquery,tinymce,rte,Javascript,Jquery,Tinymce,Rte,我最近在开发包含多个tinymes的页面时遇到了一个问题 <textarea style='width:90%;height:500px;' class='tinymce' name='message' id="mce_editor_0" placeholder='Long Message'>{if isset($message)}{$message}{/if}</textarea> <textarea style='width:90%;height:200px;'
<textarea style='width:90%;height:500px;' class='tinymce' name='message' id="mce_editor_0" placeholder='Long Message'>{if isset($message)}{$message}{/if}</textarea>
<textarea style='width:90%;height:200px;' class='tinymce' name='signature' id="mce_editor_1" placeholder='Long Message'></textarea>
$.ajax({
url: "../action/getEmailTemplate?id="+id+'&type='+type
}).done(function ( data ) {
console.log("../action/getEmailTemplate?id="+id+'&type='+type);
console.log(data);
if(type=='email'){
tinyMCE.execCommand('mce_editor_0', 'mceSetContent', false, data);
}
if(type=='sig'){
tinyMCE.execCommand('mce_editor_1', 'mceSetContent', false, data);
}
});
{if-isset($message)}{$message}{/if}
$.ajax({
url:“../action/getEmailTemplate?id=“+id+”&type=”+type
}).完成(功能(数据){
console.log(“../action/getEmailTemplate?id=“+id+”&type=”+type);
控制台日志(数据);
如果(类型=='email'){
tinyMCE.execCommand('mce_editor_0','mceSetContent',false,data);
}
如果(类型=='sig'){
tinyMCE.execCommand('mce_editor_1','mceSetContent',false,data);
}
});
这是行不通的。我是否误解了tinyMCE.execCommand背后的逻辑?这行不通。您将找到正确的用法说明 您可以使用tinyMCE调用generall命令,也可以在编辑器实例上调用特定于编辑器的命令:
tinymce.get('mce_editor_1').execCommand('mceCodeEditor', false, 5);
您还可以使用以下内容来处理特定的编辑器
tinyMCE.execInstanceCommand('mce_editor_1', command, user_interface, value, focus)