Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当用户从上下文菜单中选择撤消/重做或在文本区域中按 ctrl z 时,我需要自己处理事件撤消和重做。如何防止默认行为并添加自定义行为。
您可以通过ctrl+z以下方式检测keyup():
ctrl+z
keyup()
var ctrlZ = e.ctrlKey && e.which === 90 if (ctrlZ) { ... }
和上下文菜单mousedown():
mousedown()
var rightClick = e.which === 2 if (rightClick) { ... }