datocms-plugin-sdk 0.3.30 → 0.3.34-alpha.1
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 +2 -0
- package/dist/cjs/connect.js.map +1 -1
- package/dist/esm/connect.d.ts +15 -0
- package/dist/esm/connect.js +2 -0
- package/dist/esm/connect.js.map +1 -1
- package/dist/esm/types.d.ts +96 -4
- package/dist/types/connect.d.ts +15 -0
- package/dist/types/types.d.ts +96 -4
- package/package.json +4 -2
- package/src/connect.ts +30 -0
- package/src/types.ts +132 -4
- package/types.json +2296 -1467
package/dist/cjs/connect.js
CHANGED
|
@@ -136,6 +136,8 @@ function connect(configuration) {
|
|
|
136
136
|
manualFieldExtensions: manualFieldExtensions,
|
|
137
137
|
itemFormSidebarPanels: itemFormSidebarPanels,
|
|
138
138
|
overrideFieldExtensions: toMultifield(configuration.overrideFieldExtensions),
|
|
139
|
+
customMarksForStructuredTextField: toMultifield(configuration.customMarksForStructuredTextField),
|
|
140
|
+
customBlockStylesForStructuredTextField: toMultifield(configuration.customBlockStylesForStructuredTextField),
|
|
139
141
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
140
142
|
onChange: function (newSettings) {
|
|
141
143
|
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;AAqMlB,SAAS,YAAY,CACnB,EAA+D;IAE/D,OAAO,UACL,MAA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AAC,aAAa,CAAC,sCAAsC,EAAE;gCACzD,OAAO;6BACR;4BAED,aAAa,CAAC,sCAAsC,CAClD,QAAQ,CAAC,gBAAgB,iCAEpB,MAAM,GACN,QAAQ,GACR,aAAW,EAEjB,CAAC;wBACJ,CAAC,CAAC;wBAEF,QAAQ,GAAG,MAAM,CAAC;wBAClB,MAAM,CAAC,eAA2B,CAAC,CAAC;qBACrC;;;;;CACF;AAlOD,0BAkOC"}
|
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 { StructuredTextCustomBlockStyle, 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,20 @@ 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;
|
|
95
|
+
/**
|
|
96
|
+
* Use this function to define a number of custom block styles for a specific
|
|
97
|
+
* Structured Text field
|
|
98
|
+
*
|
|
99
|
+
* @group structuredText
|
|
100
|
+
*/
|
|
101
|
+
customBlockStylesForStructuredTextField: (field: Field, ctx: FieldIntentCtx) => StructuredTextCustomBlockStyle[] | void;
|
|
87
102
|
/**
|
|
88
103
|
* This function will be called when the plugin needs to render the plugin's
|
|
89
104
|
* configuration form
|
package/dist/esm/connect.js
CHANGED
|
@@ -130,6 +130,8 @@ export function connect(configuration) {
|
|
|
130
130
|
manualFieldExtensions: manualFieldExtensions,
|
|
131
131
|
itemFormSidebarPanels: itemFormSidebarPanels,
|
|
132
132
|
overrideFieldExtensions: toMultifield(configuration.overrideFieldExtensions),
|
|
133
|
+
customMarksForStructuredTextField: toMultifield(configuration.customMarksForStructuredTextField),
|
|
134
|
+
customBlockStylesForStructuredTextField: toMultifield(configuration.customBlockStylesForStructuredTextField),
|
|
133
135
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
134
136
|
onChange: function (newSettings) {
|
|
135
137
|
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,EAC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AM,EAAE,eAAe,CAAC,EAAE;wBAKrE,gBAAc,gBAAgB,CAAC,MAAM,CAAC,CAAC;wBAEvC,MAAM,GAAG,UAAC,QAAkB;4BAChC,IAAI,CAAC,aAAa,CAAC,sCAAsC,EAAE;gCACzD,OAAO;6BACR;4BAED,aAAa,CAAC,sCAAsC,CAClD,QAAQ,CAAC,gBAAgB,iCAEpB,MAAM,GACN,QAAQ,GACR,aAAW,EAEjB,CAAC;wBACJ,CAAC,CAAC;wBAEF,QAAQ,GAAG,MAAM,CAAC;wBAClB,MAAM,CAAC,eAA2B,CAAC,CAAC;qBACrC;;;;;CACF"}
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { BlockquoteType, CodeType, HeadingType, ListType, ParagraphType, ThematicBreakType } from 'datocms-structured-text-utils';
|
|
3
|
+
import { Account, Field, Fieldset, Item, ModelBlock, Plugin, Role, Site, SsoUser, Upload, User } from './SiteApiSchema';
|
|
2
4
|
export declare type Icon = string | {
|
|
3
5
|
type: 'svg';
|
|
4
6
|
viewBox: string;
|
|
@@ -32,7 +34,7 @@ export declare type MainNavigationTab = {
|
|
|
32
34
|
* be displayed by ascending `rank`. If you want to specify an explicit value
|
|
33
35
|
* for `rank`, make sure to offer a way for final users to customize it inside
|
|
34
36
|
* the plugin's settings form, otherwise the hardcoded value you choose might
|
|
35
|
-
* clash with the one of another plugin!
|
|
37
|
+
* clash with the one of another plugin!
|
|
36
38
|
*/
|
|
37
39
|
rank?: number;
|
|
38
40
|
};
|
|
@@ -114,6 +116,7 @@ export declare type ContentAreaSidebarItem = {
|
|
|
114
116
|
rank?: number;
|
|
115
117
|
};
|
|
116
118
|
export declare type FieldExtensionType = 'editor' | 'addon';
|
|
119
|
+
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
120
|
/**
|
|
118
121
|
* Field extensions extend the basic functionality of DatoCMS when it comes to
|
|
119
122
|
* presenting record's fields to the final user. Depending on the extension type
|
|
@@ -141,8 +144,11 @@ export declare type ManualFieldExtension = {
|
|
|
141
144
|
asSidebarPanel?: boolean | {
|
|
142
145
|
startOpen: boolean;
|
|
143
146
|
};
|
|
144
|
-
/**
|
|
145
|
-
|
|
147
|
+
/**
|
|
148
|
+
* The type of fields that the field extension in compatible with. You can use
|
|
149
|
+
* the shortcut `all` to target all types of fields
|
|
150
|
+
*/
|
|
151
|
+
fieldTypes: 'all' | FieldType[];
|
|
146
152
|
/**
|
|
147
153
|
* Whether this field extension needs some configuration options before being
|
|
148
154
|
* installed in a field or not. Will trigger the
|
|
@@ -243,6 +249,65 @@ export declare type AddonOverride = {
|
|
|
243
249
|
/** The initial height to set for the iframe that will render the field extension */
|
|
244
250
|
initialHeight?: number;
|
|
245
251
|
};
|
|
252
|
+
export declare type StructuredTextCustomMarkPlacement = [
|
|
253
|
+
'before' | 'after',
|
|
254
|
+
'strong' | 'emphasis' | 'underline' | 'code' | 'highlight' | 'strikethrough'
|
|
255
|
+
];
|
|
256
|
+
/** An object expressing a custom mark for a Structured Text field */
|
|
257
|
+
export declare type StructuredTextCustomMark = {
|
|
258
|
+
/** ID of mark */
|
|
259
|
+
id: string;
|
|
260
|
+
/** Label representing the custom mark */
|
|
261
|
+
label: string;
|
|
262
|
+
toolbarButton: {
|
|
263
|
+
/**
|
|
264
|
+
* Icon to be shown alongside the label. Can be a FontAwesome icon name (ie.
|
|
265
|
+
* `"address-book"`) or a custom SVG definition. To maintain visual
|
|
266
|
+
* consistency with the rest of the interface, try to use FontAwesome icons
|
|
267
|
+
* whenever possible
|
|
268
|
+
*/
|
|
269
|
+
icon: Icon;
|
|
270
|
+
/**
|
|
271
|
+
* Expresses where you want the custom mark button to be placed inside the
|
|
272
|
+
* toolbar. If not specified, the item will be placed after the standard
|
|
273
|
+
* marks provided by DatoCMS itself.
|
|
274
|
+
*/
|
|
275
|
+
placement?: StructuredTextCustomMarkPlacement;
|
|
276
|
+
/**
|
|
277
|
+
* If multiple custom marks specify the same `placement` for their toolbar
|
|
278
|
+
* button, they will be sorted by ascending `rank`. If you want to specify
|
|
279
|
+
* an explicit value for `rank`, make sure to offer a way for final users to
|
|
280
|
+
* customize it inside the plugin's settings form, otherwise the hardcoded
|
|
281
|
+
* value you choose might clash with the one of another plugin!
|
|
282
|
+
*/
|
|
283
|
+
rank?: number;
|
|
284
|
+
};
|
|
285
|
+
/**
|
|
286
|
+
* Keyboard shortcut associated with the custom mark, expressed using the
|
|
287
|
+
* https://github.com/ianstormtaylor/is-hotkey syntax (ie. `mod+shift+x`)
|
|
288
|
+
*/
|
|
289
|
+
keyboardShortcut?: string;
|
|
290
|
+
/** How the custom mark will be styled inside the editor */
|
|
291
|
+
appliedStyle: React.CSSProperties;
|
|
292
|
+
};
|
|
293
|
+
/** An object expressing a custom block style for a Structured Text field */
|
|
294
|
+
export declare type StructuredTextCustomBlockStyle = {
|
|
295
|
+
/** ID of custom block style */
|
|
296
|
+
id: string;
|
|
297
|
+
/** The block node that can apply this style */
|
|
298
|
+
node: ParagraphType | HeadingType | ListType | BlockquoteType | CodeType | ThematicBreakType;
|
|
299
|
+
/** ID of custom block style */
|
|
300
|
+
label: string;
|
|
301
|
+
/** How the block will be styled inside the editor to represent the style */
|
|
302
|
+
appliedStyle: React.CSSProperties;
|
|
303
|
+
/**
|
|
304
|
+
* Custom styles for a block node will be sorted by ascending `rank`. If you
|
|
305
|
+
* want to specify an explicit value for `rank`, make sure to offer a way for
|
|
306
|
+
* final users to customize it inside the plugin's settings form, otherwise
|
|
307
|
+
* the hardcoded value you choose might clash with the one of another plugin!
|
|
308
|
+
*/
|
|
309
|
+
rank?: number;
|
|
310
|
+
};
|
|
246
311
|
/** An object expressing some field extensions you want to force on a particular field */
|
|
247
312
|
export declare type FieldExtensionOverride = {
|
|
248
313
|
/** Force a field editor/sidebar extension on a field */
|
|
@@ -419,6 +484,14 @@ export declare type RenderAdditionalProperties = {
|
|
|
419
484
|
* to load them.
|
|
420
485
|
*/
|
|
421
486
|
fields: Partial<Record<string, Field>>;
|
|
487
|
+
/**
|
|
488
|
+
* All the fieldsets currently loaded for the current DatoCMS project, indexed
|
|
489
|
+
* by ID. It will always contain the current model fields and all the fields
|
|
490
|
+
* of the blocks it might contain via Modular Content/Structured Text fields.
|
|
491
|
+
* If some fields you need are not present, use the `loadItemTypeFieldsets`
|
|
492
|
+
* function to load them.
|
|
493
|
+
*/
|
|
494
|
+
fieldsets: Partial<Record<string, Fieldset>>;
|
|
422
495
|
/** An object containing the theme colors for the current DatoCMS project */
|
|
423
496
|
theme: Theme;
|
|
424
497
|
/**
|
|
@@ -559,6 +632,25 @@ export declare type LoadDataMethods = {
|
|
|
559
632
|
* ```
|
|
560
633
|
*/
|
|
561
634
|
loadItemTypeFields: (itemTypeId: string) => Promise<Field[]>;
|
|
635
|
+
/**
|
|
636
|
+
* Loads all the fieldsets for a specific model (or block). Fieldsets will be
|
|
637
|
+
* returned and will also be available in the the `fieldsets` property.
|
|
638
|
+
*
|
|
639
|
+
* @example
|
|
640
|
+
*
|
|
641
|
+
* ```js
|
|
642
|
+
* const itemTypeId = prompt('Please insert a model ID:');
|
|
643
|
+
*
|
|
644
|
+
* const fieldsets = await ctx.loadItemTypeFieldsets(itemTypeId);
|
|
645
|
+
*
|
|
646
|
+
* ctx.notice(
|
|
647
|
+
* `Success! ${fieldsets
|
|
648
|
+
* .map((fieldset) => fieldset.attributes.title)
|
|
649
|
+
* .join(', ')}`,
|
|
650
|
+
* );
|
|
651
|
+
* ```
|
|
652
|
+
*/
|
|
653
|
+
loadItemTypeFieldsets: (itemTypeId: string) => Promise<Fieldset[]>;
|
|
562
654
|
/**
|
|
563
655
|
* Loads all the fields in the project that are currently using the plugin for
|
|
564
656
|
* 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 { StructuredTextCustomBlockStyle, 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,20 @@ 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;
|
|
95
|
+
/**
|
|
96
|
+
* Use this function to define a number of custom block styles for a specific
|
|
97
|
+
* Structured Text field
|
|
98
|
+
*
|
|
99
|
+
* @group structuredText
|
|
100
|
+
*/
|
|
101
|
+
customBlockStylesForStructuredTextField: (field: Field, ctx: FieldIntentCtx) => StructuredTextCustomBlockStyle[] | void;
|
|
87
102
|
/**
|
|
88
103
|
* This function will be called when the plugin needs to render the plugin's
|
|
89
104
|
* configuration form
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { BlockquoteType, CodeType, HeadingType, ListType, ParagraphType, ThematicBreakType } from 'datocms-structured-text-utils';
|
|
3
|
+
import { Account, Field, Fieldset, Item, ModelBlock, Plugin, Role, Site, SsoUser, Upload, User } from './SiteApiSchema';
|
|
2
4
|
export declare type Icon = string | {
|
|
3
5
|
type: 'svg';
|
|
4
6
|
viewBox: string;
|
|
@@ -32,7 +34,7 @@ export declare type MainNavigationTab = {
|
|
|
32
34
|
* be displayed by ascending `rank`. If you want to specify an explicit value
|
|
33
35
|
* for `rank`, make sure to offer a way for final users to customize it inside
|
|
34
36
|
* the plugin's settings form, otherwise the hardcoded value you choose might
|
|
35
|
-
* clash with the one of another plugin!
|
|
37
|
+
* clash with the one of another plugin!
|
|
36
38
|
*/
|
|
37
39
|
rank?: number;
|
|
38
40
|
};
|
|
@@ -114,6 +116,7 @@ export declare type ContentAreaSidebarItem = {
|
|
|
114
116
|
rank?: number;
|
|
115
117
|
};
|
|
116
118
|
export declare type FieldExtensionType = 'editor' | 'addon';
|
|
119
|
+
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
120
|
/**
|
|
118
121
|
* Field extensions extend the basic functionality of DatoCMS when it comes to
|
|
119
122
|
* presenting record's fields to the final user. Depending on the extension type
|
|
@@ -141,8 +144,11 @@ export declare type ManualFieldExtension = {
|
|
|
141
144
|
asSidebarPanel?: boolean | {
|
|
142
145
|
startOpen: boolean;
|
|
143
146
|
};
|
|
144
|
-
/**
|
|
145
|
-
|
|
147
|
+
/**
|
|
148
|
+
* The type of fields that the field extension in compatible with. You can use
|
|
149
|
+
* the shortcut `all` to target all types of fields
|
|
150
|
+
*/
|
|
151
|
+
fieldTypes: 'all' | FieldType[];
|
|
146
152
|
/**
|
|
147
153
|
* Whether this field extension needs some configuration options before being
|
|
148
154
|
* installed in a field or not. Will trigger the
|
|
@@ -243,6 +249,65 @@ export declare type AddonOverride = {
|
|
|
243
249
|
/** The initial height to set for the iframe that will render the field extension */
|
|
244
250
|
initialHeight?: number;
|
|
245
251
|
};
|
|
252
|
+
export declare type StructuredTextCustomMarkPlacement = [
|
|
253
|
+
'before' | 'after',
|
|
254
|
+
'strong' | 'emphasis' | 'underline' | 'code' | 'highlight' | 'strikethrough'
|
|
255
|
+
];
|
|
256
|
+
/** An object expressing a custom mark for a Structured Text field */
|
|
257
|
+
export declare type StructuredTextCustomMark = {
|
|
258
|
+
/** ID of mark */
|
|
259
|
+
id: string;
|
|
260
|
+
/** Label representing the custom mark */
|
|
261
|
+
label: string;
|
|
262
|
+
toolbarButton: {
|
|
263
|
+
/**
|
|
264
|
+
* Icon to be shown alongside the label. Can be a FontAwesome icon name (ie.
|
|
265
|
+
* `"address-book"`) or a custom SVG definition. To maintain visual
|
|
266
|
+
* consistency with the rest of the interface, try to use FontAwesome icons
|
|
267
|
+
* whenever possible
|
|
268
|
+
*/
|
|
269
|
+
icon: Icon;
|
|
270
|
+
/**
|
|
271
|
+
* Expresses where you want the custom mark button to be placed inside the
|
|
272
|
+
* toolbar. If not specified, the item will be placed after the standard
|
|
273
|
+
* marks provided by DatoCMS itself.
|
|
274
|
+
*/
|
|
275
|
+
placement?: StructuredTextCustomMarkPlacement;
|
|
276
|
+
/**
|
|
277
|
+
* If multiple custom marks specify the same `placement` for their toolbar
|
|
278
|
+
* button, they will be sorted by ascending `rank`. If you want to specify
|
|
279
|
+
* an explicit value for `rank`, make sure to offer a way for final users to
|
|
280
|
+
* customize it inside the plugin's settings form, otherwise the hardcoded
|
|
281
|
+
* value you choose might clash with the one of another plugin!
|
|
282
|
+
*/
|
|
283
|
+
rank?: number;
|
|
284
|
+
};
|
|
285
|
+
/**
|
|
286
|
+
* Keyboard shortcut associated with the custom mark, expressed using the
|
|
287
|
+
* https://github.com/ianstormtaylor/is-hotkey syntax (ie. `mod+shift+x`)
|
|
288
|
+
*/
|
|
289
|
+
keyboardShortcut?: string;
|
|
290
|
+
/** How the custom mark will be styled inside the editor */
|
|
291
|
+
appliedStyle: React.CSSProperties;
|
|
292
|
+
};
|
|
293
|
+
/** An object expressing a custom block style for a Structured Text field */
|
|
294
|
+
export declare type StructuredTextCustomBlockStyle = {
|
|
295
|
+
/** ID of custom block style */
|
|
296
|
+
id: string;
|
|
297
|
+
/** The block node that can apply this style */
|
|
298
|
+
node: ParagraphType | HeadingType | ListType | BlockquoteType | CodeType | ThematicBreakType;
|
|
299
|
+
/** ID of custom block style */
|
|
300
|
+
label: string;
|
|
301
|
+
/** How the block will be styled inside the editor to represent the style */
|
|
302
|
+
appliedStyle: React.CSSProperties;
|
|
303
|
+
/**
|
|
304
|
+
* Custom styles for a block node will be sorted by ascending `rank`. If you
|
|
305
|
+
* want to specify an explicit value for `rank`, make sure to offer a way for
|
|
306
|
+
* final users to customize it inside the plugin's settings form, otherwise
|
|
307
|
+
* the hardcoded value you choose might clash with the one of another plugin!
|
|
308
|
+
*/
|
|
309
|
+
rank?: number;
|
|
310
|
+
};
|
|
246
311
|
/** An object expressing some field extensions you want to force on a particular field */
|
|
247
312
|
export declare type FieldExtensionOverride = {
|
|
248
313
|
/** Force a field editor/sidebar extension on a field */
|
|
@@ -419,6 +484,14 @@ export declare type RenderAdditionalProperties = {
|
|
|
419
484
|
* to load them.
|
|
420
485
|
*/
|
|
421
486
|
fields: Partial<Record<string, Field>>;
|
|
487
|
+
/**
|
|
488
|
+
* All the fieldsets currently loaded for the current DatoCMS project, indexed
|
|
489
|
+
* by ID. It will always contain the current model fields and all the fields
|
|
490
|
+
* of the blocks it might contain via Modular Content/Structured Text fields.
|
|
491
|
+
* If some fields you need are not present, use the `loadItemTypeFieldsets`
|
|
492
|
+
* function to load them.
|
|
493
|
+
*/
|
|
494
|
+
fieldsets: Partial<Record<string, Fieldset>>;
|
|
422
495
|
/** An object containing the theme colors for the current DatoCMS project */
|
|
423
496
|
theme: Theme;
|
|
424
497
|
/**
|
|
@@ -559,6 +632,25 @@ export declare type LoadDataMethods = {
|
|
|
559
632
|
* ```
|
|
560
633
|
*/
|
|
561
634
|
loadItemTypeFields: (itemTypeId: string) => Promise<Field[]>;
|
|
635
|
+
/**
|
|
636
|
+
* Loads all the fieldsets for a specific model (or block). Fieldsets will be
|
|
637
|
+
* returned and will also be available in the the `fieldsets` property.
|
|
638
|
+
*
|
|
639
|
+
* @example
|
|
640
|
+
*
|
|
641
|
+
* ```js
|
|
642
|
+
* const itemTypeId = prompt('Please insert a model ID:');
|
|
643
|
+
*
|
|
644
|
+
* const fieldsets = await ctx.loadItemTypeFieldsets(itemTypeId);
|
|
645
|
+
*
|
|
646
|
+
* ctx.notice(
|
|
647
|
+
* `Success! ${fieldsets
|
|
648
|
+
* .map((fieldset) => fieldset.attributes.title)
|
|
649
|
+
* .join(', ')}`,
|
|
650
|
+
* );
|
|
651
|
+
* ```
|
|
652
|
+
*/
|
|
653
|
+
loadItemTypeFieldsets: (itemTypeId: string) => Promise<Fieldset[]>;
|
|
562
654
|
/**
|
|
563
655
|
* Loads all the fields in the project that are currently using the plugin for
|
|
564
656
|
* 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.1",
|
|
4
4
|
"description": "DatoCMS Plugin SDK",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"datocms",
|
|
@@ -36,10 +36,12 @@
|
|
|
36
36
|
"url": "https://github.com/datocms/plugins-sdk/issues"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
+
"datocms-structured-text-utils": "1.2.3-alpha.0",
|
|
39
40
|
"penpal": "^4.1.1"
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|
|
43
|
+
"@types/react": "^17.0.3",
|
|
42
44
|
"typedoc": "^0.22.8"
|
|
43
45
|
},
|
|
44
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "65f6059283faedafecb15ad3be0b1c79ec45af81"
|
|
45
47
|
}
|
package/src/connect.ts
CHANGED
|
@@ -38,6 +38,7 @@ import {
|
|
|
38
38
|
isRenderSidebarPaneParent,
|
|
39
39
|
Parent,
|
|
40
40
|
} from './guards';
|
|
41
|
+
import { StructuredTextCustomBlockStyle, StructuredTextCustomMark } from '.';
|
|
41
42
|
|
|
42
43
|
export type SizingUtilities = {
|
|
43
44
|
/**
|
|
@@ -139,6 +140,29 @@ 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
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Use this function to define a number of custom block styles for a specific
|
|
157
|
+
* Structured Text field
|
|
158
|
+
*
|
|
159
|
+
* @group structuredText
|
|
160
|
+
*/
|
|
161
|
+
customBlockStylesForStructuredTextField: (
|
|
162
|
+
field: Field,
|
|
163
|
+
ctx: FieldIntentCtx,
|
|
164
|
+
) => StructuredTextCustomBlockStyle[] | void;
|
|
165
|
+
|
|
142
166
|
/**
|
|
143
167
|
* This function will be called when the plugin needs to render the plugin's
|
|
144
168
|
* configuration form
|
|
@@ -341,6 +365,12 @@ export async function connect(
|
|
|
341
365
|
overrideFieldExtensions: toMultifield(
|
|
342
366
|
configuration.overrideFieldExtensions,
|
|
343
367
|
),
|
|
368
|
+
customMarksForStructuredTextField: toMultifield(
|
|
369
|
+
configuration.customMarksForStructuredTextField,
|
|
370
|
+
),
|
|
371
|
+
customBlockStylesForStructuredTextField: toMultifield(
|
|
372
|
+
configuration.customBlockStylesForStructuredTextField,
|
|
373
|
+
),
|
|
344
374
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
345
375
|
onChange(newSettings: any) {
|
|
346
376
|
if (listener) {
|