@sanity/assist 1.2.10 → 1.2.12
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/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { useClient, typed, useSchema, useDocumentStore, useDocumentPresence, createPatchChannel, FormBuilder, fromMutationPatches, pathToString, isObjectSchemaType, stringToPath, isKeySegment, useEditState, useCurrentUser, useValidationStatus, StatusButton, FormFieldHeaderText, PatchEvent, unset, set, useFormCallbacks, FormCallbacksProvider, FormInput, setIfMissing, insert, PresenceOverlay, VirtualizerScrollInstanceProvider, useColorSchemeValue, isArraySchemaType, ObjectInputMember, defineType, defineField, defineArrayMember, getPublishedId, definePlugin } from 'sanity';
|
|
2
|
+
import { useClient, typed, useSchema, useDocumentStore, useDocumentPresence, createPatchChannel, FormBuilder, fromMutationPatches, pathToString, isObjectSchemaType, stringToPath, isKeySegment, useEditState, useCurrentUser, useValidationStatus, StatusButton, FormFieldHeaderText, PatchEvent, unset, set, useFormCallbacks, FormCallbacksProvider, FormInput, setIfMissing, insert, PresenceOverlay, VirtualizerScrollInstanceProvider, useColorSchemeValue, isArraySchemaType, ObjectInputMember, defineType, defineField, defineArrayMember, getPublishedId, useSyncState, definePlugin } from 'sanity';
|
|
3
3
|
import { Card, Stack, Box, Button, Spinner, Flex, Label, focusFirstDescendant, Text, useClickOutside, Popover, useLayer, useGlobalKeyDown, useToast, Dialog, Tooltip, TextArea, Container, Autocomplete, Breadcrumbs, Badge, useTheme, rgba, ThemeProvider, ErrorBoundary, Switch, MenuButton, Menu, MenuItem } from '@sanity/ui';
|
|
4
4
|
import { useState, useRef, useEffect, useMemo, useCallback, createContext, useReducer, forwardRef, createElement, useContext, useId } from 'react';
|
|
5
5
|
import { SyncIcon, DocumentIcon, LinkIcon, ImageIcon, BlockContentIcon, OlistIcon, BlockquoteIcon, StringIcon, ErrorOutlineIcon, CheckmarkCircleIcon, CloseCircleIcon, ClockIcon, PlayIcon, SparklesIcon, ArrowLeftIcon, SearchIcon, RetryIcon, ArrowRightIcon, CloseIcon, CheckmarkIcon, icons, TokenIcon, DocumentTextIcon, ThListIcon, CodeIcon, ComposeIcon, LockIcon, ControlsIcon } from '@sanity/icons';
|
|
@@ -3623,8 +3623,7 @@ const InlineBlockValueContext = createContext(void 0);
|
|
|
3623
3623
|
function AssistInlineFormBlock(props) {
|
|
3624
3624
|
return /* @__PURE__ */jsx(InlineBlockValueContext.Provider, {
|
|
3625
3625
|
value: props.value,
|
|
3626
|
-
children: /* @__PURE__ */jsx(
|
|
3627
|
-
flex: 1,
|
|
3626
|
+
children: /* @__PURE__ */jsx(Fragment, {
|
|
3628
3627
|
children: props.renderDefault(props)
|
|
3629
3628
|
})
|
|
3630
3629
|
});
|
|
@@ -4298,7 +4297,8 @@ function ImageContextProvider(props) {
|
|
|
4298
4297
|
const assetRef = (_a = value == null ? void 0 : value.asset) == null ? void 0 : _a._ref;
|
|
4299
4298
|
const [assetRefState, setAssetRefState] = useState(assetRef);
|
|
4300
4299
|
const {
|
|
4301
|
-
documentId
|
|
4300
|
+
documentId,
|
|
4301
|
+
documentSchemaType
|
|
4302
4302
|
} = useAssistDocumentContext();
|
|
4303
4303
|
const {
|
|
4304
4304
|
config
|
|
@@ -4307,16 +4307,19 @@ function ImageContextProvider(props) {
|
|
|
4307
4307
|
const {
|
|
4308
4308
|
generateCaption
|
|
4309
4309
|
} = useGenerateCaption(apiClient);
|
|
4310
|
+
const {
|
|
4311
|
+
isSyncing
|
|
4312
|
+
} = useSyncState(publicId(documentId), documentSchemaType.name);
|
|
4310
4313
|
useEffect(() => {
|
|
4311
4314
|
const captionField = getCaptionFieldOption(schemaType);
|
|
4312
|
-
if (assetRef && documentId && captionField && assetRef !== assetRefState) {
|
|
4315
|
+
if (assetRef && documentId && captionField && assetRef !== assetRefState && !isSyncing) {
|
|
4313
4316
|
setAssetRefState(assetRef);
|
|
4314
4317
|
generateCaption({
|
|
4315
4318
|
path: pathToString([...path, captionField]),
|
|
4316
4319
|
documentId
|
|
4317
4320
|
});
|
|
4318
4321
|
}
|
|
4319
|
-
}, [schemaType, path, assetRef, assetRefState, documentId, generateCaption]);
|
|
4322
|
+
}, [schemaType, path, assetRef, assetRefState, documentId, generateCaption, isSyncing]);
|
|
4320
4323
|
const context = useMemo(() => {
|
|
4321
4324
|
const captionField = getCaptionFieldOption(schemaType);
|
|
4322
4325
|
return captionField ? {
|