MCPcopy Create free account
hub / github.com/OpenAnonymity/oa-chat / insertTextAtCursor

Function insertTextAtCursor

chat/services/editableDiffRenderer.js:583–595  ·  view source on GitHub ↗
(text)

Source from the content-addressed store, hash-verified

581};
582
583const insertTextAtCursor = (text) => {
584 if (!text) return;
585 if (document.queryCommandSupported?.('insertText')) {
586 document.execCommand('insertText', false, text);
587 return;
588 }
589
590 const selection = window.getSelection();
591 if (!selection || selection.rangeCount === 0) return;
592 selection.deleteFromDocument();
593 selection.getRangeAt(0).insertNode(document.createTextNode(text));
594 selection.collapseToEnd();
595};
596
597export const handleEditableDiffPaste = (event) => {
598 event.preventDefault();

Callers 1

handleEditableDiffPasteFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected