@madebywild/sanity-quote-field 0.0.13 → 0.0.15
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.cjs +9 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/index.tsx +8 -0
- package/src/types.tsx +8 -2
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
3
|
-
var sanityUtils = require("@madebywild/sanity-utils"), sanity = require("sanity");
|
|
3
|
+
var jsxRuntime = require("react/jsx-runtime"), sanityUtils = require("@madebywild/sanity-utils"), sanity = require("sanity");
|
|
4
4
|
const typeName = "wild.quote", wildSanityQuoteFieldPlugin = sanity.definePlugin((config) => ({
|
|
5
5
|
name: "@madebywild/sanity-quote-field",
|
|
6
6
|
schema: {
|
|
@@ -9,6 +9,14 @@ const typeName = "wild.quote", wildSanityQuoteFieldPlugin = sanity.definePlugin(
|
|
|
9
9
|
type: "object",
|
|
10
10
|
title: "Quote",
|
|
11
11
|
description: "A stylized quote with optional author.",
|
|
12
|
+
icon: () => /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: "\u275D\u275E" }),
|
|
13
|
+
options: {
|
|
14
|
+
collapsed: !1,
|
|
15
|
+
collapsible: !0
|
|
16
|
+
},
|
|
17
|
+
components: {
|
|
18
|
+
field: (props) => props.schemaType.options.inline ? props.children : props.renderDefault(props)
|
|
19
|
+
},
|
|
12
20
|
fields: [
|
|
13
21
|
sanity.defineField({
|
|
14
22
|
name: "quote",
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/types.tsx","../src/index.tsx"],"sourcesContent":["import type { FieldOptions as RichtextOptions } from \"@madebywild/sanity-richtext-field\";\nimport type { ObjectDefinition, ObjectOptions, ReferenceDefinition } from \"sanity\";\n\n/** @public */\nexport const typeName = \"wild.quote\" as const;\n\n/** @public */\nexport type PluginConfig = {\n /**\n * A reference definition for the author of the quote.\n * If provided, this reference will be used to fetch author details.\n * If not provided, the quote will use simple text fields for author name and title.\n */\n authorRef?: Omit<ReferenceDefinition, \"type\" | \"name\">;\n /**\n * Options to configure the richtext field used for the quote content.\n * Options will be passed to the underlying `@madebywild/sanity-richtext-field` field.\n */\n richtextOptions?: RichtextOptions;\n};\n\n/** @public */\nexport type FieldOptions = ObjectOptions;\n\n// Add the custom field definition to Sanity's intrinsic definitions\n// so that type checking works correctly when using this field type.\ndeclare module \"sanity\" {\n export interface IntrinsicDefinitions {\n [typeName]: Omit<ObjectDefinition, \"type\" | \"fields\" | \"options\"> & {\n type: typeof typeName;\n options?: FieldOptions;\n };\n }\n}\n","import { createExcerptFromPortableText } from \"@madebywild/sanity-utils\";\nimport { defineField, definePlugin, defineType } from \"sanity\";\nimport { type PluginConfig, typeName } from \"./types\";\n\n/** @public */\n// biome-ignore lint/suspicious/noConfusingVoidType: it can be void.\nconst wildSanityQuoteFieldPlugin = definePlugin<PluginConfig | void>((config) => {\n return {\n name: \"@madebywild/sanity-quote-field\",\n schema: {\n types: [\n defineType({\n name: typeName,\n type: \"object\",\n title: \"Quote\",\n description: \"A stylized quote with optional author.\",\n fields: [\n defineField({\n name: \"quote\",\n type: \"wild.richtext\",\n title: \"Quote\",\n description: \"The quote text.\",\n options: {\n // Disable all parts by default.\n allowedParts: [],\n ...config?.richtextOptions,\n },\n }),\n // Display a reference field if the user provided a author typeName.\n ...(config?.authorRef\n ? [\n defineField({\n name: \"author\",\n title: \"Author\",\n description: \"The author of the quote.\",\n type: \"reference\",\n weak: true,\n ...config.authorRef,\n }),\n ]\n : [\n defineField({\n type: \"string\",\n name: \"authorName\",\n title: \"Author Name\",\n description: \"The author name of the quote.\",\n }),\n defineField({\n type: \"text\",\n rows: 2,\n name: \"authorDescription\",\n title: \"Author Description\",\n description: \"The author description of the quote.\",\n }),\n ]),\n ],\n preview: {\n select: {\n quote: \"quote\",\n authorName: config?.authorRef?.to ? \"author.title\" : \"authorName\",\n },\n prepare({ quote, authorName }) {\n return {\n title: quote ? createExcerptFromPortableText(quote, 25) : \"No quote\",\n subtitle: authorName ? `— ${authorName}` : undefined,\n };\n },\n },\n }),\n ],\n },\n };\n});\n\nexport { wildSanityQuoteFieldPlugin, typeName, type PluginConfig };\n"],"names":["typeName","wildSanityQuoteFieldPlugin","definePlugin","config","name","schema","types","defineType","type","title","description","
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/types.tsx","../src/index.tsx"],"sourcesContent":["import type { FieldOptions as RichtextOptions } from \"@madebywild/sanity-richtext-field\";\nimport type { ObjectDefinition, ObjectOptions, ReferenceDefinition } from \"sanity\";\n\n/** @public */\nexport const typeName = \"wild.quote\" as const;\n\n/** @public */\nexport type PluginConfig = {\n /**\n * A reference definition for the author of the quote.\n * If provided, this reference will be used to fetch author details.\n * If not provided, the quote will use simple text fields for author name and title.\n */\n authorRef?: Omit<ReferenceDefinition, \"type\" | \"name\">;\n /**\n * Options to configure the richtext field used for the quote content.\n * Options will be passed to the underlying `@madebywild/sanity-richtext-field` field.\n */\n richtextOptions?: RichtextOptions;\n};\n\n/** @public */\nexport type FieldOptions = ObjectOptions & {\n /**\n * Whether the media field should be displayed inline.\n * This will render all children inline on the same level.\n */\n inline?: boolean;\n};\n\n// Add the custom field definition to Sanity's intrinsic definitions\n// so that type checking works correctly when using this field type.\ndeclare module \"sanity\" {\n export interface IntrinsicDefinitions {\n [typeName]: Omit<ObjectDefinition, \"type\" | \"fields\" | \"options\" | \"components\"> & {\n type: typeof typeName;\n options?: FieldOptions;\n };\n }\n}\n","import { createExcerptFromPortableText } from \"@madebywild/sanity-utils\";\nimport { defineField, definePlugin, defineType } from \"sanity\";\nimport { type PluginConfig, typeName } from \"./types\";\n\n/** @public */\n// biome-ignore lint/suspicious/noConfusingVoidType: it can be void.\nconst wildSanityQuoteFieldPlugin = definePlugin<PluginConfig | void>((config) => {\n return {\n name: \"@madebywild/sanity-quote-field\",\n schema: {\n types: [\n defineType({\n name: typeName,\n type: \"object\",\n title: \"Quote\",\n description: \"A stylized quote with optional author.\",\n icon: () => <>❝❞</>,\n options: {\n collapsed: false,\n collapsible: true,\n },\n components: {\n field: (props) => (props.schemaType.options.inline ? props.children : props.renderDefault(props)),\n },\n fields: [\n defineField({\n name: \"quote\",\n type: \"wild.richtext\",\n title: \"Quote\",\n description: \"The quote text.\",\n options: {\n // Disable all parts by default.\n allowedParts: [],\n ...config?.richtextOptions,\n },\n }),\n // Display a reference field if the user provided a author typeName.\n ...(config?.authorRef\n ? [\n defineField({\n name: \"author\",\n title: \"Author\",\n description: \"The author of the quote.\",\n type: \"reference\",\n weak: true,\n ...config.authorRef,\n }),\n ]\n : [\n defineField({\n type: \"string\",\n name: \"authorName\",\n title: \"Author Name\",\n description: \"The author name of the quote.\",\n }),\n defineField({\n type: \"text\",\n rows: 2,\n name: \"authorDescription\",\n title: \"Author Description\",\n description: \"The author description of the quote.\",\n }),\n ]),\n ],\n preview: {\n select: {\n quote: \"quote\",\n authorName: config?.authorRef?.to ? \"author.title\" : \"authorName\",\n },\n prepare({ quote, authorName }) {\n return {\n title: quote ? createExcerptFromPortableText(quote, 25) : \"No quote\",\n subtitle: authorName ? `— ${authorName}` : undefined,\n };\n },\n },\n }),\n ],\n },\n };\n});\n\nexport { wildSanityQuoteFieldPlugin, typeName, type PluginConfig };\n"],"names":["typeName","wildSanityQuoteFieldPlugin","definePlugin","config","name","schema","types","defineType","type","title","description","icon","jsx","Fragment","options","collapsed","collapsible","components","field","props","schemaType","inline","children","renderDefault","fields","defineField","allowedParts","richtextOptions","authorRef","weak","rows","preview","select","quote","authorName","to","prepare","createExcerptFromPortableText","subtitle","undefined"],"mappings":";;;AAIO,MAAMA,WAAW,cCElBC,6BA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AWO,KAAK,iBAAiB;AAAA,QAAA;AAAA,QAEvDC,QAAQ;AAAA,UAAEH;AAAAA,UAAOC;AAAAA,QAAAA,GAAc;AAC7B,iBAAO;AAAA,YACLzB,OAAOwB,QAAQI,YAAAA,8BAA8BJ,OAAO,EAAE,IAAI;AAAA,YAC1DK,UAAUJ,aAAa,UAAKA,UAAU,KAAKK;AAAAA,UAAAA;AAAAA,QAE/C;AAAA,MAAA;AAAA,IACF,CACD,CAAC;AAAA,EAAA;AAGR,EACD;;;"}
|
package/dist/index.d.cts
CHANGED
|
@@ -18,10 +18,16 @@ type PluginConfig = {
|
|
|
18
18
|
richtextOptions?: FieldOptions;
|
|
19
19
|
};
|
|
20
20
|
/** @public */
|
|
21
|
-
type FieldOptions$1 = ObjectOptions
|
|
21
|
+
type FieldOptions$1 = ObjectOptions & {
|
|
22
|
+
/**
|
|
23
|
+
* Whether the media field should be displayed inline.
|
|
24
|
+
* This will render all children inline on the same level.
|
|
25
|
+
*/
|
|
26
|
+
inline?: boolean;
|
|
27
|
+
};
|
|
22
28
|
declare module "sanity" {
|
|
23
29
|
interface IntrinsicDefinitions {
|
|
24
|
-
[typeName]: Omit<ObjectDefinition, "type" | "fields" | "options"> & {
|
|
30
|
+
[typeName]: Omit<ObjectDefinition, "type" | "fields" | "options" | "components"> & {
|
|
25
31
|
type: typeof typeName;
|
|
26
32
|
options?: FieldOptions$1;
|
|
27
33
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -18,10 +18,16 @@ type PluginConfig = {
|
|
|
18
18
|
richtextOptions?: FieldOptions;
|
|
19
19
|
};
|
|
20
20
|
/** @public */
|
|
21
|
-
type FieldOptions$1 = ObjectOptions
|
|
21
|
+
type FieldOptions$1 = ObjectOptions & {
|
|
22
|
+
/**
|
|
23
|
+
* Whether the media field should be displayed inline.
|
|
24
|
+
* This will render all children inline on the same level.
|
|
25
|
+
*/
|
|
26
|
+
inline?: boolean;
|
|
27
|
+
};
|
|
22
28
|
declare module "sanity" {
|
|
23
29
|
interface IntrinsicDefinitions {
|
|
24
|
-
[typeName]: Omit<ObjectDefinition, "type" | "fields" | "options"> & {
|
|
30
|
+
[typeName]: Omit<ObjectDefinition, "type" | "fields" | "options" | "components"> & {
|
|
25
31
|
type: typeof typeName;
|
|
26
32
|
options?: FieldOptions$1;
|
|
27
33
|
};
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
1
2
|
import { createExcerptFromPortableText } from "@madebywild/sanity-utils";
|
|
2
3
|
import { definePlugin, defineType, defineField } from "sanity";
|
|
3
4
|
const typeName = "wild.quote", wildSanityQuoteFieldPlugin = definePlugin((config) => ({
|
|
@@ -8,6 +9,14 @@ const typeName = "wild.quote", wildSanityQuoteFieldPlugin = definePlugin((config
|
|
|
8
9
|
type: "object",
|
|
9
10
|
title: "Quote",
|
|
10
11
|
description: "A stylized quote with optional author.",
|
|
12
|
+
icon: () => /* @__PURE__ */ jsx(Fragment, { children: "\u275D\u275E" }),
|
|
13
|
+
options: {
|
|
14
|
+
collapsed: !1,
|
|
15
|
+
collapsible: !0
|
|
16
|
+
},
|
|
17
|
+
components: {
|
|
18
|
+
field: (props) => props.schemaType.options.inline ? props.children : props.renderDefault(props)
|
|
19
|
+
},
|
|
11
20
|
fields: [
|
|
12
21
|
defineField({
|
|
13
22
|
name: "quote",
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/types.tsx","../src/index.tsx"],"sourcesContent":["import type { FieldOptions as RichtextOptions } from \"@madebywild/sanity-richtext-field\";\nimport type { ObjectDefinition, ObjectOptions, ReferenceDefinition } from \"sanity\";\n\n/** @public */\nexport const typeName = \"wild.quote\" as const;\n\n/** @public */\nexport type PluginConfig = {\n /**\n * A reference definition for the author of the quote.\n * If provided, this reference will be used to fetch author details.\n * If not provided, the quote will use simple text fields for author name and title.\n */\n authorRef?: Omit<ReferenceDefinition, \"type\" | \"name\">;\n /**\n * Options to configure the richtext field used for the quote content.\n * Options will be passed to the underlying `@madebywild/sanity-richtext-field` field.\n */\n richtextOptions?: RichtextOptions;\n};\n\n/** @public */\nexport type FieldOptions = ObjectOptions;\n\n// Add the custom field definition to Sanity's intrinsic definitions\n// so that type checking works correctly when using this field type.\ndeclare module \"sanity\" {\n export interface IntrinsicDefinitions {\n [typeName]: Omit<ObjectDefinition, \"type\" | \"fields\" | \"options\"> & {\n type: typeof typeName;\n options?: FieldOptions;\n };\n }\n}\n","import { createExcerptFromPortableText } from \"@madebywild/sanity-utils\";\nimport { defineField, definePlugin, defineType } from \"sanity\";\nimport { type PluginConfig, typeName } from \"./types\";\n\n/** @public */\n// biome-ignore lint/suspicious/noConfusingVoidType: it can be void.\nconst wildSanityQuoteFieldPlugin = definePlugin<PluginConfig | void>((config) => {\n return {\n name: \"@madebywild/sanity-quote-field\",\n schema: {\n types: [\n defineType({\n name: typeName,\n type: \"object\",\n title: \"Quote\",\n description: \"A stylized quote with optional author.\",\n fields: [\n defineField({\n name: \"quote\",\n type: \"wild.richtext\",\n title: \"Quote\",\n description: \"The quote text.\",\n options: {\n // Disable all parts by default.\n allowedParts: [],\n ...config?.richtextOptions,\n },\n }),\n // Display a reference field if the user provided a author typeName.\n ...(config?.authorRef\n ? [\n defineField({\n name: \"author\",\n title: \"Author\",\n description: \"The author of the quote.\",\n type: \"reference\",\n weak: true,\n ...config.authorRef,\n }),\n ]\n : [\n defineField({\n type: \"string\",\n name: \"authorName\",\n title: \"Author Name\",\n description: \"The author name of the quote.\",\n }),\n defineField({\n type: \"text\",\n rows: 2,\n name: \"authorDescription\",\n title: \"Author Description\",\n description: \"The author description of the quote.\",\n }),\n ]),\n ],\n preview: {\n select: {\n quote: \"quote\",\n authorName: config?.authorRef?.to ? \"author.title\" : \"authorName\",\n },\n prepare({ quote, authorName }) {\n return {\n title: quote ? createExcerptFromPortableText(quote, 25) : \"No quote\",\n subtitle: authorName ? `— ${authorName}` : undefined,\n };\n },\n },\n }),\n ],\n },\n };\n});\n\nexport { wildSanityQuoteFieldPlugin, typeName, type PluginConfig };\n"],"names":["typeName","wildSanityQuoteFieldPlugin","definePlugin","config","name","schema","types","defineType","type","title","description","
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/types.tsx","../src/index.tsx"],"sourcesContent":["import type { FieldOptions as RichtextOptions } from \"@madebywild/sanity-richtext-field\";\nimport type { ObjectDefinition, ObjectOptions, ReferenceDefinition } from \"sanity\";\n\n/** @public */\nexport const typeName = \"wild.quote\" as const;\n\n/** @public */\nexport type PluginConfig = {\n /**\n * A reference definition for the author of the quote.\n * If provided, this reference will be used to fetch author details.\n * If not provided, the quote will use simple text fields for author name and title.\n */\n authorRef?: Omit<ReferenceDefinition, \"type\" | \"name\">;\n /**\n * Options to configure the richtext field used for the quote content.\n * Options will be passed to the underlying `@madebywild/sanity-richtext-field` field.\n */\n richtextOptions?: RichtextOptions;\n};\n\n/** @public */\nexport type FieldOptions = ObjectOptions & {\n /**\n * Whether the media field should be displayed inline.\n * This will render all children inline on the same level.\n */\n inline?: boolean;\n};\n\n// Add the custom field definition to Sanity's intrinsic definitions\n// so that type checking works correctly when using this field type.\ndeclare module \"sanity\" {\n export interface IntrinsicDefinitions {\n [typeName]: Omit<ObjectDefinition, \"type\" | \"fields\" | \"options\" | \"components\"> & {\n type: typeof typeName;\n options?: FieldOptions;\n };\n }\n}\n","import { createExcerptFromPortableText } from \"@madebywild/sanity-utils\";\nimport { defineField, definePlugin, defineType } from \"sanity\";\nimport { type PluginConfig, typeName } from \"./types\";\n\n/** @public */\n// biome-ignore lint/suspicious/noConfusingVoidType: it can be void.\nconst wildSanityQuoteFieldPlugin = definePlugin<PluginConfig | void>((config) => {\n return {\n name: \"@madebywild/sanity-quote-field\",\n schema: {\n types: [\n defineType({\n name: typeName,\n type: \"object\",\n title: \"Quote\",\n description: \"A stylized quote with optional author.\",\n icon: () => <>❝❞</>,\n options: {\n collapsed: false,\n collapsible: true,\n },\n components: {\n field: (props) => (props.schemaType.options.inline ? props.children : props.renderDefault(props)),\n },\n fields: [\n defineField({\n name: \"quote\",\n type: \"wild.richtext\",\n title: \"Quote\",\n description: \"The quote text.\",\n options: {\n // Disable all parts by default.\n allowedParts: [],\n ...config?.richtextOptions,\n },\n }),\n // Display a reference field if the user provided a author typeName.\n ...(config?.authorRef\n ? [\n defineField({\n name: \"author\",\n title: \"Author\",\n description: \"The author of the quote.\",\n type: \"reference\",\n weak: true,\n ...config.authorRef,\n }),\n ]\n : [\n defineField({\n type: \"string\",\n name: \"authorName\",\n title: \"Author Name\",\n description: \"The author name of the quote.\",\n }),\n defineField({\n type: \"text\",\n rows: 2,\n name: \"authorDescription\",\n title: \"Author Description\",\n description: \"The author description of the quote.\",\n }),\n ]),\n ],\n preview: {\n select: {\n quote: \"quote\",\n authorName: config?.authorRef?.to ? \"author.title\" : \"authorName\",\n },\n prepare({ quote, authorName }) {\n return {\n title: quote ? createExcerptFromPortableText(quote, 25) : \"No quote\",\n subtitle: authorName ? `— ${authorName}` : undefined,\n };\n },\n },\n }),\n ],\n },\n };\n});\n\nexport { wildSanityQuoteFieldPlugin, typeName, type PluginConfig };\n"],"names":["typeName","wildSanityQuoteFieldPlugin","definePlugin","config","name","schema","types","defineType","type","title","description","icon","options","collapsed","collapsible","components","field","props","schemaType","inline","children","renderDefault","fields","defineField","allowedParts","richtextOptions","authorRef","weak","rows","preview","select","quote","authorName","to","prepare","createExcerptFromPortableText","subtitle","undefined"],"mappings":";;;AAIO,MAAMA,WAAW,cCElBC,6BAA6BC,aAAmCC,CAAAA,YAC7D;AAAA,EACLC,MAAM;AAAA,EACNC,QAAQ;AAAA,IACNC,OAAO,CACLC,WAAW;AAAA,MACTH,MAAMJ;AAAAA,MACNQ,MAAM;AAAA,MACNC,OAAO;AAAA,MACPC,aAAa;AAAA,MACbC,MAAMA,MAAM,oBAAA,UAAA,EAAE,UAAA,eAAA,CAAE;AAAA,MAChBC,SAAS;AAA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ACD;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@madebywild/sanity-quote-field",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"access": "restricted"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@madebywild/sanity-richtext-field": "0.1.
|
|
25
|
-
"@madebywild/sanity-utils": "0.3.
|
|
24
|
+
"@madebywild/sanity-richtext-field": "0.1.35",
|
|
25
|
+
"@madebywild/sanity-utils": "0.3.14"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"@sanity/ui": "^3.1",
|
package/src/index.tsx
CHANGED
|
@@ -14,6 +14,14 @@ const wildSanityQuoteFieldPlugin = definePlugin<PluginConfig | void>((config) =>
|
|
|
14
14
|
type: "object",
|
|
15
15
|
title: "Quote",
|
|
16
16
|
description: "A stylized quote with optional author.",
|
|
17
|
+
icon: () => <>❝❞</>,
|
|
18
|
+
options: {
|
|
19
|
+
collapsed: false,
|
|
20
|
+
collapsible: true,
|
|
21
|
+
},
|
|
22
|
+
components: {
|
|
23
|
+
field: (props) => (props.schemaType.options.inline ? props.children : props.renderDefault(props)),
|
|
24
|
+
},
|
|
17
25
|
fields: [
|
|
18
26
|
defineField({
|
|
19
27
|
name: "quote",
|
package/src/types.tsx
CHANGED
|
@@ -20,13 +20,19 @@ export type PluginConfig = {
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
/** @public */
|
|
23
|
-
export type FieldOptions = ObjectOptions
|
|
23
|
+
export type FieldOptions = ObjectOptions & {
|
|
24
|
+
/**
|
|
25
|
+
* Whether the media field should be displayed inline.
|
|
26
|
+
* This will render all children inline on the same level.
|
|
27
|
+
*/
|
|
28
|
+
inline?: boolean;
|
|
29
|
+
};
|
|
24
30
|
|
|
25
31
|
// Add the custom field definition to Sanity's intrinsic definitions
|
|
26
32
|
// so that type checking works correctly when using this field type.
|
|
27
33
|
declare module "sanity" {
|
|
28
34
|
export interface IntrinsicDefinitions {
|
|
29
|
-
[typeName]: Omit<ObjectDefinition, "type" | "fields" | "options"> & {
|
|
35
|
+
[typeName]: Omit<ObjectDefinition, "type" | "fields" | "options" | "components"> & {
|
|
30
36
|
type: typeof typeName;
|
|
31
37
|
options?: FieldOptions;
|
|
32
38
|
};
|