wiki:UndoAPI

Version 1 (modified by Jon Davis, 4 years ago) (diff)

--

Undo API

by Megan Gardner

  • Why we’re doing this
    • Web apps don’t have access to system undo
      • Hidden content editable
      • Devices with no keyboards
  • UI screenshots for content editable
  • What we expect to gain
    • Usable Undo
    • Multiple Undo Stacks
  • API
    • UndoItem
      • undo
      • redo
      • label
    • UndoManager
      • item(n)
      • position
      • length
      • addItem()
      • undo()
      • redo()
    • Element Extension (multiple undo stacks)
      • undoManager
      • undoScope (set the undoScope, creates undoManger)
  • Undo Example

document.undoManager.addItem(new UndoItem({

label: “MyAction”, undo: () => {

undo the action

}, redo: () => {

redo the action

}, merged: true

}));