MCPcopy
hub / github.com/NitroRCr/AIaW / handleUndoRedo

Function handleUndoRedo

src/utils/codejar.ts:404–425  ·  view source on GitHub ↗
(event: KeyboardEvent)

Source from the content-addressed store, hash-verified

402 }
403
404 function handleUndoRedo(event: KeyboardEvent) {
405 if (isUndo(event)) {
406 preventDefault(event)
407 at--
408 const record = history[at]
409 if (record) {
410 editor.innerHTML = record.html
411 restore(record.pos)
412 }
413 if (at < 0) at = 0
414 }
415 if (isRedo(event)) {
416 preventDefault(event)
417 at++
418 const record = history[at]
419 if (record) {
420 editor.innerHTML = record.html
421 restore(record.pos)
422 }
423 if (at >= history.length) at--
424 }
425 }
426
427 function recordHistory() {
428 if (!focus) return

Callers 1

CodeJarFunction · 0.85

Calls 4

isUndoFunction · 0.85
preventDefaultFunction · 0.85
isRedoFunction · 0.85
restoreFunction · 0.70

Tested by

no test coverage detected