| 1 | = Undo API |
| 2 | ''by Megan Gardner'' |
| 3 | |
| 4 | - Why we’re doing this |
| 5 | - Web apps don’t have access to system undo |
| 6 | - Hidden content editable |
| 7 | - Devices with no keyboards |
| 8 | - UI screenshots for content editable |
| 9 | - What we expect to gain |
| 10 | - Usable Undo |
| 11 | - Multiple Undo Stacks |
| 12 | - API |
| 13 | - UndoItem |
| 14 | - undo |
| 15 | - redo |
| 16 | - label |
| 17 | - UndoManager |
| 18 | - item(n) |
| 19 | - position |
| 20 | - length |
| 21 | - addItem() |
| 22 | - undo() |
| 23 | - redo() |
| 24 | - Element Extension (multiple undo stacks) |
| 25 | - undoManager |
| 26 | - undoScope (set the undoScope, creates undoManger) |
| 27 | - Undo Example |
| 28 | |
| 29 | document.undoManager.addItem(new UndoItem({ |
| 30 | label: “MyAction”, |
| 31 | undo: () => { |
| 32 | // undo the action |
| 33 | }, |
| 34 | redo: () => { |
| 35 | // redo the action |
| 36 | }, |
| 37 | merged: true |
| 38 | })); |