@githumbi/grabby 0.4.0 → 0.5.0
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/CHANGELOG.md +10 -0
- package/dist/angular/index.d.ts +8 -0
- package/dist/angular/index.js +519 -41
- package/dist/angular/index.js.map +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/core/index.cjs +586 -108
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +2 -2
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +519 -41
- package/dist/core/index.js.map +1 -1
- package/dist/export/index.d.cts +8 -0
- package/dist/export/index.d.ts +8 -0
- package/dist/grabby.global.js +217 -91
- package/dist/live/index.d.cts +1 -1
- package/dist/live/index.d.ts +1 -1
- package/dist/react/index.d.ts +8 -0
- package/dist/react/index.js +519 -41
- package/dist/react/index.js.map +1 -1
- package/dist/{types-DjpIHekd.d.cts → types-BQDEG-Gl.d.cts} +8 -0
- package/dist/{types-DjpIHekd.d.ts → types-BQDEG-Gl.d.ts} +8 -0
- package/package.json +1 -1
package/dist/angular/index.js
CHANGED
|
@@ -1305,7 +1305,7 @@ function createElementPicker(deps) {
|
|
|
1305
1305
|
e.stopPropagation();
|
|
1306
1306
|
if (heldElement) return;
|
|
1307
1307
|
if (hoveredElement) {
|
|
1308
|
-
deps.onSelect(hoveredElement);
|
|
1308
|
+
deps.onSelect(hoveredElement, { x: e.clientX, y: e.clientY });
|
|
1309
1309
|
}
|
|
1310
1310
|
}
|
|
1311
1311
|
return {
|
|
@@ -1563,7 +1563,8 @@ function createWebhookPlugin(url) {
|
|
|
1563
1563
|
type: "grabby.comment",
|
|
1564
1564
|
version: 1,
|
|
1565
1565
|
origin: typeof location !== "undefined" ? location.origin : null,
|
|
1566
|
-
|
|
1566
|
+
// The marker position is browser-only.
|
|
1567
|
+
comment: { ...comment, pin: void 0 }
|
|
1567
1568
|
})
|
|
1568
1569
|
}).catch(() => {
|
|
1569
1570
|
});
|
|
@@ -1655,6 +1656,9 @@ ${vars.join("\n")}
|
|
|
1655
1656
|
|
|
1656
1657
|
// src/core/toolbar/toolbar-renderer.ts
|
|
1657
1658
|
var TOOLBAR_ID = "__grabby-toolbar__";
|
|
1659
|
+
var COLLAPSED_SIZE = 42;
|
|
1660
|
+
var EASE_OUT_EXPO = "cubic-bezier(0.19, 1, 0.22, 1)";
|
|
1661
|
+
var MORPH_MS = 360;
|
|
1658
1662
|
var STYLE_ID3 = "__grabby-toolbar-styles__";
|
|
1659
1663
|
function syncSummary(comments) {
|
|
1660
1664
|
if (comments.length === 0) return null;
|
|
@@ -1676,7 +1680,13 @@ function createToolbarRenderer(callbacks, options = {}) {
|
|
|
1676
1680
|
let badge = null;
|
|
1677
1681
|
let status = null;
|
|
1678
1682
|
let expandBadge = null;
|
|
1683
|
+
let content = null;
|
|
1679
1684
|
let collapsed = false;
|
|
1685
|
+
let morphTimer = null;
|
|
1686
|
+
function clearMorph() {
|
|
1687
|
+
if (morphTimer) clearTimeout(morphTimer);
|
|
1688
|
+
morphTimer = null;
|
|
1689
|
+
}
|
|
1680
1690
|
function injectStyles2() {
|
|
1681
1691
|
if (hasStyles(STYLE_ID3)) return;
|
|
1682
1692
|
addStyles(STYLE_ID3, `
|
|
@@ -1696,7 +1706,21 @@ function createToolbarRenderer(callbacks, options = {}) {
|
|
|
1696
1706
|
box-shadow: 0 4px 16px var(--grabby-toolbar-shadow, rgba(0, 0, 0, 0.12));
|
|
1697
1707
|
pointer-events: auto;
|
|
1698
1708
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
1699
|
-
|
|
1709
|
+
box-sizing: border-box;
|
|
1710
|
+
height: ${COLLAPSED_SIZE}px;
|
|
1711
|
+
overflow: hidden;
|
|
1712
|
+
justify-content: flex-end;
|
|
1713
|
+
transition: opacity 0.2s ease, transform 0.2s ease,
|
|
1714
|
+
left ${MORPH_MS}ms ${EASE_OUT_EXPO}, width ${MORPH_MS}ms ${EASE_OUT_EXPO};
|
|
1715
|
+
}
|
|
1716
|
+
#${TOOLBAR_ID} .grabby-toolbar-content {
|
|
1717
|
+
display: flex;
|
|
1718
|
+
align-items: center;
|
|
1719
|
+
gap: 2px;
|
|
1720
|
+
flex-shrink: 0;
|
|
1721
|
+
transform-origin: right center;
|
|
1722
|
+
transition: opacity 0.24s ease-out, filter 0.3s cubic-bezier(0.22, 1, 0.36, 1),
|
|
1723
|
+
transform 0.42s ${EASE_OUT_EXPO}, visibility 0s;
|
|
1700
1724
|
}
|
|
1701
1725
|
#${TOOLBAR_ID}.grabby-toolbar-hidden {
|
|
1702
1726
|
opacity: 0;
|
|
@@ -1792,23 +1816,44 @@ function createToolbarRenderer(callbacks, options = {}) {
|
|
|
1792
1816
|
background: var(--grabby-accent-hover, #1d4ed8);
|
|
1793
1817
|
color: #fff;
|
|
1794
1818
|
}
|
|
1795
|
-
#${TOOLBAR_ID} button.grabby-btn-expand {
|
|
1819
|
+
#${TOOLBAR_ID} button.grabby-btn-expand {
|
|
1820
|
+
position: absolute;
|
|
1821
|
+
left: 50%;
|
|
1822
|
+
top: 50%;
|
|
1823
|
+
translate: -50% -50%;
|
|
1824
|
+
color: var(--grabby-accent, #2563eb);
|
|
1825
|
+
opacity: 0;
|
|
1826
|
+
scale: 0.6;
|
|
1827
|
+
visibility: hidden;
|
|
1828
|
+
pointer-events: none;
|
|
1829
|
+
transition: opacity 0.2s ease-out, scale 0.3s ${EASE_OUT_EXPO}, visibility 0s 0.2s;
|
|
1830
|
+
}
|
|
1831
|
+
#${TOOLBAR_ID} button.grabby-btn-expand .grabby-badge { top: -3px; right: -5px; }
|
|
1796
1832
|
#${TOOLBAR_ID}.grabby-toolbar-collapsed {
|
|
1797
|
-
left:
|
|
1798
|
-
right: 20px;
|
|
1799
|
-
transform: none;
|
|
1833
|
+
left: calc(100% - 20px - ${COLLAPSED_SIZE / 2}px);
|
|
1800
1834
|
padding: 4px;
|
|
1801
1835
|
}
|
|
1802
|
-
#${TOOLBAR_ID}.grabby-toolbar-collapsed.grabby-toolbar-
|
|
1803
|
-
|
|
1836
|
+
#${TOOLBAR_ID}.grabby-toolbar-collapsed .grabby-toolbar-content {
|
|
1837
|
+
opacity: 0;
|
|
1838
|
+
filter: blur(6px);
|
|
1839
|
+
transform: scale(0.4);
|
|
1840
|
+
pointer-events: none;
|
|
1841
|
+
visibility: hidden;
|
|
1842
|
+
transition: opacity 0.24s ease-out, filter 0.3s cubic-bezier(0.22, 1, 0.36, 1),
|
|
1843
|
+
transform 0.42s ${EASE_OUT_EXPO}, visibility 0s 0.3s;
|
|
1804
1844
|
}
|
|
1805
|
-
#${TOOLBAR_ID}.grabby-toolbar-collapsed
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1845
|
+
#${TOOLBAR_ID}.grabby-toolbar-collapsed button.grabby-btn-expand {
|
|
1846
|
+
opacity: 1;
|
|
1847
|
+
scale: 1;
|
|
1848
|
+
visibility: visible;
|
|
1849
|
+
pointer-events: auto;
|
|
1850
|
+
transition: opacity 0.24s ease-out 0.08s, scale 0.36s ${EASE_OUT_EXPO} 0.08s, visibility 0s;
|
|
1851
|
+
}
|
|
1852
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1853
|
+
#${TOOLBAR_ID}, #${TOOLBAR_ID} .grabby-toolbar-content, #${TOOLBAR_ID} button.grabby-btn-expand {
|
|
1854
|
+
transition-duration: 0s !important;
|
|
1855
|
+
transition-delay: 0s !important;
|
|
1856
|
+
}
|
|
1812
1857
|
}
|
|
1813
1858
|
#${TOOLBAR_ID} .grabby-toolbar-left.grabby-toolbar-left-hidden {
|
|
1814
1859
|
max-width: 0;
|
|
@@ -1863,7 +1908,9 @@ function createToolbarRenderer(callbacks, options = {}) {
|
|
|
1863
1908
|
leftGroup.appendChild(buttons.selection);
|
|
1864
1909
|
leftGroup.appendChild(buttons.history);
|
|
1865
1910
|
leftGroup.appendChild(divider);
|
|
1866
|
-
|
|
1911
|
+
content = document.createElement("div");
|
|
1912
|
+
content.className = "grabby-toolbar-content";
|
|
1913
|
+
content.appendChild(leftGroup);
|
|
1867
1914
|
if (options.review) {
|
|
1868
1915
|
status = document.createElement("span");
|
|
1869
1916
|
status.className = "grabby-toolbar-status";
|
|
@@ -1880,18 +1927,22 @@ function createToolbarRenderer(callbacks, options = {}) {
|
|
|
1880
1927
|
e.stopPropagation();
|
|
1881
1928
|
callbacks.onFinish?.();
|
|
1882
1929
|
});
|
|
1883
|
-
|
|
1884
|
-
|
|
1930
|
+
content.appendChild(status);
|
|
1931
|
+
content.appendChild(buttons.finish);
|
|
1885
1932
|
allElements.add(status);
|
|
1886
1933
|
}
|
|
1887
|
-
if (!options.hideEnable)
|
|
1888
|
-
|
|
1889
|
-
container.
|
|
1890
|
-
|
|
1934
|
+
if (!options.hideEnable) content.appendChild(buttons.enable);
|
|
1935
|
+
content.appendChild(buttons.dismiss);
|
|
1936
|
+
container.append(content, buttons.expand);
|
|
1937
|
+
if (collapsed) {
|
|
1938
|
+
container.classList.add("grabby-toolbar-collapsed");
|
|
1939
|
+
container.style.width = `${COLLAPSED_SIZE}px`;
|
|
1940
|
+
}
|
|
1891
1941
|
getUiRoot().appendChild(container);
|
|
1892
1942
|
allElements.clear();
|
|
1893
1943
|
allElements.add(container);
|
|
1894
1944
|
allElements.add(leftGroup);
|
|
1945
|
+
allElements.add(content);
|
|
1895
1946
|
allElements.add(divider);
|
|
1896
1947
|
for (const btn of Object.values(buttons)) {
|
|
1897
1948
|
allElements.add(btn);
|
|
@@ -1937,12 +1988,28 @@ function createToolbarRenderer(callbacks, options = {}) {
|
|
|
1937
1988
|
}
|
|
1938
1989
|
},
|
|
1939
1990
|
collapse() {
|
|
1991
|
+
if (collapsed) return;
|
|
1940
1992
|
collapsed = true;
|
|
1941
|
-
container
|
|
1993
|
+
if (!container) return;
|
|
1994
|
+
clearMorph();
|
|
1995
|
+
container.style.width = `${container.offsetWidth}px`;
|
|
1996
|
+
void container.offsetWidth;
|
|
1997
|
+
container.classList.add("grabby-toolbar-collapsed");
|
|
1998
|
+
container.style.width = `${COLLAPSED_SIZE}px`;
|
|
1942
1999
|
},
|
|
1943
2000
|
expand() {
|
|
2001
|
+
if (!collapsed) return;
|
|
1944
2002
|
collapsed = false;
|
|
1945
|
-
container
|
|
2003
|
+
if (!container) return;
|
|
2004
|
+
clearMorph();
|
|
2005
|
+
container.classList.remove("grabby-toolbar-collapsed");
|
|
2006
|
+
const cs = getComputedStyle(container);
|
|
2007
|
+
const chrome = ["paddingLeft", "paddingRight", "borderLeftWidth", "borderRightWidth"].reduce((sum, k) => sum + (parseFloat(cs[k]) || 0), 0);
|
|
2008
|
+
container.style.width = `${(content?.offsetWidth ?? 0) + chrome}px`;
|
|
2009
|
+
morphTimer = setTimeout(() => {
|
|
2010
|
+
morphTimer = null;
|
|
2011
|
+
if (!collapsed && container) container.style.width = "";
|
|
2012
|
+
}, MORPH_MS + 40);
|
|
1946
2013
|
},
|
|
1947
2014
|
isCollapsed() {
|
|
1948
2015
|
return collapsed;
|
|
@@ -1958,10 +2025,12 @@ function createToolbarRenderer(callbacks, options = {}) {
|
|
|
1958
2025
|
return false;
|
|
1959
2026
|
},
|
|
1960
2027
|
dispose() {
|
|
2028
|
+
clearMorph();
|
|
1961
2029
|
container?.remove();
|
|
1962
2030
|
removeStyles(STYLE_ID3);
|
|
1963
2031
|
container = null;
|
|
1964
2032
|
leftGroup = null;
|
|
2033
|
+
content = null;
|
|
1965
2034
|
buttons = {};
|
|
1966
2035
|
badge = null;
|
|
1967
2036
|
expandBadge = null;
|
|
@@ -2531,6 +2600,18 @@ function createCommentPopover(callbacks) {
|
|
|
2531
2600
|
font: 500 12px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; padding: 8px 4px; border: none;
|
|
2532
2601
|
background: transparent; color: var(--grabby-text-muted, #64748b); cursor: pointer; text-decoration: underline;
|
|
2533
2602
|
}
|
|
2603
|
+
#${POPOVER_ID} .grabby-cp-edit-actions { display: flex; align-items: center; gap: 6px; }
|
|
2604
|
+
#${POPOVER_ID} .grabby-cp-edit-actions .grabby-cp-spacer { flex: 1; }
|
|
2605
|
+
#${POPOVER_ID} .grabby-cp-delete {
|
|
2606
|
+
font: 500 12px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; padding: 8px 6px; border: none;
|
|
2607
|
+
border-radius: 8px; background: transparent; color: #b91c1c; cursor: pointer;
|
|
2608
|
+
}
|
|
2609
|
+
#${POPOVER_ID} .grabby-cp-delete:hover { background: rgba(185, 28, 28, 0.08); }
|
|
2610
|
+
#${POPOVER_ID} .grabby-cp-cancel {
|
|
2611
|
+
font: 500 12px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; padding: 8px 10px; border: none;
|
|
2612
|
+
border-radius: 8px; background: transparent; color: var(--grabby-text-muted, #64748b); cursor: pointer;
|
|
2613
|
+
}
|
|
2614
|
+
#${POPOVER_ID} .grabby-cp-cancel:hover { background: var(--grabby-surface, #f1f5f9); }
|
|
2534
2615
|
#${POPOVER_ID} .grabby-cp-hint {
|
|
2535
2616
|
font-size: 11px;
|
|
2536
2617
|
color: var(--grabby-text-muted, #94a3b8);
|
|
@@ -2592,6 +2673,37 @@ function createCommentPopover(callbacks) {
|
|
|
2592
2673
|
function isEditable(el) {
|
|
2593
2674
|
return !!el && el !== textarea && el !== nameInput && isEditableElement(el);
|
|
2594
2675
|
}
|
|
2676
|
+
function save() {
|
|
2677
|
+
const v = textarea?.value.trim();
|
|
2678
|
+
if (!v) return;
|
|
2679
|
+
pendingValue = v;
|
|
2680
|
+
if (askIdentity) showIdentityStep();
|
|
2681
|
+
else finish();
|
|
2682
|
+
}
|
|
2683
|
+
function editActions() {
|
|
2684
|
+
const act = (fn) => (e) => {
|
|
2685
|
+
e.stopPropagation();
|
|
2686
|
+
fn();
|
|
2687
|
+
};
|
|
2688
|
+
const cancel = () => {
|
|
2689
|
+
const ctx = currentCtx;
|
|
2690
|
+
doHide();
|
|
2691
|
+
callbacks.onCancel(ctx);
|
|
2692
|
+
};
|
|
2693
|
+
const del = () => {
|
|
2694
|
+
const ctx = currentCtx;
|
|
2695
|
+
doHide();
|
|
2696
|
+
callbacks.onDelete?.(ctx);
|
|
2697
|
+
};
|
|
2698
|
+
return h(
|
|
2699
|
+
"div",
|
|
2700
|
+
{ class: "grabby-cp-edit-actions" },
|
|
2701
|
+
callbacks.onDelete ? h("button", { type: "button", class: "grabby-cp-delete", "data-grabby-delete": "", onclick: act(del) }, "Delete") : null,
|
|
2702
|
+
h("span", { class: "grabby-cp-spacer" }),
|
|
2703
|
+
h("button", { type: "button", class: "grabby-cp-cancel", "data-grabby-cancel": "", onclick: act(cancel) }, "Cancel"),
|
|
2704
|
+
h("button", { type: "button", class: "grabby-cp-post", "data-grabby-save": "", onclick: act(save) }, "Save")
|
|
2705
|
+
);
|
|
2706
|
+
}
|
|
2595
2707
|
function finish(identity) {
|
|
2596
2708
|
const ctx = currentCtx;
|
|
2597
2709
|
const value = pendingValue;
|
|
@@ -2657,11 +2769,7 @@ function createCommentPopover(callbacks) {
|
|
|
2657
2769
|
e.stopImmediatePropagation();
|
|
2658
2770
|
if (e.key === "Enter" && !e.shiftKey) {
|
|
2659
2771
|
e.preventDefault();
|
|
2660
|
-
|
|
2661
|
-
if (!v) return;
|
|
2662
|
-
pendingValue = v;
|
|
2663
|
-
if (askIdentity) showIdentityStep();
|
|
2664
|
-
else finish();
|
|
2772
|
+
save();
|
|
2665
2773
|
} else if (e.key === "Escape") {
|
|
2666
2774
|
e.preventDefault();
|
|
2667
2775
|
const ctx = currentCtx;
|
|
@@ -2695,6 +2803,7 @@ function createCommentPopover(callbacks) {
|
|
|
2695
2803
|
currentCtx = { mode: opts.mode, entryId: opts.entryId };
|
|
2696
2804
|
askIdentity = opts.askIdentity === true && opts.mode === "new";
|
|
2697
2805
|
visible = true;
|
|
2806
|
+
if (opts.mode === "edit") el.appendChild(editActions());
|
|
2698
2807
|
position(el, opts.anchor);
|
|
2699
2808
|
attachKey();
|
|
2700
2809
|
textarea?.focus();
|
|
@@ -3226,9 +3335,10 @@ function createOutbox(deps) {
|
|
|
3226
3335
|
}, delay);
|
|
3227
3336
|
}
|
|
3228
3337
|
function wireShape(c) {
|
|
3229
|
-
const { screenshot: _shot, sync: _sync, ...rest } = c;
|
|
3338
|
+
const { screenshot: _shot, sync: _sync, pin: _pin, ...rest } = c;
|
|
3230
3339
|
void _shot;
|
|
3231
3340
|
void _sync;
|
|
3341
|
+
void _pin;
|
|
3232
3342
|
return rest;
|
|
3233
3343
|
}
|
|
3234
3344
|
function postComment(comment) {
|
|
@@ -3577,11 +3687,314 @@ function createFreezeOverlay() {
|
|
|
3577
3687
|
};
|
|
3578
3688
|
}
|
|
3579
3689
|
|
|
3690
|
+
// src/core/overlay/markers.ts
|
|
3691
|
+
var LAYER_ID = "__grabby-markers__";
|
|
3692
|
+
var TIP_ID = "__grabby-marker-tip__";
|
|
3693
|
+
var STYLE_ID9 = "__grabby-marker-styles__";
|
|
3694
|
+
var SIZE = 22;
|
|
3695
|
+
var ROUTE_CHECK_MS = 250;
|
|
3696
|
+
var LOOKUP_RETRY_MS = 500;
|
|
3697
|
+
var STAGGER_MS = 30;
|
|
3698
|
+
var TIP_MAX = 140;
|
|
3699
|
+
var ICON_EDIT = {
|
|
3700
|
+
size: 12,
|
|
3701
|
+
shapes: paths("M10.5 2.5l3 3L6 13H3v-3z", "M9 4l3 3")
|
|
3702
|
+
};
|
|
3703
|
+
function createMarkers(deps) {
|
|
3704
|
+
let layer = null;
|
|
3705
|
+
let tip = null;
|
|
3706
|
+
let visible = false;
|
|
3707
|
+
let route = "";
|
|
3708
|
+
let rafId = null;
|
|
3709
|
+
let lastRouteCheck = 0;
|
|
3710
|
+
let hovered = null;
|
|
3711
|
+
const entries = /* @__PURE__ */ new Map();
|
|
3712
|
+
function injectStyles2() {
|
|
3713
|
+
if (hasStyles(STYLE_ID9)) return;
|
|
3714
|
+
addStyles(STYLE_ID9, `
|
|
3715
|
+
#${LAYER_ID} {
|
|
3716
|
+
position: fixed;
|
|
3717
|
+
inset: 0;
|
|
3718
|
+
pointer-events: none;
|
|
3719
|
+
z-index: ${Z_INDEX_CROSSHAIR};
|
|
3720
|
+
}
|
|
3721
|
+
#${LAYER_ID} .grabby-marker {
|
|
3722
|
+
position: absolute;
|
|
3723
|
+
left: 0;
|
|
3724
|
+
top: 0;
|
|
3725
|
+
width: ${SIZE}px;
|
|
3726
|
+
height: ${SIZE}px;
|
|
3727
|
+
margin: 0;
|
|
3728
|
+
padding: 0;
|
|
3729
|
+
border: none;
|
|
3730
|
+
border-radius: 50%;
|
|
3731
|
+
background: var(--grabby-accent, #2563eb);
|
|
3732
|
+
color: #fff;
|
|
3733
|
+
box-shadow: 0 0 0 2px #fff, 0 2px 6px rgba(0, 0, 0, 0.25);
|
|
3734
|
+
font: 600 11px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
3735
|
+
display: flex;
|
|
3736
|
+
align-items: center;
|
|
3737
|
+
justify-content: center;
|
|
3738
|
+
cursor: pointer;
|
|
3739
|
+
pointer-events: auto;
|
|
3740
|
+
transition: transform 0.12s ease, box-shadow 0.15s ease;
|
|
3741
|
+
}
|
|
3742
|
+
#${LAYER_ID} .grabby-marker[hidden] { display: none; }
|
|
3743
|
+
#${LAYER_ID} .grabby-marker:hover,
|
|
3744
|
+
#${LAYER_ID} .grabby-marker:focus-visible {
|
|
3745
|
+
z-index: 1;
|
|
3746
|
+
outline: none;
|
|
3747
|
+
box-shadow: 0 0 0 2px #fff, 0 0 0 5px color-mix(in srgb, var(--grabby-accent, #2563eb) 35%, transparent), 0 2px 6px rgba(0, 0, 0, 0.25);
|
|
3748
|
+
}
|
|
3749
|
+
#${LAYER_ID} .grabby-marker-edit { display: none; }
|
|
3750
|
+
#${LAYER_ID} .grabby-marker:hover .grabby-marker-num,
|
|
3751
|
+
#${LAYER_ID} .grabby-marker:focus-visible .grabby-marker-num { display: none; }
|
|
3752
|
+
#${LAYER_ID} .grabby-marker:hover .grabby-marker-edit,
|
|
3753
|
+
#${LAYER_ID} .grabby-marker:focus-visible .grabby-marker-edit { display: block; }
|
|
3754
|
+
#${LAYER_ID} .grabby-marker-in {
|
|
3755
|
+
animation: grabby-marker-in 0.25s cubic-bezier(0.22, 1, 0.36, 1) both;
|
|
3756
|
+
}
|
|
3757
|
+
#${LAYER_ID} .grabby-marker-out {
|
|
3758
|
+
animation: grabby-marker-out 0.2s ease-out both;
|
|
3759
|
+
pointer-events: none;
|
|
3760
|
+
}
|
|
3761
|
+
@keyframes grabby-marker-in {
|
|
3762
|
+
from { opacity: 0; scale: 0.3; }
|
|
3763
|
+
to { opacity: 1; scale: 1; }
|
|
3764
|
+
}
|
|
3765
|
+
@keyframes grabby-marker-out {
|
|
3766
|
+
from { opacity: 1; scale: 1; }
|
|
3767
|
+
to { opacity: 0; scale: 0.3; }
|
|
3768
|
+
}
|
|
3769
|
+
#${TIP_ID} {
|
|
3770
|
+
position: fixed;
|
|
3771
|
+
z-index: ${Z_INDEX_CROSSHAIR};
|
|
3772
|
+
max-width: 260px;
|
|
3773
|
+
padding: 8px 10px;
|
|
3774
|
+
border-radius: 10px;
|
|
3775
|
+
background: var(--grabby-label-bg, #1e293b);
|
|
3776
|
+
color: #fff;
|
|
3777
|
+
font: 12px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
3778
|
+
box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
|
|
3779
|
+
pointer-events: none;
|
|
3780
|
+
white-space: pre-wrap;
|
|
3781
|
+
overflow-wrap: anywhere;
|
|
3782
|
+
animation: grabby-marker-tip-in 0.12s ease both;
|
|
3783
|
+
}
|
|
3784
|
+
#${TIP_ID}[hidden] { display: none; }
|
|
3785
|
+
#${TIP_ID} .grabby-marker-tip-hint { display: block; margin-top: 4px; opacity: 0.6; font-size: 11px; }
|
|
3786
|
+
@keyframes grabby-marker-tip-in {
|
|
3787
|
+
from { opacity: 0; transform: translateY(-2px); }
|
|
3788
|
+
to { opacity: 1; transform: none; }
|
|
3789
|
+
}
|
|
3790
|
+
@media (prefers-reduced-motion: reduce) {
|
|
3791
|
+
#${LAYER_ID} .grabby-marker-in, #${LAYER_ID} .grabby-marker-out, #${TIP_ID} { animation: none; }
|
|
3792
|
+
}
|
|
3793
|
+
`);
|
|
3794
|
+
}
|
|
3795
|
+
function ensureLayer() {
|
|
3796
|
+
if (layer) return layer;
|
|
3797
|
+
injectStyles2();
|
|
3798
|
+
layer = document.createElement("div");
|
|
3799
|
+
layer.id = LAYER_ID;
|
|
3800
|
+
tip = document.createElement("div");
|
|
3801
|
+
tip.id = TIP_ID;
|
|
3802
|
+
tip.hidden = true;
|
|
3803
|
+
tip.setAttribute("role", "tooltip");
|
|
3804
|
+
getUiRoot().append(layer, tip);
|
|
3805
|
+
return layer;
|
|
3806
|
+
}
|
|
3807
|
+
function pageComments() {
|
|
3808
|
+
return deps.getComments().filter((c) => c.page.route === route).reverse();
|
|
3809
|
+
}
|
|
3810
|
+
function preview(text) {
|
|
3811
|
+
const flat = text.trim();
|
|
3812
|
+
return flat.length > TIP_MAX ? `${flat.slice(0, TIP_MAX - 1)}\u2026` : flat;
|
|
3813
|
+
}
|
|
3814
|
+
function createEntry(comment) {
|
|
3815
|
+
const number = document.createElement("span");
|
|
3816
|
+
number.className = "grabby-marker-num";
|
|
3817
|
+
const button = document.createElement("button");
|
|
3818
|
+
button.type = "button";
|
|
3819
|
+
button.className = "grabby-marker";
|
|
3820
|
+
button.dataset.grabbyMarker = comment.id;
|
|
3821
|
+
button.append(number, svgIcon(ICON_EDIT, "grabby-marker-edit"));
|
|
3822
|
+
const entry = { comment, button, number, element: null, lastLookup: 0 };
|
|
3823
|
+
button.addEventListener("click", (e) => {
|
|
3824
|
+
e.preventDefault();
|
|
3825
|
+
e.stopPropagation();
|
|
3826
|
+
hideTip();
|
|
3827
|
+
deps.onOpen(entry.comment, entry.element, button);
|
|
3828
|
+
});
|
|
3829
|
+
button.addEventListener("mouseenter", () => startHover(entry));
|
|
3830
|
+
button.addEventListener("focus", () => startHover(entry));
|
|
3831
|
+
button.addEventListener("mouseleave", () => endHover(entry));
|
|
3832
|
+
button.addEventListener("blur", () => endHover(entry));
|
|
3833
|
+
return entry;
|
|
3834
|
+
}
|
|
3835
|
+
function startHover(entry) {
|
|
3836
|
+
hovered = entry;
|
|
3837
|
+
showTip(entry);
|
|
3838
|
+
deps.onHover(entry.comment, entry.element);
|
|
3839
|
+
}
|
|
3840
|
+
function endHover(entry) {
|
|
3841
|
+
if (hovered !== entry) return;
|
|
3842
|
+
hovered = null;
|
|
3843
|
+
hideTip();
|
|
3844
|
+
deps.onHover(null, null);
|
|
3845
|
+
}
|
|
3846
|
+
function showTip(entry) {
|
|
3847
|
+
if (!tip) return;
|
|
3848
|
+
const hint = document.createElement("span");
|
|
3849
|
+
hint.className = "grabby-marker-tip-hint";
|
|
3850
|
+
hint.textContent = "Click to edit";
|
|
3851
|
+
tip.replaceChildren(document.createTextNode(preview(entry.comment.comment)), hint);
|
|
3852
|
+
tip.hidden = false;
|
|
3853
|
+
placeTip(entry);
|
|
3854
|
+
}
|
|
3855
|
+
function placeTip(entry) {
|
|
3856
|
+
if (!tip || tip.hidden) return;
|
|
3857
|
+
const m = entry.button.getBoundingClientRect();
|
|
3858
|
+
const t = tip.getBoundingClientRect();
|
|
3859
|
+
const left = Math.max(8, Math.min(m.left + m.width / 2 - t.width / 2, window.innerWidth - t.width - 8));
|
|
3860
|
+
const below = m.bottom + 8;
|
|
3861
|
+
const top = below + t.height > window.innerHeight - 8 ? m.top - 8 - t.height : below;
|
|
3862
|
+
tip.style.left = `${left}px`;
|
|
3863
|
+
tip.style.top = `${Math.max(8, top)}px`;
|
|
3864
|
+
}
|
|
3865
|
+
function hideTip() {
|
|
3866
|
+
if (tip) tip.hidden = true;
|
|
3867
|
+
}
|
|
3868
|
+
function animateIn(button, delay) {
|
|
3869
|
+
button.classList.remove("grabby-marker-out", "grabby-marker-in");
|
|
3870
|
+
button.style.animationDelay = `${delay}ms`;
|
|
3871
|
+
void button.offsetWidth;
|
|
3872
|
+
button.classList.add("grabby-marker-in");
|
|
3873
|
+
}
|
|
3874
|
+
function removeEntry(id, animate) {
|
|
3875
|
+
const entry = entries.get(id);
|
|
3876
|
+
if (!entry) return;
|
|
3877
|
+
entries.delete(id);
|
|
3878
|
+
if (hovered === entry) endHover(entry);
|
|
3879
|
+
if (!animate) {
|
|
3880
|
+
entry.button.remove();
|
|
3881
|
+
return;
|
|
3882
|
+
}
|
|
3883
|
+
entry.button.style.animationDelay = "0ms";
|
|
3884
|
+
entry.button.classList.remove("grabby-marker-in");
|
|
3885
|
+
entry.button.classList.add("grabby-marker-out");
|
|
3886
|
+
setTimeout(() => entry.button.remove(), 220);
|
|
3887
|
+
}
|
|
3888
|
+
function sync(fresh) {
|
|
3889
|
+
if (!visible) return;
|
|
3890
|
+
const host2 = ensureLayer();
|
|
3891
|
+
const list = pageComments();
|
|
3892
|
+
const ids = new Set(list.map((c) => c.id));
|
|
3893
|
+
for (const id of [...entries.keys()]) if (!ids.has(id)) removeEntry(id, !fresh);
|
|
3894
|
+
list.forEach((comment, i) => {
|
|
3895
|
+
let entry = entries.get(comment.id);
|
|
3896
|
+
const isNew = !entry;
|
|
3897
|
+
if (!entry) {
|
|
3898
|
+
entry = createEntry(comment);
|
|
3899
|
+
entries.set(comment.id, entry);
|
|
3900
|
+
host2.appendChild(entry.button);
|
|
3901
|
+
}
|
|
3902
|
+
entry.comment = comment;
|
|
3903
|
+
const n = String(i + 1);
|
|
3904
|
+
entry.number.textContent = n;
|
|
3905
|
+
entry.button.setAttribute("aria-label", `Comment ${n}: ${preview(comment.comment)}. Click to edit.`);
|
|
3906
|
+
if (fresh || isNew) animateIn(entry.button, fresh ? i * STAGGER_MS : 0);
|
|
3907
|
+
});
|
|
3908
|
+
if (hovered && entries.get(hovered.comment.id) === hovered) showTip(hovered);
|
|
3909
|
+
position(performance.now());
|
|
3910
|
+
schedule();
|
|
3911
|
+
}
|
|
3912
|
+
function position(now) {
|
|
3913
|
+
for (const entry of entries.values()) {
|
|
3914
|
+
if (!entry.element?.isConnected) {
|
|
3915
|
+
entry.element = null;
|
|
3916
|
+
if (now - entry.lastLookup >= LOOKUP_RETRY_MS) {
|
|
3917
|
+
entry.lastLookup = now;
|
|
3918
|
+
entry.element = deps.findElement(entry.comment);
|
|
3919
|
+
}
|
|
3920
|
+
}
|
|
3921
|
+
const rect = entry.element?.getBoundingClientRect();
|
|
3922
|
+
if (!rect || rect.width === 0 && rect.height === 0) {
|
|
3923
|
+
entry.button.hidden = true;
|
|
3924
|
+
continue;
|
|
3925
|
+
}
|
|
3926
|
+
const pin = entry.comment.pin ?? { x: 1, y: 0 };
|
|
3927
|
+
const x = rect.left + pin.x * rect.width - SIZE / 2;
|
|
3928
|
+
const y = rect.top + pin.y * rect.height - SIZE / 2;
|
|
3929
|
+
entry.button.hidden = false;
|
|
3930
|
+
entry.button.style.transform = `translate(${Math.round(x)}px, ${Math.round(y)}px)`;
|
|
3931
|
+
}
|
|
3932
|
+
if (hovered) placeTip(hovered);
|
|
3933
|
+
}
|
|
3934
|
+
function frame() {
|
|
3935
|
+
rafId = null;
|
|
3936
|
+
const now = performance.now();
|
|
3937
|
+
if (!visible) return;
|
|
3938
|
+
if (now - lastRouteCheck >= ROUTE_CHECK_MS) {
|
|
3939
|
+
lastRouteCheck = now;
|
|
3940
|
+
const next = deps.currentRoute();
|
|
3941
|
+
if (next !== route) {
|
|
3942
|
+
route = next;
|
|
3943
|
+
for (const id of [...entries.keys()]) removeEntry(id, false);
|
|
3944
|
+
sync(true);
|
|
3945
|
+
return;
|
|
3946
|
+
}
|
|
3947
|
+
}
|
|
3948
|
+
position(now);
|
|
3949
|
+
schedule();
|
|
3950
|
+
}
|
|
3951
|
+
function schedule() {
|
|
3952
|
+
if (rafId === null && visible) rafId = requestAnimationFrame(frame);
|
|
3953
|
+
}
|
|
3954
|
+
function stop() {
|
|
3955
|
+
if (rafId !== null) cancelAnimationFrame(rafId);
|
|
3956
|
+
rafId = null;
|
|
3957
|
+
}
|
|
3958
|
+
return {
|
|
3959
|
+
setVisible(next) {
|
|
3960
|
+
if (next === visible) return;
|
|
3961
|
+
visible = next;
|
|
3962
|
+
if (next) {
|
|
3963
|
+
route = deps.currentRoute();
|
|
3964
|
+
lastRouteCheck = performance.now();
|
|
3965
|
+
sync(true);
|
|
3966
|
+
} else {
|
|
3967
|
+
stop();
|
|
3968
|
+
hideTip();
|
|
3969
|
+
if (hovered) endHover(hovered);
|
|
3970
|
+
for (const id of [...entries.keys()]) removeEntry(id, true);
|
|
3971
|
+
}
|
|
3972
|
+
},
|
|
3973
|
+
refresh() {
|
|
3974
|
+
sync(false);
|
|
3975
|
+
},
|
|
3976
|
+
isMarkerElement(el) {
|
|
3977
|
+
return !!layer && (layer === el || layer.contains(el));
|
|
3978
|
+
},
|
|
3979
|
+
dispose() {
|
|
3980
|
+
stop();
|
|
3981
|
+
entries.clear();
|
|
3982
|
+
layer?.remove();
|
|
3983
|
+
tip?.remove();
|
|
3984
|
+
layer = null;
|
|
3985
|
+
tip = null;
|
|
3986
|
+
hovered = null;
|
|
3987
|
+
visible = false;
|
|
3988
|
+
removeStyles(STYLE_ID9);
|
|
3989
|
+
}
|
|
3990
|
+
};
|
|
3991
|
+
}
|
|
3992
|
+
|
|
3580
3993
|
// src/core/overlay/select-feedback.ts
|
|
3581
|
-
var
|
|
3994
|
+
var STYLE_ID10 = "__grabby-feedback-styles__";
|
|
3582
3995
|
function injectStyles() {
|
|
3583
|
-
if (hasStyles(
|
|
3584
|
-
addStyles(
|
|
3996
|
+
if (hasStyles(STYLE_ID10)) return;
|
|
3997
|
+
addStyles(STYLE_ID10, `
|
|
3585
3998
|
@keyframes grabby-flash {
|
|
3586
3999
|
0% { opacity: 1; }
|
|
3587
4000
|
100% { opacity: 0; transform: scale(1.02); }
|
|
@@ -3660,7 +4073,7 @@ function showSelectFeedback(element, label = "Selected") {
|
|
|
3660
4073
|
setTimeout(cleanup, 1200);
|
|
3661
4074
|
}
|
|
3662
4075
|
function disposeFeedbackStyles() {
|
|
3663
|
-
removeStyles(
|
|
4076
|
+
removeStyles(STYLE_ID10);
|
|
3664
4077
|
}
|
|
3665
4078
|
|
|
3666
4079
|
// src/core/storage/history-persistence.ts
|
|
@@ -4754,7 +5167,10 @@ function createGrabInstance(options) {
|
|
|
4754
5167
|
let sourceResolver = adapters.resolveSource;
|
|
4755
5168
|
const cleanClasses = (list) => adapters.cleanClasses(list.filter((c) => !isNoiseClass(c)));
|
|
4756
5169
|
let selectedElement = null;
|
|
5170
|
+
let selectedPin;
|
|
4757
5171
|
let pendingShot = null;
|
|
5172
|
+
const commentedElements = /* @__PURE__ */ new Map();
|
|
5173
|
+
let editingFromMarker = false;
|
|
4758
5174
|
let level = loadLevel(merged.detailLevel);
|
|
4759
5175
|
let collapsed = loadCollapsed();
|
|
4760
5176
|
const pendingShotDeletes = /* @__PURE__ */ new Map();
|
|
@@ -4813,7 +5229,7 @@ function createGrabInstance(options) {
|
|
|
4813
5229
|
column: c.target.source?.column ?? null
|
|
4814
5230
|
};
|
|
4815
5231
|
}
|
|
4816
|
-
function saveComment(element, text, shot) {
|
|
5232
|
+
function saveComment(element, text, shot, pin) {
|
|
4817
5233
|
const now = Date.now();
|
|
4818
5234
|
const comment = {
|
|
4819
5235
|
id: randomId(),
|
|
@@ -4830,8 +5246,10 @@ function createGrabInstance(options) {
|
|
|
4830
5246
|
target: captureTarget(element, { componentResolver, sourceResolver, cleanClasses }),
|
|
4831
5247
|
screenshot: null,
|
|
4832
5248
|
framework: adapters.frameworkFor(element),
|
|
4833
|
-
...outbox ? { sync: "pending" } : {}
|
|
5249
|
+
...outbox ? { sync: "pending" } : {},
|
|
5250
|
+
...pin ? { pin } : {}
|
|
4834
5251
|
};
|
|
5252
|
+
commentedElements.set(comment.id, element);
|
|
4835
5253
|
setComments([comment, ...comments()].slice(0, MAX_COMMENTS));
|
|
4836
5254
|
pluginRegistry.callHook("onComment", comment, element);
|
|
4837
5255
|
outbox?.send(comment.id);
|
|
@@ -4876,6 +5294,7 @@ function createGrabInstance(options) {
|
|
|
4876
5294
|
const idSet = new Set(ids);
|
|
4877
5295
|
const before = comments();
|
|
4878
5296
|
const removed = before.filter((c) => idSet.has(c.id));
|
|
5297
|
+
for (const id of ids) commentedElements.delete(id);
|
|
4879
5298
|
setComments(before.filter((c) => !idSet.has(c.id)));
|
|
4880
5299
|
const withdrawn = withdraw && outbox ? removed.filter((c) => c.sync !== void 0) : [];
|
|
4881
5300
|
const hadQueued = new Set(withdrawn.filter((c) => outbox.isQueued(c.id)).map((c) => c.id));
|
|
@@ -4932,12 +5351,19 @@ function createGrabInstance(options) {
|
|
|
4932
5351
|
}
|
|
4933
5352
|
function hideCommentPopover() {
|
|
4934
5353
|
commentPopover.hide();
|
|
5354
|
+
endMarkerEdit();
|
|
4935
5355
|
if (picker.isHolding()) {
|
|
4936
5356
|
selectedElement = null;
|
|
5357
|
+
selectedPin = void 0;
|
|
4937
5358
|
pendingShot = null;
|
|
4938
5359
|
picker.release();
|
|
4939
5360
|
}
|
|
4940
5361
|
}
|
|
5362
|
+
function endMarkerEdit() {
|
|
5363
|
+
if (!editingFromMarker) return;
|
|
5364
|
+
editingFromMarker = false;
|
|
5365
|
+
overlay.hide();
|
|
5366
|
+
}
|
|
4941
5367
|
function closeAllPopovers() {
|
|
4942
5368
|
commentsPanel.hide();
|
|
4943
5369
|
hideCommentPopover();
|
|
@@ -4974,8 +5400,14 @@ function createGrabInstance(options) {
|
|
|
4974
5400
|
pluginRegistry.callHook("onElementHover", element);
|
|
4975
5401
|
}
|
|
4976
5402
|
},
|
|
4977
|
-
onSelect(element) {
|
|
5403
|
+
onSelect(element, point) {
|
|
4978
5404
|
selectedElement = element;
|
|
5405
|
+
const rect = element.getBoundingClientRect();
|
|
5406
|
+
const frac = (v, start, size2) => size2 > 0 ? Math.min(1, Math.max(0, (v - start) / size2)) : 0.5;
|
|
5407
|
+
selectedPin = {
|
|
5408
|
+
x: Math.round(frac(point.x, rect.left, rect.width) * 1e3) / 1e3,
|
|
5409
|
+
y: Math.round(frac(point.y, rect.top, rect.height) * 1e3) / 1e3
|
|
5410
|
+
};
|
|
4979
5411
|
pendingShot = store.state.options.screenshots ? captureScreenshot(element) : null;
|
|
4980
5412
|
pluginRegistry.callHook("onElementSelect", element);
|
|
4981
5413
|
coachMark.dismiss();
|
|
@@ -4984,6 +5416,36 @@ function createGrabInstance(options) {
|
|
|
4984
5416
|
commentPopover.show({ anchor: element, mode: "new", askIdentity: shouldAskIdentity() });
|
|
4985
5417
|
}
|
|
4986
5418
|
});
|
|
5419
|
+
const markers = createMarkers({
|
|
5420
|
+
getComments: comments,
|
|
5421
|
+
currentRoute: () => sanitizeRoute(location, store.state.options.captureQueryParams),
|
|
5422
|
+
findElement(comment) {
|
|
5423
|
+
const known = commentedElements.get(comment.id);
|
|
5424
|
+
if (known?.isConnected) return known;
|
|
5425
|
+
return safeQuery(comment.target.selector);
|
|
5426
|
+
},
|
|
5427
|
+
onHover(comment, element) {
|
|
5428
|
+
if (picker.isHolding() || editingFromMarker || commentPopover.isVisible()) return;
|
|
5429
|
+
if (comment && element) overlay.show(element, comment.target.component, null, []);
|
|
5430
|
+
else overlay.hide();
|
|
5431
|
+
},
|
|
5432
|
+
onOpen(comment, element, marker) {
|
|
5433
|
+
if (picker.isHolding()) return;
|
|
5434
|
+
closeAllPopovers();
|
|
5435
|
+
doDeactivate(true);
|
|
5436
|
+
editingFromMarker = true;
|
|
5437
|
+
if (element) overlay.show(element, comment.target.component, null, []);
|
|
5438
|
+
commentPopover.show({
|
|
5439
|
+
anchor: element ?? marker,
|
|
5440
|
+
initialValue: comment.comment,
|
|
5441
|
+
mode: "edit",
|
|
5442
|
+
entryId: comment.id
|
|
5443
|
+
});
|
|
5444
|
+
}
|
|
5445
|
+
});
|
|
5446
|
+
function updateMarkers() {
|
|
5447
|
+
markers.setVisible(store.state.toolbar.visible && !collapsed && store.state.options.enabled);
|
|
5448
|
+
}
|
|
4987
5449
|
function doActivate() {
|
|
4988
5450
|
if (!store.state.options.enabled) return;
|
|
4989
5451
|
if (store.state.active) return;
|
|
@@ -5058,12 +5520,14 @@ function createGrabInstance(options) {
|
|
|
5058
5520
|
toolbar.collapse();
|
|
5059
5521
|
saveCollapsed(true);
|
|
5060
5522
|
updateToastOffset();
|
|
5523
|
+
updateMarkers();
|
|
5061
5524
|
}
|
|
5062
5525
|
function expandToolbar() {
|
|
5063
5526
|
collapsed = false;
|
|
5064
5527
|
toolbar.expand();
|
|
5065
5528
|
saveCollapsed(false);
|
|
5066
5529
|
updateToastOffset();
|
|
5530
|
+
updateMarkers();
|
|
5067
5531
|
}
|
|
5068
5532
|
const commentsPanel = createCommentsPanel({
|
|
5069
5533
|
onHover(comment) {
|
|
@@ -5151,9 +5615,11 @@ function createGrabInstance(options) {
|
|
|
5151
5615
|
if (ctx.mode === "new") {
|
|
5152
5616
|
const element = selectedElement;
|
|
5153
5617
|
const shot = pendingShot;
|
|
5618
|
+
const pin = selectedPin;
|
|
5154
5619
|
selectedElement = null;
|
|
5620
|
+
selectedPin = void 0;
|
|
5155
5621
|
pendingShot = null;
|
|
5156
|
-
if (element) saveComment(element, value, shot);
|
|
5622
|
+
if (element) saveComment(element, value, shot, pin);
|
|
5157
5623
|
doDeactivate(true);
|
|
5158
5624
|
return;
|
|
5159
5625
|
}
|
|
@@ -5164,16 +5630,23 @@ function createGrabInstance(options) {
|
|
|
5164
5630
|
setComments(updated);
|
|
5165
5631
|
outbox?.send(ctx.entryId);
|
|
5166
5632
|
showToast("Comment updated");
|
|
5167
|
-
|
|
5633
|
+
if (editingFromMarker) endMarkerEdit();
|
|
5634
|
+
else commentsPanel.show([...updated]);
|
|
5168
5635
|
},
|
|
5169
5636
|
onCancel(ctx) {
|
|
5170
5637
|
if (ctx.mode === "new") {
|
|
5171
5638
|
selectedElement = null;
|
|
5639
|
+
selectedPin = void 0;
|
|
5172
5640
|
pendingShot = null;
|
|
5173
5641
|
doDeactivate(true);
|
|
5174
5642
|
return;
|
|
5175
5643
|
}
|
|
5176
|
-
|
|
5644
|
+
if (editingFromMarker) endMarkerEdit();
|
|
5645
|
+
else commentsPanel.show([...comments()]);
|
|
5646
|
+
},
|
|
5647
|
+
onDelete(ctx) {
|
|
5648
|
+
endMarkerEdit();
|
|
5649
|
+
if (ctx.entryId) removeComments([ctx.entryId], "Comment deleted", true);
|
|
5177
5650
|
}
|
|
5178
5651
|
});
|
|
5179
5652
|
function handleDocumentClick(e) {
|
|
@@ -5329,6 +5802,7 @@ function createGrabInstance(options) {
|
|
|
5329
5802
|
overlay.dispose();
|
|
5330
5803
|
crosshair.dispose();
|
|
5331
5804
|
freezeOverlay.dispose();
|
|
5805
|
+
markers.dispose();
|
|
5332
5806
|
disposeToast();
|
|
5333
5807
|
disposeFeedbackStyles();
|
|
5334
5808
|
pluginRegistry.dispose();
|
|
@@ -5365,8 +5839,11 @@ function createGrabInstance(options) {
|
|
|
5365
5839
|
doDeactivate(true);
|
|
5366
5840
|
}
|
|
5367
5841
|
}
|
|
5842
|
+
if (key === "options") updateMarkers();
|
|
5368
5843
|
if (key === "toolbar") {
|
|
5369
5844
|
updateToastOffset();
|
|
5845
|
+
updateMarkers();
|
|
5846
|
+
markers.refresh();
|
|
5370
5847
|
if (state.options.persistHistory) {
|
|
5371
5848
|
if (state.toolbar.comments.length > 0) {
|
|
5372
5849
|
saveHistory(state.toolbar.comments);
|
|
@@ -5388,6 +5865,7 @@ function createGrabInstance(options) {
|
|
|
5388
5865
|
if (merged.webhookUrl) {
|
|
5389
5866
|
api.registerPlugin(createWebhookPlugin(merged.webhookUrl));
|
|
5390
5867
|
}
|
|
5868
|
+
updateMarkers();
|
|
5391
5869
|
return api;
|
|
5392
5870
|
}
|
|
5393
5871
|
|