fix capture
This commit is contained in:
@@ -115,7 +115,7 @@ async function captureFullPage(msg) {
|
||||
const windowId = msg.windowId;
|
||||
if (tabId == null) throw new Error('No active tab');
|
||||
|
||||
const dims = await browser.tabs.sendMessage(tabId, { kind: 'get_viewport' });
|
||||
const dims = await browser.tabs.sendMessage(tabId, { kind: 'get_viewport' }, { frameId: 0 });
|
||||
const vw = dims.viewportWidth || 1;
|
||||
const vh = dims.viewportHeight || 1;
|
||||
const ph = dims.pageHeight || vh;
|
||||
@@ -129,13 +129,13 @@ async function captureFullPage(msg) {
|
||||
const parts = [];
|
||||
for (let i = 0; i < sliceCount; i++) {
|
||||
const y = Math.max(0, Math.min(i * vh, ph - vh));
|
||||
await browser.tabs.sendMessage(tabId, { kind: 'scroll_to', y: y });
|
||||
await browser.tabs.sendMessage(tabId, { kind: 'scroll_to', y: y }, { frameId: 0 });
|
||||
await sleep(250);
|
||||
const dataUrl = await browser.tabs.captureVisibleTab(windowId, { format: 'png' });
|
||||
parts.push({ dataUrl: dataUrl, y: y });
|
||||
}
|
||||
|
||||
await browser.tabs.sendMessage(tabId, { kind: 'scroll_to', y: dims.scrollY || 0 }).catch(() => {});
|
||||
await browser.tabs.sendMessage(tabId, { kind: 'scroll_to', y: dims.scrollY || 0 }, { frameId: 0 }).catch(() => {});
|
||||
|
||||
const canvas = document.createElement('canvas');
|
||||
canvas.width = Math.round(vw * dpr);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"manifest_version": 3,
|
||||
"name": "quickSnote",
|
||||
"name": "QUICKsnote",
|
||||
"version": "1.0.6",
|
||||
"description": "Quick-capture a note to snotes from any page, with the selected text and page link ready to use",
|
||||
"description": "QUICKsnote captures a note to snotes from any page, with the selected text and page link ready to use",
|
||||
"permissions": [
|
||||
"storage",
|
||||
"activeTab"
|
||||
@@ -31,7 +31,7 @@
|
||||
"js": [
|
||||
"content.js"
|
||||
],
|
||||
"all_frames": true,
|
||||
"all_frames": false,
|
||||
"run_at": "document_idle"
|
||||
}
|
||||
],
|
||||
@@ -42,7 +42,7 @@
|
||||
}
|
||||
},
|
||||
"action": {
|
||||
"default_title": "quickSnote",
|
||||
"default_title": "QUICKsnote",
|
||||
"default_popup": "popup.html",
|
||||
"default_icon": {
|
||||
"48": "icons/icon-48.png",
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>quickSnote Options</title>
|
||||
<title>QUICKsnote Options</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
||||
@@ -26,7 +26,7 @@
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>quickSnote</h1>
|
||||
<h1>QUICKsnote</h1>
|
||||
|
||||
<div class="field">
|
||||
<label for="serverUrl">snotes server URL</label>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
try {
|
||||
const tabs = await browser.tabs.query({ active: true, currentWindow: true });
|
||||
if (!tabs.length || tabs[0].id == null) return;
|
||||
const ctx = await browser.tabs.sendMessage(tabs[0].id, { kind: 'get_context' });
|
||||
const ctx = await browser.tabs.sendMessage(tabs[0].id, { kind: 'get_context' }, { frameId: 0 });
|
||||
if (ctx && ctx.selection && !noteEl.value) {
|
||||
noteEl.value = ctx.selection;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user