Shift-click pastes clipboard to a task

This commit is contained in:
Ian Gulliver
2022-10-18 23:45:10 -07:00
parent bb3023cd5c
commit 89d6b9e05c
2 changed files with 17 additions and 0 deletions

View File

@@ -3,6 +3,11 @@
const reData = new RegExp('^data:(.*?);base64,(.*)$');
async function handleClick(tab, e) {
if (e.modifiers.includes('Shift')) {
await sendPaste();
return;
}
const imgURL = await browser.tabs.captureTab(tab.id);
const selecteds = await browser.tabs.executeScript(
@@ -75,6 +80,17 @@ async function handleChangeInt(e) {
await browser.storage.local.remove([key]);
}
async function sendPaste() {
const clip = await navigator.clipboard.readText();
const store = {};
store[`create_${crypto.randomUUID()}`] = {
name: 'Paste',
html_notes: `<body>${escapeHTML(clip)}</body>`,
};
await browser.storage.local.set(store);
}
async function create(cfg, task) {
const req = {
data: {

View File

@@ -7,6 +7,7 @@
},
"permissions": [
"clipboardRead",
"storage",
"unlimitedStorage",
"<all_urls>"