我有以下脚本完美无缺,除非保存内容后,编辑器仍保持打开状态。如何在save_onsavecallback回调中关闭TinyMCE编辑器?
tinymce.init({
selector: "#document",
inline: true,
plugins: ["advlist lists print preview anchor paste save"],
save_enablewhendirty: true,
save_onsavecallback: function() {
$.post('index.php?cid=stuff2fix',{task:"save",document:$("#document").html(),CSRF:$('#CSRF').val()});
//CLOSE EDITOR NOW
},
toolbar: "undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | save"
});
答案 0 :(得分:0)
您需要知道要移除哪个mce实例,然后在实例上调用.remove()。我修改了代码,以便在单击“保存”后删除tinemce。
帮助我的网站是http://www.tinymce.com/forum/viewtopic.php?id=9175
tinymce.init({
selector: "#document",
inline: true,
plugins: ["advlist lists print preview anchor paste save"],
save_enablewhendirty: true,
save_onsavecallback: function(inst) {
$.post('index.php?cid=stuff2fix',{task:"save",document:$("#document").html(),CSRF:$('#CSRF').val()});
inst.remove();
},
toolbar: "undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | save"
});