sanity 6.6.0-next.49 → 6.6.0-next.51
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/lib/_chunks-es/index2.js +18 -12
- package/lib/_chunks-es/index2.js.map +1 -1
- package/lib/_chunks-es/version.js +2 -2
- package/package.json +11 -11
package/lib/_chunks-es/index2.js
CHANGED
|
@@ -30397,13 +30397,16 @@ function useTrackFocusPath(props2) {
|
|
|
30397
30397
|
$[0] !== selection ? (t0 = () => {
|
|
30398
30398
|
selectionRef.current = selection;
|
|
30399
30399
|
}, t1 = [selection], $[0] = selection, $[1] = t0, $[2] = t1) : (t0 = $[1], t1 = $[2]), useLayoutEffect(t0, t1);
|
|
30400
|
+
const handledFocusPathRef = useRef(null);
|
|
30400
30401
|
let t2;
|
|
30401
30402
|
$[3] !== boundaryElement || $[4] !== editor2 || $[5] !== elementRefs || $[6] !== focusPath || $[7] !== legacyEditor || $[8] !== portableTextMemberItems || $[9] !== ptInputPath ? (t2 = () => {
|
|
30402
|
-
if (focusPath.length === 0)
|
|
30403
|
+
if (handledFocusPathRef.current !== focusPath && (handledFocusPathRef.current = null), focusPath.length === 0 || handledFocusPathRef.current === focusPath)
|
|
30403
30404
|
return;
|
|
30404
30405
|
const editorHasDomFocus = !!boundaryElement?.ownerDocument.activeElement && boundaryElement.contains(boundaryElement.ownerDocument.activeElement), currentSelection = selectionRef.current, openItem = portableTextMemberItems.find(_temp$2u), openEditingItem = portableTextMemberItems.find(_temp2$12);
|
|
30405
|
-
if (currentSelection?.focus.path && isEqual$2(currentSelection.focus.path, focusPath.slice(0, currentSelection.focus.path.length)) && (editorHasDomFocus || openEditingItem))
|
|
30406
|
+
if (currentSelection?.focus.path && isEqual$2(currentSelection.focus.path, focusPath.slice(0, currentSelection.focus.path.length)) && (editorHasDomFocus || openEditingItem)) {
|
|
30407
|
+
handledFocusPathRef.current = focusPath;
|
|
30406
30408
|
return;
|
|
30409
|
+
}
|
|
30407
30410
|
const focusedItem = portableTextMemberItems.find(_temp3$x), snapshot2 = editor2.getSnapshot(), enclosingBlock = getEnclosingBlock(snapshot2, focusPath), blockPath = enclosingBlock?.path, span = getSpan(snapshot2, focusPath), enclosingBlockItem = blockPath ? portableTextMemberItems.find((m_2) => isEqual$2(m_2.member.item.path, [...ptInputPath, ...blockPath])) : void 0, relatedEditorItem = focusedItem || enclosingBlockItem || openItem, elementRef = relatedEditorItem ? elementRefs[relatedEditorItem.key] : void 0;
|
|
30408
30411
|
if (relatedEditorItem && elementRef) {
|
|
30409
30412
|
boundaryElement && (scrollIntoView$1(boundaryElement, {
|
|
@@ -30439,7 +30442,7 @@ function useTrackFocusPath(props2) {
|
|
|
30439
30442
|
path,
|
|
30440
30443
|
offset: 0
|
|
30441
30444
|
}
|
|
30442
|
-
}), isTextBlock && PortableTextEditor.focus(legacyEditor);
|
|
30445
|
+
}), isTextBlock && PortableTextEditor.focus(legacyEditor), handledFocusPathRef.current = focusPath;
|
|
30443
30446
|
}
|
|
30444
30447
|
}
|
|
30445
30448
|
}
|
|
@@ -47863,7 +47866,7 @@ function getOrCreateDocumentVersionsObservable(options) {
|
|
|
47863
47866
|
} = options, cacheKey2 = `${projectId}-${dataset}-${publishedId}`;
|
|
47864
47867
|
return getOrCreateCachedObservable(observableCache, cacheKey2, () => documentPreviewStore.unstable_observeVersionDocumentIds(publishedId).pipe(swr(cacheKey2), map$1(({
|
|
47865
47868
|
value
|
|
47866
|
-
}) => value), switchMap$1((documentIds) => {
|
|
47869
|
+
}) => value), switchMap$1((documentIds, index) => {
|
|
47867
47870
|
if (documentIds.length === 0)
|
|
47868
47871
|
return of({
|
|
47869
47872
|
data: [],
|
|
@@ -47871,13 +47874,7 @@ function getOrCreateDocumentVersionsObservable(options) {
|
|
|
47871
47874
|
error: null,
|
|
47872
47875
|
loading: !1
|
|
47873
47876
|
});
|
|
47874
|
-
const
|
|
47875
|
-
data: documentIds,
|
|
47876
|
-
versions: [],
|
|
47877
|
-
error: null,
|
|
47878
|
-
loading: !0
|
|
47879
|
-
};
|
|
47880
|
-
return combineLatest(documentIds.map((id2) => documentPreviewStore.observePaths({
|
|
47877
|
+
const versions$ = combineLatest(documentIds.map((id2) => documentPreviewStore.observePaths({
|
|
47881
47878
|
_id: id2
|
|
47882
47879
|
}, DOCUMENT_STUB_PATHS).pipe(map$1((versionInfo) => isRecord$5(versionInfo) ? versionInfo : void 0), map$1((versionInfo) => ({
|
|
47883
47880
|
_id: id2,
|
|
@@ -47890,7 +47887,16 @@ function getOrCreateDocumentVersionsObservable(options) {
|
|
|
47890
47887
|
versions,
|
|
47891
47888
|
error: null,
|
|
47892
47889
|
loading: !1
|
|
47893
|
-
}))
|
|
47890
|
+
})));
|
|
47891
|
+
if (index > 0)
|
|
47892
|
+
return versions$;
|
|
47893
|
+
const loadingState = {
|
|
47894
|
+
data: documentIds,
|
|
47895
|
+
versions: [],
|
|
47896
|
+
error: null,
|
|
47897
|
+
loading: !0
|
|
47898
|
+
};
|
|
47899
|
+
return versions$.pipe(startWith$1(loadingState));
|
|
47894
47900
|
}), catchError$1((error) => of({
|
|
47895
47901
|
error,
|
|
47896
47902
|
data: [],
|