Ace Editor Pause/Disable UndoManager

谁都会走 提交于 2019-12-13 03:34:24

问题


  • Is there any way to remove specific stack value from UndoManager

OR

  • any function to pause/disable and start/enable UndoManager again.

I want not to push specific data to UndoManager's stack.


回答1:


It is not possible to simply not push deltas to the stack, since in that case undoing previous deltas won't be possible, you need to also transform the deltas around skipped delta. Say if you have a document "xyz" to which {insert, 2, "a"} is applied to obtain "xyaz" and then {insert, 1, "b"} to get "xbyaz". Now to undo the first edit but keep second one you need to apply {delete, 2+1, "a"}. The algorithm for doing this is not very complex, but it requires to handle many branches, so can get hairy. Ace doesn't provide an api for this atm.



来源:https://stackoverflow.com/questions/34967399/ace-editor-pause-disable-undomanager

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!