-1
如何在tinymce中单击我的自定义按钮后运行撤消功能。在tinymce中单击我的自定义按钮时调用undo?
如何在tinymce中单击我的自定义按钮后运行撤消功能。在tinymce中单击我的自定义按钮时调用undo?
要运行撤消功能: editor.undoManager.undo();
类型此代码
function updateButtons(history) {
\t $('#undo').attr('disabled',!history.canUndo());
}
function setEditorContents(contents) {$('#editor').val(contents);}
$(function(){
\t var history = new SimpleUndo({
\t \t maxLength: 200,
\t \t provider: function(done) {
\t \t \t done($('#editor').val());
\t \t },
\t \t onUpdate: function() {
\t \t \t //onUpdate is called in constructor, making history undefined
\t \t \t if (!history) return;
\t \t \t
\t \t \t updateButtons(history);
\t \t }
\t });
\t $('#undo').click(function() {
\t \t history.undo(setEditorContents);
\t });
\t $('#editor').keypress(function() {
\t \t history.save();
\t });
\t updateButtons(history);
});
感谢..它的正常工作 –