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

Function recordHistory

src/utils/codejar.ts:427–449  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

425 }
426
427 function recordHistory() {
428 if (!focus) return
429
430 const html = editor.innerHTML
431 const pos = save()
432
433 const lastRecord = history[at]
434 if (lastRecord) {
435 if (lastRecord.html === html &&
436 lastRecord.pos.start === pos.start &&
437 lastRecord.pos.end === pos.end) return
438 }
439
440 at++
441 history[at] = { html, pos }
442 history.splice(at + 1)
443
444 const maxHistory = 300
445 if (at > maxHistory) {
446 at = maxHistory
447 history.splice(0, 1)
448 }
449 }
450
451 function handlePaste(event: ClipboardEvent) {
452 if (event.defaultPrevented) return

Callers 1

CodeJarFunction · 0.85

Calls 1

saveFunction · 0.85

Tested by

no test coverage detected