MCPcopy
hub / github.com/codex-team/editor.js / copyTextToClipboard

Function copyTextToClipboard

src/components/utils.ts:512–529  ·  view source on GitHub ↗
(text)

Source from the content-addressed store, hash-verified

510 * @param text - text to copy
511 */
512export function copyTextToClipboard(text): void {
513 const el = Dom.make('div', 'codex-editor-clipboard', {
514 innerHTML: text,
515 });
516
517 document.body.appendChild(el);
518
519 const selection = window.getSelection();
520 const range = document.createRange();
521
522 range.selectNode(el);
523
524 window.getSelection().removeAllRanges();
525 selection.addRange(range);
526
527 document.execCommand('copy');
528 document.body.removeChild(el);
529}
530
531/**
532 * Returns object with os name as key and boolean as value. Shows current user OS

Callers

nothing calls this directly

Calls 1

makeMethod · 0.45

Tested by

no test coverage detected