Save changes
This commit is contained in:
parent
0739444f87
commit
eb955fa90d
18 changed files with 15484 additions and 1283 deletions
|
|
@ -32,16 +32,18 @@ define(function(require, exports, module) {
|
|||
"use strict";
|
||||
|
||||
/**
|
||||
* class UndoManager
|
||||
*
|
||||
*
|
||||
* This object maintains the undo stack for an [[EditSession `EditSession`]].
|
||||
*
|
||||
* @class UndoManager
|
||||
**/
|
||||
|
||||
/**
|
||||
* new UndoManager()
|
||||
*
|
||||
*
|
||||
* Resets the current undo state and creates a new `UndoManager`.
|
||||
*
|
||||
* @constructor
|
||||
**/
|
||||
var UndoManager = function() {
|
||||
this.reset();
|
||||
|
|
@ -50,13 +52,12 @@ var UndoManager = function() {
|
|||
(function() {
|
||||
|
||||
/**
|
||||
* UndoManager.execute(options) -> Void
|
||||
* - options (Object): Contains additional properties
|
||||
*
|
||||
* Provides a means for implementing your own undo manager. `options` has one property, `args`, an [[Array `Array`]], with two elements:
|
||||
*
|
||||
* * `args[0]` is an array of deltas
|
||||
* * `args[1]` is the document to associate with
|
||||
* - `args[0]` is an array of deltas
|
||||
* - `args[1]` is the document to associate with
|
||||
*
|
||||
* @param {Object} options Contains additional properties
|
||||
*
|
||||
**/
|
||||
this.execute = function(options) {
|
||||
|
|
@ -67,10 +68,11 @@ var UndoManager = function() {
|
|||
};
|
||||
|
||||
/**
|
||||
* UndoManager.undo(dontSelect) -> Range
|
||||
* - dontSelect (Boolean): {:dontSelect}
|
||||
* [Perform an undo operation on the document, reverting the last change.]{: #UndoManager.undo}
|
||||
* @param {Boolean} dontSelect {:dontSelect}
|
||||
*
|
||||
* [Perform an undo operation on the document, reverting the last change. Returns the range of the undo.]{: #UndoManager.undo}
|
||||
*
|
||||
* @returns {Range} The range of the undo.
|
||||
**/
|
||||
this.undo = function(dontSelect) {
|
||||
var deltas = this.$undoStack.pop();
|
||||
|
|
@ -84,10 +86,10 @@ var UndoManager = function() {
|
|||
};
|
||||
|
||||
/**
|
||||
* UndoManager.redo(dontSelect) -> Void
|
||||
* - dontSelect (Boolean): {:dontSelect}
|
||||
*
|
||||
* [Perform a redo operation on the document, reimplementing the last change.]{: #UndoManager.redo}
|
||||
* @param {Boolean} dontSelect {:dontSelect}
|
||||
*
|
||||
*
|
||||
**/
|
||||
this.redo = function(dontSelect) {
|
||||
var deltas = this.$redoStack.pop();
|
||||
|
|
@ -101,8 +103,7 @@ var UndoManager = function() {
|
|||
};
|
||||
|
||||
/**
|
||||
* UndoManager.reset() -> Void
|
||||
*
|
||||
*
|
||||
* Destroys the stack of undo and redo redo operations.
|
||||
**/
|
||||
this.reset = function() {
|
||||
|
|
@ -111,18 +112,18 @@ var UndoManager = function() {
|
|||
};
|
||||
|
||||
/**
|
||||
* UndoManager.hasUndo() -> Boolean
|
||||
*
|
||||
*
|
||||
* Returns `true` if there are undo operations left to perform.
|
||||
* @returns {Boolean}
|
||||
**/
|
||||
this.hasUndo = function() {
|
||||
return this.$undoStack.length > 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* UndoManager.hasRedo() -> Boolean
|
||||
*
|
||||
*
|
||||
* Returns `true` if there are redo operations left to perform.
|
||||
* @returns {Boolean}
|
||||
**/
|
||||
this.hasRedo = function() {
|
||||
return this.$redoStack.length > 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue