79301570

Date: 2024-12-22 19:22:23
Score: 0.5
Natty:
Report link

Faced with this issue, I published undo.js on GitHub to solve the problem. My thoughts on this are the following:

My library works with contenteditable elements, textarea and inputs, and uses custom events. An example would be the following:

var observer = undo.observe(document.body, {
    allowUntrusted: false,
    captureAll: true,
    preventDefault:false
});
myelement.addEventListener("beforeundo", function(e){
})
myelement.addEventListener("undo", function(e){
    console.log(e.detail.shortcut) // whether the undo event was caused by a shortcut (CTRL+Z)
})
myelement.addEventListener("beforeredo", function(e){
})
myelement.addEventListener("redo", function(e){
})
Reasons:
  • Contains signature (1):
  • Long answer (-1):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: JDMCreator