Skip to content

Commit

Permalink
tabs vs whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
Lusito committed Dec 5, 2017
1 parent 92fb7be commit a9c5888
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,34 +63,34 @@ class UndoableValueChange extends UndoableEdit {

const manager = new UndoManager();
manager.setListener(()=> {
console.log((manager.canUndo() ? "enable" : "disable") + " the undo button");
console.log((manager.canRedo() ? "enable" : "disable") + " the redo button");
console.log((manager.isModified() ? "enable" : "disable") + " the save button");
console.log((manager.canUndo() ? "enable" : "disable") + " the undo button");
console.log((manager.canRedo() ? "enable" : "disable") + " the redo button");
console.log((manager.isModified() ? "enable" : "disable") + " the save button");
});
const applyValue = (value:string)=> console.log(`Value changed to "${value}"`);
const example = "basic";
if(example === "basic") {
applyValue("Foo Bar"); // Value changed to "Foo Bar"
manager.add(new UndoableValueChange("Hello World", "Foo Bar", applyValue));
manager.undo(); // Value changed to "Hello World"
manager.redo(); // Value changed to "Foo Bar"
applyValue("Foo Bar"); // Value changed to "Foo Bar"
manager.add(new UndoableValueChange("Hello World", "Foo Bar", applyValue));
manager.undo(); // Value changed to "Hello World"
manager.redo(); // Value changed to "Foo Bar"
} else if(example === "merge") {
manager.add(new UndoableValueChange("Hello World", "Foo Bar", applyValue));
console.log(manager.canUndo()); // true
console.log(manager.isModified()); // true
manager.add(new UndoableValueChange("Foo Bar", "Hello World", applyValue));
console.log(manager.canUndo()); // false
console.log(manager.isModified()); // false
manager.add(new UndoableValueChange("Hello World", "Foo Bar", applyValue));
console.log(manager.canUndo()); // true
console.log(manager.isModified()); // true
manager.add(new UndoableValueChange("Foo Bar", "Hello World", applyValue));
console.log(manager.canUndo()); // false
console.log(manager.isModified()); // false
} else if(example === "modified") {
console.log(manager.isModified()); // false
manager.add(new UndoableValueChange("Hello World", "Foo Bar", applyValue));
console.log(manager.isModified()); // true
manager.setUnmodified();
console.log(manager.isModified()); // false
manager.undo();
console.log(manager.isModified()); // true
manager.redo();
console.log(manager.isModified()); // false
console.log(manager.isModified()); // false
manager.add(new UndoableValueChange("Hello World", "Foo Bar", applyValue));
console.log(manager.isModified()); // true
manager.setUnmodified();
console.log(manager.isModified()); // false
manager.undo();
console.log(manager.isModified()); // true
manager.redo();
console.log(manager.isModified()); // false
}
```

Expand Down

0 comments on commit a9c5888

Please sign in to comment.