@sanity/vision 6.17.0-next.102 → 6.17.0-next.108

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(8), { ref, onChange, initialValue: initialValueProp, extensions } = t0, [initialValue] = useState(initialValueProp), theme = useCodemirrorTheme(useTheme()), codeMirrorRef = useRef(null), t1;
251
- $[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = (newContent) => {
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
- }, $[0] = t1) : t1 = $[0];
264
- let resetEditorContent = t1, t2, t3;
265
- $[1] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => ({ resetEditorContent }), t3 = [resetEditorContent], $[1] = t2, $[2] = t3) : (t2 = $[1], t3 = $[2]), useImperativeHandle(ref, t2, t3);
266
- let t4;
267
- return $[3] !== extensions || $[4] !== initialValue || $[5] !== onChange || $[6] !== theme ? (t4 = /* @__PURE__ */ jsx(EditorRoot, { children: /* @__PURE__ */ jsx(CodeMirror, {
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: initialValue,
273
- onChange
274
- }) }), $[3] = extensions, $[4] = initialValue, $[5] = onChange, $[6] = theme, $[7] = t4) : t4 = $[7], t4;
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-DZKVpY7F.js.map
2959
+ //# sourceMappingURL=SanityVision-DP7bCCAx.js.map