|
@@ -22,7 +22,14 @@ class View<T> extends hide.comp.Component {
|
|
var watches : Array<{ keep : Bool, path : String, callb : Void -> Void }> = [];
|
|
var watches : Array<{ keep : Bool, path : String, callb : Void -> Void }> = [];
|
|
public var keys(get,null) : Keys;
|
|
public var keys(get,null) : Keys;
|
|
public var state(default, null) : T;
|
|
public var state(default, null) : T;
|
|
- public var undo(default, null) = new hide.ui.UndoHistory();
|
|
|
|
|
|
+ public var undo(get, null) = new hide.ui.UndoHistory();
|
|
|
|
+
|
|
|
|
+ function get_undo() : hide.ui.UndoHistory {
|
|
|
|
+ return undoStack[undoStack.length-1];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var undoStack: Array<UndoHistory> = [new hide.ui.UndoHistory()];
|
|
|
|
+
|
|
public var config(get, null) : Config;
|
|
public var config(get, null) : Config;
|
|
public var viewClass(get, never) : String;
|
|
public var viewClass(get, never) : String;
|
|
public var defaultOptions(get,never) : ViewOptions;
|
|
public var defaultOptions(get,never) : ViewOptions;
|
|
@@ -79,6 +86,29 @@ class View<T> extends hide.comp.Component {
|
|
return Type.getClassName(Type.getClass(this));
|
|
return Type.getClassName(Type.getClass(this));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ Push a new "UndoStack", that will collect all the new undo.change until
|
|
|
|
+ popUndoStack is called
|
|
|
|
+ **/
|
|
|
|
+ public function pushUndoStack() {
|
|
|
|
+ undoStack.push(new UndoHistory());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Pop the last pushUndoStack operation, creating a unique undo operation that contains all the changes were
|
|
|
|
+ recorded in the undo buffer if any were created
|
|
|
|
+ **/
|
|
|
|
+ public function popUndoStack() {
|
|
|
|
+ if (undoStack.length <= 1) {
|
|
|
|
+ throw "trying to pop while there is only one or less undoes on the stack";
|
|
|
|
+ }
|
|
|
|
+ var top = undoStack.pop();
|
|
|
|
+
|
|
|
|
+ @:privateAccess if (undo.undoElts.length > 0) {
|
|
|
|
+ undo.change(top.toElement());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
#if !hl
|
|
#if !hl
|
|
public function setClipboard( v : Dynamic, ?type : String, ?opts : {} ) {
|
|
public function setClipboard( v : Dynamic, ?type : String, ?opts : {} ) {
|
|
nw.Clipboard.get().set(ide.toJSON({ type : type == null ? viewClass : type, value : v, opts : opts }));
|
|
nw.Clipboard.get().set(ide.toJSON({ type : type == null ? viewClass : type, value : v, opts : opts }));
|