First dump of doc stuff

This commit is contained in:
Garen Torikian 2012-02-02 17:00:18 -08:00
commit 79886c3e07
83 changed files with 8598 additions and 554 deletions

View file

@ -40,12 +40,30 @@
define(function(require, exports, module) {
"use strict";
/**
* class UndoManager
*
* This object controls all the undoing that needs to be done. TODO
*
**/
/**
* new UndoManager()
*
* Resets the current undo state and creates a new `UndoManager`.
**/
var UndoManager = function() {
this.reset();
};
(function() {
/**
* UndoManager.execute(options) -> Void
* - options (Object):
*
* TODO
**/
this.execute = function(options) {
var deltas = options.args[0];
this.$doc = options.args[1];
@ -53,6 +71,12 @@ var UndoManager = function() {
this.$redoStack = [];
};
/**
* UndoManager.undo(dontSelect) -> Range
* - dontSelect (Boolean): TODO
*
* [Perform an undo operation on the document, reverting the last change. Returns the range of the undo.](~UndoManager.undo)
**/
this.undo = function(dontSelect) {
var deltas = this.$undoStack.pop();
var undoSelectionRange = null;
@ -64,6 +88,12 @@ var UndoManager = function() {
return undoSelectionRange;
};
/**
* UndoManager.redo(dontSelect) -> Void
* - dontSelect (Boolean): TODO
*
* [Perform a redo operation on the document, reimplementing the last change.](~UndoManager.redo)
**/
this.redo = function(dontSelect) {
var deltas = this.$redoStack.pop();
var redoSelectionRange = null;
@ -75,15 +105,30 @@ var UndoManager = function() {
return redoSelectionRange;
};
/**
* UndoManager.reset() -> Void
*
* Destroys the stack of undo and redo redo operations.
**/
this.reset = function() {
this.$undoStack = [];
this.$redoStack = [];
};
/**
* UndoManager.hasUndo() -> Boolean
*
* Returns `true` if there are undo operations left to perform.
**/
this.hasUndo = function() {
return this.$undoStack.length > 0;
};
/**
* UndoManager.hasRedo() -> Boolean
*
* Returns `true` if there are redo operations left to perform.
**/
this.hasRedo = function() {
return this.$redoStack.length > 0;
};