MCPcopy
hub / github.com/xtermjs/xterm.js / simulatePaste

Function simulatePaste

test/playwright/InputHandler.test.ts:1386–1397  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

1384}
1385
1386async function simulatePaste(text: string): Promise<string> {
1387 const id = Math.floor(Math.random() * 1000000);
1388 await ctx.page.evaluate(`
1389 (function() {
1390 window.term.onData(e => window.result_${id} = e);
1391 const clipboardData = new DataTransfer();
1392 clipboardData.setData('text/plain', '${text}');
1393 window.term.textarea.dispatchEvent(new ClipboardEvent('paste', { clipboardData }));
1394 })();
1395 `);
1396 return await ctx.page.evaluate(`window.result_${id} `);
1397}
1398
1399async function getCursor(): Promise<{ col: number, row: number }> {
1400 return ctx.page.evaluate(`

Callers 1

Calls 1

evaluateMethod · 0.65

Tested by

no test coverage detected