@sanity/assist 1.2.7 → 1.2.9
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 +6 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/fieldActions/assistFieldActions.tsx +5 -1
- package/src/plugin.tsx +6 -3
- package/src/schemas/serialize/serializeSchema.test.ts +22 -0
- package/src/schemas/serialize/serializeSchema.ts +1 -0
package/dist/index.esm.js
CHANGED
|
@@ -166,7 +166,7 @@ function isUnsupportedType(type) {
|
|
|
166
166
|
}
|
|
167
167
|
const inlineTypes = ["document", "object", "image", "file"];
|
|
168
168
|
function serializeSchema(schema, options) {
|
|
169
|
-
const list = schema.getTypeNames().filter(t => !(hiddenTypes.includes(t) || t.startsWith("sanity."))).map(t => schema.get(t)).filter(t => !!t).filter(t => !t.hidden && !t.readOnly).map(t => getSchemaStub(t, schema, options)).filter(t => {
|
|
169
|
+
const list = schema.getTypeNames().filter(t => !(hiddenTypes.includes(t) || t.startsWith("sanity."))).map(t => schema.get(t)).filter(t => !!t).filter(t => isAssistSupported(t)).filter(t => !t.hidden && !t.readOnly).map(t => getSchemaStub(t, schema, options)).filter(t => {
|
|
170
170
|
if ("to" in t && t.to && !t.to.length) {
|
|
171
171
|
return false;
|
|
172
172
|
}
|
|
@@ -4422,7 +4422,7 @@ const assistFieldActions = {
|
|
|
4422
4422
|
isDocAssistable: documentIsAssistable != null ? documentIsAssistable : false
|
|
4423
4423
|
});
|
|
4424
4424
|
const isSelectable = !!useSelectedField(documentSchemaType, typePath);
|
|
4425
|
-
const assistSupported = useAssistSupported(props.path, schemaType) && isSelectable;
|
|
4425
|
+
const assistSupported = useAssistSupported(props.path, schemaType) && isSelectable && isSchemaAssistEnabled(documentSchemaType);
|
|
4426
4426
|
const fieldAssist = useMemo(() => {
|
|
4427
4427
|
var _a;
|
|
4428
4428
|
return ((_a = assistDocument == null ? void 0 : assistDocument.fields) != null ? _a : []).find(f => f.path === typePath || pathKey === documentRootKey && f.path === pathKey);
|
|
@@ -4714,7 +4714,10 @@ const assist = definePlugin(config => {
|
|
|
4714
4714
|
schemaType
|
|
4715
4715
|
} = _ref17;
|
|
4716
4716
|
const docSchema = schema.get(schemaType);
|
|
4717
|
-
|
|
4717
|
+
if (docSchema && isObjectSchemaType(docSchema) && isSchemaAssistEnabled(docSchema)) {
|
|
4718
|
+
return [...prev, createAssistDocumentPresence(documentId, docSchema)];
|
|
4719
|
+
}
|
|
4720
|
+
return prev;
|
|
4718
4721
|
}
|
|
4719
4722
|
},
|
|
4720
4723
|
studio: {
|