datocms-plugin-sdk 0.3.27 → 0.3.34-alpha.0
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/cjs/connect.js +1 -0
- package/dist/cjs/connect.js.map +1 -1
- package/dist/esm/connect.d.ts +8 -0
- package/dist/esm/connect.js +1 -0
- package/dist/esm/connect.js.map +1 -1
- package/dist/esm/types.d.ts +53 -3
- package/dist/types/connect.d.ts +8 -0
- package/dist/types/types.d.ts +53 -3
- package/package.json +3 -2
- package/src/connect.ts +16 -0
- package/src/types.ts +73 -3
- package/types.json +1775 -1330
package/dist/cjs/connect.js
CHANGED
|
@@ -136,6 +136,7 @@ function connect(configuration) {
|
|
|
136
136
|
manualFieldExtensions: manualFieldExtensions,
|
|
137
137
|
itemFormSidebarPanels: itemFormSidebarPanels,
|
|
138
138
|
overrideFieldExtensions: toMultifield(configuration.overrideFieldExtensions),
|
|
139
|
+
customMarksForStructuredTextField: toMultifield(configuration.customMarksForStructuredTextField),
|
|
139
140
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
140
141
|
onChange: function (newSettings) {
|
|
141
142
|
if (listener) {
|
package/dist/cjs/connect.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../../src/connect.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAAyD;AA4BzD,mCAWkB;
|
|
1
|
+
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../../src/connect.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAAyD;AA4BzD,mCAWkB;AA0LlB,SAAS,YAAY,CACnB,EAA+D;IAE/D,OAAO,UACL,MAAe,EACf,GAA6B;QAE7B,IAAI,CAAC,EAAE,EAAE;YACP,OAAO,EAAE,C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,QAAQ,GACR,aAAW,EAEjB,CAAC;wBACJ,CAAC,CAAC;wBAEF,QAAQ,GAAG,MAAM,CAAC;wBAClB,MAAM,CAAC,eAA2B,CAAC,CAAC;qBACrC;;;;;CACF;AA/ND,0BA+NC"}
|
package/dist/esm/connect.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Field, ModelBlock } from './SiteApiSchema';
|
|
2
2
|
import { AssetSource, ContentAreaSidebarItem, FieldExtensionOverride, InitPropertiesAndMethods, ItemFormSidebarPanel, MainNavigationTab, ManualFieldExtension, OnBootPropertiesAndMethods, RenderAssetSourcePropertiesAndMethods, RenderConfigScreenPropertiesAndMethods, RenderFieldExtensionPropertiesAndMethods, RenderManualFieldExtensionConfigScreenPropertiesAndMethods, RenderModalPropertiesAndMethods, RenderPagePropertiesAndMethods, RenderSidebarPanePropertiesAndMethods, SettingsAreaSidebarItemGroup } from './types';
|
|
3
|
+
import { StructuredTextCustomMark } from '.';
|
|
3
4
|
export declare type SizingUtilities = {
|
|
4
5
|
/**
|
|
5
6
|
* Listens for DOM changes and automatically calls `setHeight` when it detects
|
|
@@ -84,6 +85,13 @@ export declare type FullConnectParameters = {
|
|
|
84
85
|
* @group forcedFieldExtensions
|
|
85
86
|
*/
|
|
86
87
|
overrideFieldExtensions: (field: Field, ctx: FieldIntentCtx) => FieldExtensionOverride | void;
|
|
88
|
+
/**
|
|
89
|
+
* Use this function to define a number of custom marks for a specific
|
|
90
|
+
* Structured Text field
|
|
91
|
+
*
|
|
92
|
+
* @group structuredText
|
|
93
|
+
*/
|
|
94
|
+
customMarksForStructuredTextField: (field: Field, ctx: FieldIntentCtx) => StructuredTextCustomMark[] | void;
|
|
87
95
|
/**
|
|
88
96
|
* This function will be called when the plugin needs to render the plugin's
|
|
89
97
|
* configuration form
|
package/dist/esm/connect.js
CHANGED
|
@@ -130,6 +130,7 @@ export function connect(configuration) {
|
|
|
130
130
|
manualFieldExtensions: manualFieldExtensions,
|
|
131
131
|
itemFormSidebarPanels: itemFormSidebarPanels,
|
|
132
132
|
overrideFieldExtensions: toMultifield(configuration.overrideFieldExtensions),
|
|
133
|
+
customMarksForStructuredTextField: toMultifield(configuration.customMarksForStructuredTextField),
|
|
133
134
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
134
135
|
onChange: function (newSettings) {
|
|
135
136
|
if (listener) {
|
package/dist/esm/connect.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../../src/connect.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,eAAe,MAAM,4BAA4B,CAAC;AA4BzD,OAAO,EACL,YAAY,EACZ,cAAc,EACd,yBAAyB,EACzB,0BAA0B,EAC1B,4BAA4B,EAC5B,8CAA8C,EAC9C,mBAAmB,EACnB,kBAAkB,EAClB,yBAAyB,GAE1B,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../../src/connect.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,eAAe,MAAM,4BAA4B,CAAC;AA4BzD,OAAO,EACL,YAAY,EACZ,cAAc,EACd,yBAAyB,EACzB,0BAA0B,EAC1B,4BAA4B,EAC5B,8CAA8C,EAC9C,mBAAmB,EACnB,kBAAkB,EAClB,yBAAyB,GAE1B,MAAM,UAAU,CAAC;AA0LlB,SAAS,YAAY,CACnB,EAA+D;IAE/D,OAAO,UACL,MAAe,EACf,GAA6B;QAE7B,IAAI,CAAC,EAAE,EAAE;YACP,OAAO,EAAE,CAAC;SACX;QAED,IAAM,MAAM,GAA2B,EAAE,CAAC;QAE1C,KAAoB,UAAM,EAAN,iBAAM,EAAN,oBAAM,EAAN,IAAM,EAAE;YAAvB,IAAM,KAAK,eAAA;YACd,IAAM,QAAQ,GAAG,GAAG,C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="react" />
|
|
2
|
+
import { Account, Field, Fieldset, Item, ModelBlock, Plugin, Role, Site, SsoUser, Upload, User } from './SiteApiSchema';
|
|
2
3
|
export declare type Icon = string | {
|
|
3
4
|
type: 'svg';
|
|
4
5
|
viewBox: string;
|
|
@@ -114,6 +115,7 @@ export declare type ContentAreaSidebarItem = {
|
|
|
114
115
|
rank?: number;
|
|
115
116
|
};
|
|
116
117
|
export declare type FieldExtensionType = 'editor' | 'addon';
|
|
118
|
+
export declare type FieldType = 'boolean' | 'color' | 'date_time' | 'date' | 'file' | 'float' | 'gallery' | 'integer' | 'json' | 'lat_lon' | 'link' | 'links' | 'rich_text' | 'seo' | 'slug' | 'string' | 'structured_text' | 'text' | 'video';
|
|
117
119
|
/**
|
|
118
120
|
* Field extensions extend the basic functionality of DatoCMS when it comes to
|
|
119
121
|
* presenting record's fields to the final user. Depending on the extension type
|
|
@@ -141,8 +143,11 @@ export declare type ManualFieldExtension = {
|
|
|
141
143
|
asSidebarPanel?: boolean | {
|
|
142
144
|
startOpen: boolean;
|
|
143
145
|
};
|
|
144
|
-
/**
|
|
145
|
-
|
|
146
|
+
/**
|
|
147
|
+
* The type of fields that the field extension in compatible with. You can use
|
|
148
|
+
* the shortcut `all` to target all types of fields
|
|
149
|
+
*/
|
|
150
|
+
fieldTypes: 'all' | FieldType[];
|
|
146
151
|
/**
|
|
147
152
|
* Whether this field extension needs some configuration options before being
|
|
148
153
|
* installed in a field or not. Will trigger the
|
|
@@ -243,6 +248,24 @@ export declare type AddonOverride = {
|
|
|
243
248
|
/** The initial height to set for the iframe that will render the field extension */
|
|
244
249
|
initialHeight?: number;
|
|
245
250
|
};
|
|
251
|
+
/** An object expressing a custom mark for a Structured Text field */
|
|
252
|
+
export declare type StructuredTextCustomMark = {
|
|
253
|
+
/** ID of mark */
|
|
254
|
+
id: string;
|
|
255
|
+
toolbar: {
|
|
256
|
+
/** Label to be shown on the toolbar */
|
|
257
|
+
label: string;
|
|
258
|
+
/**
|
|
259
|
+
* Icon to be shown alongside the label. Can be a FontAwesome icon name (ie.
|
|
260
|
+
* `"address-book"`) or a custom SVG definition. To maintain visual
|
|
261
|
+
* consistency with the rest of the interface, try to use FontAwesome icons
|
|
262
|
+
* whenever possible.
|
|
263
|
+
*/
|
|
264
|
+
icon: Icon;
|
|
265
|
+
};
|
|
266
|
+
/** How the custom mark will be styled inside the editor */
|
|
267
|
+
appliedStyle: React.CSSProperties;
|
|
268
|
+
};
|
|
246
269
|
/** An object expressing some field extensions you want to force on a particular field */
|
|
247
270
|
export declare type FieldExtensionOverride = {
|
|
248
271
|
/** Force a field editor/sidebar extension on a field */
|
|
@@ -419,6 +442,14 @@ export declare type RenderAdditionalProperties = {
|
|
|
419
442
|
* to load them.
|
|
420
443
|
*/
|
|
421
444
|
fields: Partial<Record<string, Field>>;
|
|
445
|
+
/**
|
|
446
|
+
* All the fieldsets currently loaded for the current DatoCMS project, indexed
|
|
447
|
+
* by ID. It will always contain the current model fields and all the fields
|
|
448
|
+
* of the blocks it might contain via Modular Content/Structured Text fields.
|
|
449
|
+
* If some fields you need are not present, use the `loadItemTypeFieldsets`
|
|
450
|
+
* function to load them.
|
|
451
|
+
*/
|
|
452
|
+
fieldsets: Partial<Record<string, Fieldset>>;
|
|
422
453
|
/** An object containing the theme colors for the current DatoCMS project */
|
|
423
454
|
theme: Theme;
|
|
424
455
|
/**
|
|
@@ -559,6 +590,25 @@ export declare type LoadDataMethods = {
|
|
|
559
590
|
* ```
|
|
560
591
|
*/
|
|
561
592
|
loadItemTypeFields: (itemTypeId: string) => Promise<Field[]>;
|
|
593
|
+
/**
|
|
594
|
+
* Loads all the fieldsets for a specific model (or block). Fieldsets will be
|
|
595
|
+
* returned and will also be available in the the `fieldsets` property.
|
|
596
|
+
*
|
|
597
|
+
* @example
|
|
598
|
+
*
|
|
599
|
+
* ```js
|
|
600
|
+
* const itemTypeId = prompt('Please insert a model ID:');
|
|
601
|
+
*
|
|
602
|
+
* const fieldsets = await ctx.loadItemTypeFieldsets(itemTypeId);
|
|
603
|
+
*
|
|
604
|
+
* ctx.notice(
|
|
605
|
+
* `Success! ${fieldsets
|
|
606
|
+
* .map((fieldset) => fieldset.attributes.title)
|
|
607
|
+
* .join(', ')}`,
|
|
608
|
+
* );
|
|
609
|
+
* ```
|
|
610
|
+
*/
|
|
611
|
+
loadItemTypeFieldsets: (itemTypeId: string) => Promise<Fieldset[]>;
|
|
562
612
|
/**
|
|
563
613
|
* Loads all the fields in the project that are currently using the plugin for
|
|
564
614
|
* one of its manual field extensions.
|
package/dist/types/connect.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Field, ModelBlock } from './SiteApiSchema';
|
|
2
2
|
import { AssetSource, ContentAreaSidebarItem, FieldExtensionOverride, InitPropertiesAndMethods, ItemFormSidebarPanel, MainNavigationTab, ManualFieldExtension, OnBootPropertiesAndMethods, RenderAssetSourcePropertiesAndMethods, RenderConfigScreenPropertiesAndMethods, RenderFieldExtensionPropertiesAndMethods, RenderManualFieldExtensionConfigScreenPropertiesAndMethods, RenderModalPropertiesAndMethods, RenderPagePropertiesAndMethods, RenderSidebarPanePropertiesAndMethods, SettingsAreaSidebarItemGroup } from './types';
|
|
3
|
+
import { StructuredTextCustomMark } from '.';
|
|
3
4
|
export declare type SizingUtilities = {
|
|
4
5
|
/**
|
|
5
6
|
* Listens for DOM changes and automatically calls `setHeight` when it detects
|
|
@@ -84,6 +85,13 @@ export declare type FullConnectParameters = {
|
|
|
84
85
|
* @group forcedFieldExtensions
|
|
85
86
|
*/
|
|
86
87
|
overrideFieldExtensions: (field: Field, ctx: FieldIntentCtx) => FieldExtensionOverride | void;
|
|
88
|
+
/**
|
|
89
|
+
* Use this function to define a number of custom marks for a specific
|
|
90
|
+
* Structured Text field
|
|
91
|
+
*
|
|
92
|
+
* @group structuredText
|
|
93
|
+
*/
|
|
94
|
+
customMarksForStructuredTextField: (field: Field, ctx: FieldIntentCtx) => StructuredTextCustomMark[] | void;
|
|
87
95
|
/**
|
|
88
96
|
* This function will be called when the plugin needs to render the plugin's
|
|
89
97
|
* configuration form
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Account, Field, Fieldset, Item, ModelBlock, Plugin, Role, Site, SsoUser, Upload, User } from './SiteApiSchema';
|
|
2
3
|
export declare type Icon = string | {
|
|
3
4
|
type: 'svg';
|
|
4
5
|
viewBox: string;
|
|
@@ -114,6 +115,7 @@ export declare type ContentAreaSidebarItem = {
|
|
|
114
115
|
rank?: number;
|
|
115
116
|
};
|
|
116
117
|
export declare type FieldExtensionType = 'editor' | 'addon';
|
|
118
|
+
export declare type FieldType = 'boolean' | 'color' | 'date_time' | 'date' | 'file' | 'float' | 'gallery' | 'integer' | 'json' | 'lat_lon' | 'link' | 'links' | 'rich_text' | 'seo' | 'slug' | 'string' | 'structured_text' | 'text' | 'video';
|
|
117
119
|
/**
|
|
118
120
|
* Field extensions extend the basic functionality of DatoCMS when it comes to
|
|
119
121
|
* presenting record's fields to the final user. Depending on the extension type
|
|
@@ -141,8 +143,11 @@ export declare type ManualFieldExtension = {
|
|
|
141
143
|
asSidebarPanel?: boolean | {
|
|
142
144
|
startOpen: boolean;
|
|
143
145
|
};
|
|
144
|
-
/**
|
|
145
|
-
|
|
146
|
+
/**
|
|
147
|
+
* The type of fields that the field extension in compatible with. You can use
|
|
148
|
+
* the shortcut `all` to target all types of fields
|
|
149
|
+
*/
|
|
150
|
+
fieldTypes: 'all' | FieldType[];
|
|
146
151
|
/**
|
|
147
152
|
* Whether this field extension needs some configuration options before being
|
|
148
153
|
* installed in a field or not. Will trigger the
|
|
@@ -243,6 +248,24 @@ export declare type AddonOverride = {
|
|
|
243
248
|
/** The initial height to set for the iframe that will render the field extension */
|
|
244
249
|
initialHeight?: number;
|
|
245
250
|
};
|
|
251
|
+
/** An object expressing a custom mark for a Structured Text field */
|
|
252
|
+
export declare type StructuredTextCustomMark = {
|
|
253
|
+
/** ID of mark */
|
|
254
|
+
id: string;
|
|
255
|
+
toolbar: {
|
|
256
|
+
/** Label to be shown on the toolbar */
|
|
257
|
+
label: string;
|
|
258
|
+
/**
|
|
259
|
+
* Icon to be shown alongside the label. Can be a FontAwesome icon name (ie.
|
|
260
|
+
* `"address-book"`) or a custom SVG definition. To maintain visual
|
|
261
|
+
* consistency with the rest of the interface, try to use FontAwesome icons
|
|
262
|
+
* whenever possible.
|
|
263
|
+
*/
|
|
264
|
+
icon: Icon;
|
|
265
|
+
};
|
|
266
|
+
/** How the custom mark will be styled inside the editor */
|
|
267
|
+
appliedStyle: React.CSSProperties;
|
|
268
|
+
};
|
|
246
269
|
/** An object expressing some field extensions you want to force on a particular field */
|
|
247
270
|
export declare type FieldExtensionOverride = {
|
|
248
271
|
/** Force a field editor/sidebar extension on a field */
|
|
@@ -419,6 +442,14 @@ export declare type RenderAdditionalProperties = {
|
|
|
419
442
|
* to load them.
|
|
420
443
|
*/
|
|
421
444
|
fields: Partial<Record<string, Field>>;
|
|
445
|
+
/**
|
|
446
|
+
* All the fieldsets currently loaded for the current DatoCMS project, indexed
|
|
447
|
+
* by ID. It will always contain the current model fields and all the fields
|
|
448
|
+
* of the blocks it might contain via Modular Content/Structured Text fields.
|
|
449
|
+
* If some fields you need are not present, use the `loadItemTypeFieldsets`
|
|
450
|
+
* function to load them.
|
|
451
|
+
*/
|
|
452
|
+
fieldsets: Partial<Record<string, Fieldset>>;
|
|
422
453
|
/** An object containing the theme colors for the current DatoCMS project */
|
|
423
454
|
theme: Theme;
|
|
424
455
|
/**
|
|
@@ -559,6 +590,25 @@ export declare type LoadDataMethods = {
|
|
|
559
590
|
* ```
|
|
560
591
|
*/
|
|
561
592
|
loadItemTypeFields: (itemTypeId: string) => Promise<Field[]>;
|
|
593
|
+
/**
|
|
594
|
+
* Loads all the fieldsets for a specific model (or block). Fieldsets will be
|
|
595
|
+
* returned and will also be available in the the `fieldsets` property.
|
|
596
|
+
*
|
|
597
|
+
* @example
|
|
598
|
+
*
|
|
599
|
+
* ```js
|
|
600
|
+
* const itemTypeId = prompt('Please insert a model ID:');
|
|
601
|
+
*
|
|
602
|
+
* const fieldsets = await ctx.loadItemTypeFieldsets(itemTypeId);
|
|
603
|
+
*
|
|
604
|
+
* ctx.notice(
|
|
605
|
+
* `Success! ${fieldsets
|
|
606
|
+
* .map((fieldset) => fieldset.attributes.title)
|
|
607
|
+
* .join(', ')}`,
|
|
608
|
+
* );
|
|
609
|
+
* ```
|
|
610
|
+
*/
|
|
611
|
+
loadItemTypeFieldsets: (itemTypeId: string) => Promise<Fieldset[]>;
|
|
562
612
|
/**
|
|
563
613
|
* Loads all the fields in the project that are currently using the plugin for
|
|
564
614
|
* one of its manual field extensions.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "datocms-plugin-sdk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.34-alpha.0",
|
|
4
4
|
"description": "DatoCMS Plugin SDK",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"datocms",
|
|
@@ -39,7 +39,8 @@
|
|
|
39
39
|
"penpal": "^4.1.1"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
+
"@types/react": "^17.0.3",
|
|
42
43
|
"typedoc": "^0.22.8"
|
|
43
44
|
},
|
|
44
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "b28009e140b81f6b8f4c13a253ecab02a7eca2a6"
|
|
45
46
|
}
|
package/src/connect.ts
CHANGED
|
@@ -38,6 +38,7 @@ import {
|
|
|
38
38
|
isRenderSidebarPaneParent,
|
|
39
39
|
Parent,
|
|
40
40
|
} from './guards';
|
|
41
|
+
import { StructuredTextCustomMark } from '.';
|
|
41
42
|
|
|
42
43
|
export type SizingUtilities = {
|
|
43
44
|
/**
|
|
@@ -139,6 +140,18 @@ export type FullConnectParameters = {
|
|
|
139
140
|
field: Field,
|
|
140
141
|
ctx: FieldIntentCtx,
|
|
141
142
|
) => FieldExtensionOverride | void;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Use this function to define a number of custom marks for a specific
|
|
146
|
+
* Structured Text field
|
|
147
|
+
*
|
|
148
|
+
* @group structuredText
|
|
149
|
+
*/
|
|
150
|
+
customMarksForStructuredTextField: (
|
|
151
|
+
field: Field,
|
|
152
|
+
ctx: FieldIntentCtx,
|
|
153
|
+
) => StructuredTextCustomMark[] | void;
|
|
154
|
+
|
|
142
155
|
/**
|
|
143
156
|
* This function will be called when the plugin needs to render the plugin's
|
|
144
157
|
* configuration form
|
|
@@ -341,6 +354,9 @@ export async function connect(
|
|
|
341
354
|
overrideFieldExtensions: toMultifield(
|
|
342
355
|
configuration.overrideFieldExtensions,
|
|
343
356
|
),
|
|
357
|
+
customMarksForStructuredTextField: toMultifield(
|
|
358
|
+
configuration.customMarksForStructuredTextField,
|
|
359
|
+
),
|
|
344
360
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
345
361
|
onChange(newSettings: any) {
|
|
346
362
|
if (listener) {
|
package/src/types.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Account,
|
|
3
3
|
Field,
|
|
4
|
+
Fieldset,
|
|
4
5
|
Item,
|
|
5
6
|
ModelBlock,
|
|
6
7
|
Plugin,
|
|
7
|
-
PluginAttributes,
|
|
8
8
|
Role,
|
|
9
9
|
Site,
|
|
10
10
|
SsoUser,
|
|
@@ -138,6 +138,27 @@ export type ContentAreaSidebarItem = {
|
|
|
138
138
|
|
|
139
139
|
export type FieldExtensionType = 'editor' | 'addon';
|
|
140
140
|
|
|
141
|
+
export type FieldType =
|
|
142
|
+
| 'boolean'
|
|
143
|
+
| 'color'
|
|
144
|
+
| 'date_time'
|
|
145
|
+
| 'date'
|
|
146
|
+
| 'file'
|
|
147
|
+
| 'float'
|
|
148
|
+
| 'gallery'
|
|
149
|
+
| 'integer'
|
|
150
|
+
| 'json'
|
|
151
|
+
| 'lat_lon'
|
|
152
|
+
| 'link'
|
|
153
|
+
| 'links'
|
|
154
|
+
| 'rich_text'
|
|
155
|
+
| 'seo'
|
|
156
|
+
| 'slug'
|
|
157
|
+
| 'string'
|
|
158
|
+
| 'structured_text'
|
|
159
|
+
| 'text'
|
|
160
|
+
| 'video';
|
|
161
|
+
|
|
141
162
|
/**
|
|
142
163
|
* Field extensions extend the basic functionality of DatoCMS when it comes to
|
|
143
164
|
* presenting record's fields to the final user. Depending on the extension type
|
|
@@ -163,8 +184,11 @@ export type ManualFieldExtension = {
|
|
|
163
184
|
* editing page, mimicking a sidebar panel
|
|
164
185
|
*/
|
|
165
186
|
asSidebarPanel?: boolean | { startOpen: boolean };
|
|
166
|
-
/**
|
|
167
|
-
|
|
187
|
+
/**
|
|
188
|
+
* The type of fields that the field extension in compatible with. You can use
|
|
189
|
+
* the shortcut `all` to target all types of fields
|
|
190
|
+
*/
|
|
191
|
+
fieldTypes: 'all' | FieldType[];
|
|
168
192
|
/**
|
|
169
193
|
* Whether this field extension needs some configuration options before being
|
|
170
194
|
* installed in a field or not. Will trigger the
|
|
@@ -267,6 +291,25 @@ export type AddonOverride = {
|
|
|
267
291
|
initialHeight?: number;
|
|
268
292
|
};
|
|
269
293
|
|
|
294
|
+
/** An object expressing a custom mark for a Structured Text field */
|
|
295
|
+
export type StructuredTextCustomMark = {
|
|
296
|
+
/** ID of mark */
|
|
297
|
+
id: string;
|
|
298
|
+
toolbar: {
|
|
299
|
+
/** Label to be shown on the toolbar */
|
|
300
|
+
label: string;
|
|
301
|
+
/**
|
|
302
|
+
* Icon to be shown alongside the label. Can be a FontAwesome icon name (ie.
|
|
303
|
+
* `"address-book"`) or a custom SVG definition. To maintain visual
|
|
304
|
+
* consistency with the rest of the interface, try to use FontAwesome icons
|
|
305
|
+
* whenever possible.
|
|
306
|
+
*/
|
|
307
|
+
icon: Icon;
|
|
308
|
+
};
|
|
309
|
+
/** How the custom mark will be styled inside the editor */
|
|
310
|
+
appliedStyle: React.CSSProperties;
|
|
311
|
+
};
|
|
312
|
+
|
|
270
313
|
/** An object expressing some field extensions you want to force on a particular field */
|
|
271
314
|
export type FieldExtensionOverride = {
|
|
272
315
|
/** Force a field editor/sidebar extension on a field */
|
|
@@ -460,6 +503,14 @@ export type RenderAdditionalProperties = {
|
|
|
460
503
|
* to load them.
|
|
461
504
|
*/
|
|
462
505
|
fields: Partial<Record<string, Field>>;
|
|
506
|
+
/**
|
|
507
|
+
* All the fieldsets currently loaded for the current DatoCMS project, indexed
|
|
508
|
+
* by ID. It will always contain the current model fields and all the fields
|
|
509
|
+
* of the blocks it might contain via Modular Content/Structured Text fields.
|
|
510
|
+
* If some fields you need are not present, use the `loadItemTypeFieldsets`
|
|
511
|
+
* function to load them.
|
|
512
|
+
*/
|
|
513
|
+
fieldsets: Partial<Record<string, Fieldset>>;
|
|
463
514
|
/** An object containing the theme colors for the current DatoCMS project */
|
|
464
515
|
theme: Theme;
|
|
465
516
|
/**
|
|
@@ -613,6 +664,25 @@ export type LoadDataMethods = {
|
|
|
613
664
|
* ```
|
|
614
665
|
*/
|
|
615
666
|
loadItemTypeFields: (itemTypeId: string) => Promise<Field[]>;
|
|
667
|
+
/**
|
|
668
|
+
* Loads all the fieldsets for a specific model (or block). Fieldsets will be
|
|
669
|
+
* returned and will also be available in the the `fieldsets` property.
|
|
670
|
+
*
|
|
671
|
+
* @example
|
|
672
|
+
*
|
|
673
|
+
* ```js
|
|
674
|
+
* const itemTypeId = prompt('Please insert a model ID:');
|
|
675
|
+
*
|
|
676
|
+
* const fieldsets = await ctx.loadItemTypeFieldsets(itemTypeId);
|
|
677
|
+
*
|
|
678
|
+
* ctx.notice(
|
|
679
|
+
* `Success! ${fieldsets
|
|
680
|
+
* .map((fieldset) => fieldset.attributes.title)
|
|
681
|
+
* .join(', ')}`,
|
|
682
|
+
* );
|
|
683
|
+
* ```
|
|
684
|
+
*/
|
|
685
|
+
loadItemTypeFieldsets: (itemTypeId: string) => Promise<Fieldset[]>;
|
|
616
686
|
/**
|
|
617
687
|
* Loads all the fields in the project that are currently using the plugin for
|
|
618
688
|
* one of its manual field extensions.
|