Unable to get document.execCommand('undo') working in the same manner across browsers

前端 未结 2 1984
青春惊慌失措
青春惊慌失措 2021-01-03 11:02

I have some code implementing a context menu on a textbox, the context menu is to have an Undo and Redo item that calls the browsers native methods

2条回答
  •  粉色の甜心
    2021-01-03 11:26

    As I discovered from the question I asked, the undoManager API in Firefox DOES work. I looked at the jsFiddle link (http://jsfiddle.net/DULV4/1/) posted by Tim Down, and there appear to be a couple issues:

    • An undoScope attribute must be set to true (either in-line or programmatically). This enables the undoManager for that element.
    • Anything you undo has to first be created by the undoManager.transact() function (though I'm wondering if there is any way to incorporate the native undo stack into the current undoManager's transaction history).

    I'm only a novice with this, so take what I say with a grain of salt and see https://dvcs.w3.org/hg/undomanager/raw-file/tip/undomanager.html for all the information on using it.

提交回复
热议问题