Skip to content

Commit

Permalink
fixes lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
vrknetha committed Dec 8, 2024
1 parent b346a10 commit f0286b0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/clipboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
pasteRichText,
cutRichText,
getClipboardContent,
setClipboardContent
setClipboardContent,
} from './utils';

export class PlaywrightClipboard {
Expand Down Expand Up @@ -253,4 +253,4 @@ export class PlaywrightClipboard {
throw new Error(ClipboardError.WORD_BOUNDARY_ERROR);
}
}
}
}
14 changes: 7 additions & 7 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,19 +167,19 @@ export async function getClipboardContent(page: Page): Promise<string> {
temp.style.opacity = '0';
document.body.appendChild(temp);
});

const modifierKey = process.platform === 'darwin' ? 'Meta' : 'Control';
await page.focus(tempSelector);
await page.keyboard.press(`${modifierKey}+V`);
await page.waitForTimeout(100);

const text = await page.inputValue(tempSelector);

await page.evaluate(() => {
const temp = document.querySelector('#__clipboard_temp__');
if (temp) temp.remove();
});

return text;
}
} catch (error) {
Expand All @@ -205,14 +205,14 @@ export async function setClipboardContent(page: Page, text: string): Promise<voi
temp.value = text;
document.body.appendChild(temp);
}, text);

const modifierKey = process.platform === 'darwin' ? 'Meta' : 'Control';
await page.focus(tempSelector);
await page.keyboard.press(`${modifierKey}+A`);
await page.waitForTimeout(100);
await page.keyboard.press(`${modifierKey}+C`);
await page.waitForTimeout(100);

await page.evaluate(() => {
const temp = document.querySelector('#__clipboard_temp__');
if (temp) temp.remove();
Expand All @@ -221,4 +221,4 @@ export async function setClipboardContent(page: Page, text: string): Promise<voi
} catch (error) {
throw new Error(ClipboardError.CLIPBOARD_ACCESS_DENIED);
}
}
}

0 comments on commit f0286b0

Please sign in to comment.