我最近在开发具有多个TinyMCE的页面时遇到了一个问题。
<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);
}
});这是行不通的。我误解了tinyMCE.execCommand背后的逻辑吗?
发布于 2012-06-12 19:08:48
这行不通的。您将找到正确的用法描述here。
您可以使用tinyMCE调用通用命令,也可以在编辑器实例上调用特定于编辑器的命令:
tinymce.get('mce_editor_1').execCommand('mceCodeEditor', false, 5);您还可以使用以下命令来处理特定的编辑器
tinyMCE.execInstanceCommand('mce_editor_1', command, user_interface, value, focus)https://stackoverflow.com/questions/10994269
复制相似问题