MCPcopy
hub / github.com/antonmedv/codejar / handleCut

Function handleCut

codejar.ts:464–477  ·  view source on GitHub ↗
(event: ClipboardEvent)

Source from the content-addressed store, hash-verified

462 }
463
464 function handleCut(event: ClipboardEvent) {
465 const pos = save()
466 const selection = getSelection()
467 const originalEvent = (event as any).originalEvent ?? event
468 originalEvent.clipboardData.setData('text/plain', selection.toString())
469 document.execCommand('delete')
470 doHighlight(editor)
471 restore({
472 start: Math.min(pos.start, pos.end),
473 end: Math.min(pos.start, pos.end),
474 dir: '<-',
475 })
476 preventDefault(event)
477 }
478
479 function visit(editor: HTMLElement, visitor: (el: Node) => 'stop' | undefined) {
480 const queue: Node[] = []

Callers 1

CodeJarFunction · 0.85

Calls 5

saveFunction · 0.85
getSelectionFunction · 0.85
doHighlightFunction · 0.85
restoreFunction · 0.85
preventDefaultFunction · 0.85

Tested by

no test coverage detected