当前位置: 首页 > 文档资料 > tinyMCE 帮助文档 >

tinymce-UndoManager

优质
小牛编辑
124浏览
2023-12-01

Methods

namesummarydefined by
add()Adds a new undo level/snapshot to the undo list.tinymce.UndoManager
beforeChange()Stores away a bookmark to be used when performing an undo action so that the selection is before the change has been made.tinymce.UndoManager
clear()Removes all undo levels.tinymce.UndoManager
extra()Adds an extra "hidden" undo level by first applying the first mutation and store that to the undo stack then roll back that change and do the second mutation on top of the stack. This will produce an extra undo level that the user doesn't see until they undo.tinymce.UndoManager
hasRedo()Returns true/false if the undo manager has any redo levels.tinymce.UndoManager
hasUndo()Returns true/false if the undo manager has any undo levels.tinymce.UndoManager
ignore()Executes the specified mutator function as an undo transaction. But without adding an undo level. Any logic within the translation that adds undo levels will be ignored. So a translation can include calls to execCommand or editor.insertContent.tinymce.UndoManager
redo()Redoes the last action.tinymce.UndoManager
transact()Executes the specified mutator function as an undo transaction. The selection before the modification will be stored to the undo stack and if the DOM changes it will add a new undo level. Any logic within the translation that adds undo levels will be ignored. So a translation can include calls to execCommand or editor.insertContent.tinymce.UndoManager
undo()Undoes the last action.tinymce.UndoManager

Methods

add

add(level:Object, event:DOMEvent):Object

Adds a new undo level/snapshot to the undo list.

Parameters
  • level (Object) - Optional undo level object to add.
  • event (DOMEvent) - Optional event responsible for the creation of the undo level.
Return value
  • Object - Undo level that got added or null it a level wasn't needed.

beforeChange

beforeChange()

Stores away a bookmark to be used when performing an undo action so that the selection is before the change has been made.

clear

clear()

Removes all undo levels.

extra

extra(callback1:function, callback2:function)

Adds an extra "hidden" undo level by first applying the first mutation and store that to the undo stack then roll back that change and do the second mutation on top of the stack. This will produce an extra undo level that the user doesn't see until they undo.

Parameters
  • callback1 (function) - Function that does mutation but gets stored as a "hidden" extra undo level.
  • callback2 (function) - Function that does mutation but gets displayed to the user.

hasRedo

hasRedo():Boolean

Returns true/false if the undo manager has any redo levels.

Return value
  • Boolean - true/false if the undo manager has any redo levels.

hasUndo

hasUndo():Boolean

Returns true/false if the undo manager has any undo levels.

Return value
  • Boolean - true/false if the undo manager has any undo levels.

ignore

ignore(callback:function)

Executes the specified mutator function as an undo transaction. But without adding an undo level. Any logic within the translation that adds undo levels will be ignored. So a translation can include calls to execCommand or editor.insertContent.

Parameters
  • callback (function) - Function that gets executed and has dom manipulation logic in it.

redo

redo():Object

Redoes the last action.

Return value
  • Object - Redo level or null if no redo was performed.

transact

transact(callback:function):Object

Executes the specified mutator function as an undo transaction. The selection before the modification will be stored to the undo stack and if the DOM changes it will add a new undo level. Any logic within the translation that adds undo levels will be ignored. So a translation can include calls to execCommand or editor.insertContent.

Parameters
  • callback (function) - Function that gets executed and has dom manipulation logic in it.
Return value
  • Object - Undo level that got added or null it a level wasn't needed.

undo

undo():Object

Undoes the last action.

Return value
  • Object - Undo level or null if no undo was performed.

Can't find what you're looking for? Let us know.

Except as otherwise noted, the content of this page is licensed under the Creative Commons BY-NC-SA 3.0 License, and code samples are licensed under the Apache 2.0 License.

最后更新:

类似资料

  • 问题内容: 如何在Swift中使用(以前)? 这是我尝试复制的一个Objective-C示例: 但是,Swift似乎没有,这(似乎)意味着我无法在未实现的方法上调用方法。 我已经在Swift中尝试了基于对象的版本,但似乎使Playground崩溃了: 但是它似乎崩溃了,即使我的对象接受了一个类型的参数 在Swift中执行此操作的最佳方法是什么?有没有一种方法可以避免通过基于对象的注册发送不必要的对

  • 问题内容: 我正在使用捕获我中的更改。 但是,该方法将删除所有内容,然后粘贴文本。撤消操作时,我首先会看到一个空白区域,然后它会显示以前的文本。 繁殖方法: 运行以下代码 点击按钮 按撤消(您将看到一个空的文本区域!) 按撤消(您将看到实际的先前文本) 我想跳过3)。 问题答案: 您可以尝试如下操作:

相关阅读