web-remarq 0.4.3 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +41 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +41 -10
- package/dist/index.js.map +1 -1
- package/dist/web-remarq.global.global.js +41 -10
- package/dist/web-remarq.global.global.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -615,7 +615,7 @@ var CSS = `
|
|
|
615
615
|
.remarq-toolbar.remarq-pos-top-right { top: 16px; right: 16px; }
|
|
616
616
|
.remarq-toolbar.remarq-pos-top-left { top: 16px; left: 16px; flex-direction: row-reverse; }
|
|
617
617
|
|
|
618
|
-
.remarq-toolbar.remarq-minimized { padding:
|
|
618
|
+
.remarq-toolbar.remarq-minimized { padding: 8px; }
|
|
619
619
|
|
|
620
620
|
.remarq-toolbar-btn {
|
|
621
621
|
display: flex;
|
|
@@ -1911,6 +1911,7 @@ var MarkerManager = class {
|
|
|
1911
1911
|
// src/ui/toast.ts
|
|
1912
1912
|
var currentToast = null;
|
|
1913
1913
|
var currentTimer = null;
|
|
1914
|
+
var fadeTimer = null;
|
|
1914
1915
|
function showToast(container, message, duration = 3e3) {
|
|
1915
1916
|
hideToast();
|
|
1916
1917
|
const toast = document.createElement("div");
|
|
@@ -1921,7 +1922,7 @@ function showToast(container, message, duration = 3e3) {
|
|
|
1921
1922
|
currentTimer = setTimeout(() => {
|
|
1922
1923
|
if (currentToast) {
|
|
1923
1924
|
currentToast.classList.add("remarq-toast-fade");
|
|
1924
|
-
setTimeout(() => hideToast(), 300);
|
|
1925
|
+
fadeTimer = setTimeout(() => hideToast(), 300);
|
|
1925
1926
|
}
|
|
1926
1927
|
}, duration);
|
|
1927
1928
|
}
|
|
@@ -1930,6 +1931,10 @@ function hideToast() {
|
|
|
1930
1931
|
clearTimeout(currentTimer);
|
|
1931
1932
|
currentTimer = null;
|
|
1932
1933
|
}
|
|
1934
|
+
if (fadeTimer) {
|
|
1935
|
+
clearTimeout(fadeTimer);
|
|
1936
|
+
fadeTimer = null;
|
|
1937
|
+
}
|
|
1933
1938
|
if (currentToast) {
|
|
1934
1939
|
currentToast.remove();
|
|
1935
1940
|
currentToast = null;
|
|
@@ -2301,7 +2306,7 @@ function handleInspectKeydown(e) {
|
|
|
2301
2306
|
toolbar.setSpacingActive(spacingMode);
|
|
2302
2307
|
if (!spacingMode) spacingOverlay.hide();
|
|
2303
2308
|
}
|
|
2304
|
-
if (e.
|
|
2309
|
+
if (e.altKey && e.code === "KeyI") {
|
|
2305
2310
|
e.preventDefault();
|
|
2306
2311
|
setInspecting(!inspecting);
|
|
2307
2312
|
if (!inspecting) {
|
|
@@ -2463,13 +2468,36 @@ function exportJSON() {
|
|
|
2463
2468
|
showToast(themeManager.container, "Exported as JSON");
|
|
2464
2469
|
}
|
|
2465
2470
|
function copyToClipboard() {
|
|
2471
|
+
var _a3;
|
|
2466
2472
|
const md = generateMarkdown();
|
|
2467
|
-
if (!md)
|
|
2468
|
-
|
|
2473
|
+
if (!md) {
|
|
2474
|
+
showToast(themeManager.container, "No annotations to copy");
|
|
2475
|
+
return;
|
|
2476
|
+
}
|
|
2477
|
+
if ((_a3 = navigator.clipboard) == null ? void 0 : _a3.writeText) {
|
|
2478
|
+
navigator.clipboard.writeText(md).then(() => {
|
|
2479
|
+
showToast(themeManager.container, "Copied to clipboard");
|
|
2480
|
+
}).catch(() => {
|
|
2481
|
+
fallbackCopy(md);
|
|
2482
|
+
});
|
|
2483
|
+
} else {
|
|
2484
|
+
fallbackCopy(md);
|
|
2485
|
+
}
|
|
2486
|
+
}
|
|
2487
|
+
function fallbackCopy(text) {
|
|
2488
|
+
const textarea = document.createElement("textarea");
|
|
2489
|
+
textarea.value = text;
|
|
2490
|
+
textarea.style.position = "fixed";
|
|
2491
|
+
textarea.style.opacity = "0";
|
|
2492
|
+
document.body.appendChild(textarea);
|
|
2493
|
+
textarea.select();
|
|
2494
|
+
try {
|
|
2495
|
+
document.execCommand("copy");
|
|
2469
2496
|
showToast(themeManager.container, "Copied to clipboard");
|
|
2470
|
-
}
|
|
2471
|
-
|
|
2472
|
-
}
|
|
2497
|
+
} catch (e) {
|
|
2498
|
+
showToast(themeManager.container, "Failed to copy");
|
|
2499
|
+
}
|
|
2500
|
+
textarea.remove();
|
|
2473
2501
|
}
|
|
2474
2502
|
function exportAgent() {
|
|
2475
2503
|
const anns = storage.getAll();
|
|
@@ -2489,10 +2517,13 @@ function copyAgentToClipboard() {
|
|
|
2489
2517
|
}
|
|
2490
2518
|
function setupMutationObserver() {
|
|
2491
2519
|
mutationObserver = new MutationObserver((mutations) => {
|
|
2520
|
+
let hasExternalMutation = false;
|
|
2492
2521
|
for (const m of mutations) {
|
|
2493
|
-
if (m.target instanceof HTMLElement && m.target.closest("[data-remarq-theme]"))
|
|
2522
|
+
if (m.target instanceof HTMLElement && m.target.closest("[data-remarq-theme]")) continue;
|
|
2523
|
+
hasExternalMutation = true;
|
|
2524
|
+
break;
|
|
2494
2525
|
}
|
|
2495
|
-
scheduleRefresh();
|
|
2526
|
+
if (hasExternalMutation) scheduleRefresh();
|
|
2496
2527
|
});
|
|
2497
2528
|
mutationObserver.observe(document.body, {
|
|
2498
2529
|
childList: true,
|