Shift-click pastes clipboard to a task
This commit is contained in:
@@ -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: {
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
},
|
||||
|
||||
"permissions": [
|
||||
"clipboardRead",
|
||||
"storage",
|
||||
"unlimitedStorage",
|
||||
"<all_urls>"
|
||||
|
||||
Reference in New Issue
Block a user