@sanity/vision 6.10.0-next.37 → 6.10.0-next.40
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.
|
@@ -297,6 +297,21 @@ function encodeQueryString(query, params = {}, options = {}) {
|
|
|
297
297
|
for (let [key, value] of Object.entries(options)) value && searchParams.set(key, `${value}`);
|
|
298
298
|
return `?${searchParams}`;
|
|
299
299
|
}
|
|
300
|
+
function acceptsNativePaste(node) {
|
|
301
|
+
let element = node;
|
|
302
|
+
return (element?.tagName === "INPUT" || element?.tagName === "TEXTAREA") && element?.readOnly === !1;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Whether a paste seen by Vision's `document` level listener was meant for Vision. The listener is
|
|
306
|
+
* global, so it also observes pastes aimed at unrelated elements such as the Studio search field.
|
|
307
|
+
*
|
|
308
|
+
* Uses the dispatch path rather than `event.target`, because CodeMirror handles the paste and
|
|
309
|
+
* re-renders the pasted line before the event reaches `document`, detaching the original target.
|
|
310
|
+
*/
|
|
311
|
+
function isVisionPasteTarget(root, event) {
|
|
312
|
+
let path = event.composedPath(), [target] = path;
|
|
313
|
+
return acceptsNativePaste(target) ? !1 : target === window.document || target === window.document.body || root !== null && path.includes(root);
|
|
314
|
+
}
|
|
300
315
|
function isPlainObject(obj) {
|
|
301
316
|
return !!obj && typeof obj == "object" && Object.prototype.toString.call(obj) === "[object Object]";
|
|
302
317
|
}
|
|
@@ -2420,11 +2435,9 @@ function VisionGui(props) {
|
|
|
2420
2435
|
}, $[96] = handleQueryExecution, $[97] = localStorage, $[98] = t32) : t32 = $[98];
|
|
2421
2436
|
let setStateFromParsedUrl = t32, t33;
|
|
2422
2437
|
$[99] !== getStateFromUrl || $[100] !== setStateFromParsedUrl || $[101] !== toast ? (t33 = (evt_4) => {
|
|
2423
|
-
if (!evt_4.clipboardData) return;
|
|
2424
|
-
let
|
|
2425
|
-
evt_4.preventDefault()
|
|
2426
|
-
let urlState = getStateFromUrl(data_0);
|
|
2427
|
-
urlState && (setStateFromParsedUrl(urlState), toast.push({
|
|
2438
|
+
if (!evt_4.clipboardData || !isVisionPasteTarget(visionRootRef.current, evt_4)) return;
|
|
2439
|
+
let urlState = getStateFromUrl(evt_4.clipboardData.getData("text/plain"));
|
|
2440
|
+
urlState && (evt_4.preventDefault(), setStateFromParsedUrl(urlState), toast.push({
|
|
2428
2441
|
closable: !0,
|
|
2429
2442
|
id: "vision-paste",
|
|
2430
2443
|
status: "info",
|
|
@@ -2774,4 +2787,4 @@ function SanityVision(props) {
|
|
|
2774
2787
|
}
|
|
2775
2788
|
export { SanityVision as default };
|
|
2776
2789
|
|
|
2777
|
-
//# sourceMappingURL=SanityVision-
|
|
2790
|
+
//# sourceMappingURL=SanityVision-5e46-K0R.js.map
|