@sanity/vision 6.17.0-next.102 → 6.17.0-next.106
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.
|
@@ -247,8 +247,12 @@ function EditorRoot(t0) {
|
|
|
247
247
|
}), $[10] = children, $[11] = t7, $[12] = t8) : t8 = $[12], t8;
|
|
248
248
|
}
|
|
249
249
|
function VisionCodeMirror(t0) {
|
|
250
|
-
let $ = c(
|
|
251
|
-
$[0] ===
|
|
250
|
+
let $ = c(10), { ref, onChange, initialValue: initialValueProp, extensions } = t0, [value, setValue] = useState(initialValueProp), t1;
|
|
251
|
+
$[0] === onChange ? t1 = $[1] : (t1 = (nextValue, viewUpdate) => {
|
|
252
|
+
setValue(nextValue), onChange?.(nextValue, viewUpdate);
|
|
253
|
+
}, $[0] = onChange, $[1] = t1);
|
|
254
|
+
let handleChange = t1, theme = useCodemirrorTheme(useTheme()), codeMirrorRef = useRef(null), t2;
|
|
255
|
+
$[2] === Symbol.for("react.memo_cache_sentinel") ? (t2 = (newContent) => {
|
|
252
256
|
let editorView = codeMirrorRef.current?.view;
|
|
253
257
|
if (!editorView) return;
|
|
254
258
|
let currentDoc = editorView.state.doc.toString();
|
|
@@ -260,18 +264,18 @@ function VisionCodeMirror(t0) {
|
|
|
260
264
|
},
|
|
261
265
|
selection: EditorSelection.cursor(newContent.length)
|
|
262
266
|
});
|
|
263
|
-
}, $[
|
|
264
|
-
let resetEditorContent =
|
|
265
|
-
$[
|
|
266
|
-
let
|
|
267
|
-
return $[
|
|
267
|
+
}, $[2] = t2) : t2 = $[2];
|
|
268
|
+
let resetEditorContent = t2, t3, t4;
|
|
269
|
+
$[3] === Symbol.for("react.memo_cache_sentinel") ? (t3 = () => ({ resetEditorContent }), t4 = [resetEditorContent], $[3] = t3, $[4] = t4) : (t3 = $[3], t4 = $[4]), useImperativeHandle(ref, t3, t4);
|
|
270
|
+
let t5;
|
|
271
|
+
return $[5] !== extensions || $[6] !== handleChange || $[7] !== theme || $[8] !== value ? (t5 = /* @__PURE__ */ jsx(EditorRoot, { children: /* @__PURE__ */ jsx(CodeMirror, {
|
|
268
272
|
ref: codeMirrorRef,
|
|
269
273
|
basicSetup: !1,
|
|
270
274
|
theme,
|
|
271
275
|
extensions,
|
|
272
|
-
value
|
|
273
|
-
onChange
|
|
274
|
-
}) }), $[
|
|
276
|
+
value,
|
|
277
|
+
onChange: handleChange
|
|
278
|
+
}) }), $[5] = extensions, $[6] = handleChange, $[7] = theme, $[8] = value, $[9] = t5) : t5 = $[9], t5;
|
|
275
279
|
}
|
|
276
280
|
const SUPPORTED_PERSPECTIVES = [
|
|
277
281
|
"pinnedRelease",
|
|
@@ -2952,4 +2956,4 @@ function SanityVision(props) {
|
|
|
2952
2956
|
}
|
|
2953
2957
|
export { SanityVision as default };
|
|
2954
2958
|
|
|
2955
|
-
//# sourceMappingURL=SanityVision-
|
|
2959
|
+
//# sourceMappingURL=SanityVision-DP7bCCAx.js.map
|