datocms-plugin-sdk 0.3.32 → 0.3.34-alpha.2
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 +69 -4
- package/dist/types/connect.d.ts +15 -0
- package/dist/types/types.d.ts +69 -4
- package/package.json +4 -2
- package/src/connect.ts +30 -0
- package/src/types.ts +91 -4
- package/types.json +2146 -1439
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 { BlockNodeTypeWithCustomStyle } 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: BlockNodeTypeWithCustomStyle;
|
|
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 */
|
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 { BlockNodeTypeWithCustomStyle } 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: BlockNodeTypeWithCustomStyle;
|
|
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 */
|
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.2",
|
|
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.1",
|
|
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": "725d3879054486ed54fbc3fb6bbf3ff9dbdf7677"
|
|
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) {
|
package/src/types.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { BlockNodeTypeWithCustomStyle } from 'datocms-structured-text-utils';
|
|
2
|
+
|
|
1
3
|
import {
|
|
2
4
|
Account,
|
|
3
5
|
Field,
|
|
@@ -5,7 +7,6 @@ import {
|
|
|
5
7
|
Item,
|
|
6
8
|
ModelBlock,
|
|
7
9
|
Plugin,
|
|
8
|
-
PluginAttributes,
|
|
9
10
|
Role,
|
|
10
11
|
Site,
|
|
11
12
|
SsoUser,
|
|
@@ -43,7 +44,7 @@ export type MainNavigationTab = {
|
|
|
43
44
|
* be displayed by ascending `rank`. If you want to specify an explicit value
|
|
44
45
|
* for `rank`, make sure to offer a way for final users to customize it inside
|
|
45
46
|
* the plugin's settings form, otherwise the hardcoded value you choose might
|
|
46
|
-
* clash with the one of another plugin!
|
|
47
|
+
* clash with the one of another plugin!
|
|
47
48
|
*/
|
|
48
49
|
rank?: number;
|
|
49
50
|
};
|
|
@@ -139,6 +140,27 @@ export type ContentAreaSidebarItem = {
|
|
|
139
140
|
|
|
140
141
|
export type FieldExtensionType = 'editor' | 'addon';
|
|
141
142
|
|
|
143
|
+
export type FieldType =
|
|
144
|
+
| 'boolean'
|
|
145
|
+
| 'color'
|
|
146
|
+
| 'date_time'
|
|
147
|
+
| 'date'
|
|
148
|
+
| 'file'
|
|
149
|
+
| 'float'
|
|
150
|
+
| 'gallery'
|
|
151
|
+
| 'integer'
|
|
152
|
+
| 'json'
|
|
153
|
+
| 'lat_lon'
|
|
154
|
+
| 'link'
|
|
155
|
+
| 'links'
|
|
156
|
+
| 'rich_text'
|
|
157
|
+
| 'seo'
|
|
158
|
+
| 'slug'
|
|
159
|
+
| 'string'
|
|
160
|
+
| 'structured_text'
|
|
161
|
+
| 'text'
|
|
162
|
+
| 'video';
|
|
163
|
+
|
|
142
164
|
/**
|
|
143
165
|
* Field extensions extend the basic functionality of DatoCMS when it comes to
|
|
144
166
|
* presenting record's fields to the final user. Depending on the extension type
|
|
@@ -164,8 +186,11 @@ export type ManualFieldExtension = {
|
|
|
164
186
|
* editing page, mimicking a sidebar panel
|
|
165
187
|
*/
|
|
166
188
|
asSidebarPanel?: boolean | { startOpen: boolean };
|
|
167
|
-
/**
|
|
168
|
-
|
|
189
|
+
/**
|
|
190
|
+
* The type of fields that the field extension in compatible with. You can use
|
|
191
|
+
* the shortcut `all` to target all types of fields
|
|
192
|
+
*/
|
|
193
|
+
fieldTypes: 'all' | FieldType[];
|
|
169
194
|
/**
|
|
170
195
|
* Whether this field extension needs some configuration options before being
|
|
171
196
|
* installed in a field or not. Will trigger the
|
|
@@ -268,6 +293,68 @@ export type AddonOverride = {
|
|
|
268
293
|
initialHeight?: number;
|
|
269
294
|
};
|
|
270
295
|
|
|
296
|
+
export type StructuredTextCustomMarkPlacement = [
|
|
297
|
+
'before' | 'after',
|
|
298
|
+
'strong' | 'emphasis' | 'underline' | 'code' | 'highlight' | 'strikethrough',
|
|
299
|
+
];
|
|
300
|
+
|
|
301
|
+
/** An object expressing a custom mark for a Structured Text field */
|
|
302
|
+
export type StructuredTextCustomMark = {
|
|
303
|
+
/** ID of mark */
|
|
304
|
+
id: string;
|
|
305
|
+
/** Label representing the custom mark */
|
|
306
|
+
label: string;
|
|
307
|
+
toolbarButton: {
|
|
308
|
+
/**
|
|
309
|
+
* Icon to be shown alongside the label. Can be a FontAwesome icon name (ie.
|
|
310
|
+
* `"address-book"`) or a custom SVG definition. To maintain visual
|
|
311
|
+
* consistency with the rest of the interface, try to use FontAwesome icons
|
|
312
|
+
* whenever possible
|
|
313
|
+
*/
|
|
314
|
+
icon: Icon;
|
|
315
|
+
/**
|
|
316
|
+
* Expresses where you want the custom mark button to be placed inside the
|
|
317
|
+
* toolbar. If not specified, the item will be placed after the standard
|
|
318
|
+
* marks provided by DatoCMS itself.
|
|
319
|
+
*/
|
|
320
|
+
placement?: StructuredTextCustomMarkPlacement;
|
|
321
|
+
/**
|
|
322
|
+
* If multiple custom marks specify the same `placement` for their toolbar
|
|
323
|
+
* button, they will be sorted by ascending `rank`. If you want to specify
|
|
324
|
+
* an explicit value for `rank`, make sure to offer a way for final users to
|
|
325
|
+
* customize it inside the plugin's settings form, otherwise the hardcoded
|
|
326
|
+
* value you choose might clash with the one of another plugin!
|
|
327
|
+
*/
|
|
328
|
+
rank?: number;
|
|
329
|
+
};
|
|
330
|
+
/**
|
|
331
|
+
* Keyboard shortcut associated with the custom mark, expressed using the
|
|
332
|
+
* https://github.com/ianstormtaylor/is-hotkey syntax (ie. `mod+shift+x`)
|
|
333
|
+
*/
|
|
334
|
+
keyboardShortcut?: string;
|
|
335
|
+
/** How the custom mark will be styled inside the editor */
|
|
336
|
+
appliedStyle: React.CSSProperties;
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
/** An object expressing a custom block style for a Structured Text field */
|
|
340
|
+
export type StructuredTextCustomBlockStyle = {
|
|
341
|
+
/** ID of custom block style */
|
|
342
|
+
id: string;
|
|
343
|
+
/** The block node that can apply this style */
|
|
344
|
+
node: BlockNodeTypeWithCustomStyle;
|
|
345
|
+
/** ID of custom block style */
|
|
346
|
+
label: string;
|
|
347
|
+
/** How the block will be styled inside the editor to represent the style */
|
|
348
|
+
appliedStyle: React.CSSProperties;
|
|
349
|
+
/**
|
|
350
|
+
* Custom styles for a block node will be sorted by ascending `rank`. If you
|
|
351
|
+
* want to specify an explicit value for `rank`, make sure to offer a way for
|
|
352
|
+
* final users to customize it inside the plugin's settings form, otherwise
|
|
353
|
+
* the hardcoded value you choose might clash with the one of another plugin!
|
|
354
|
+
*/
|
|
355
|
+
rank?: number;
|
|
356
|
+
};
|
|
357
|
+
|
|
271
358
|
/** An object expressing some field extensions you want to force on a particular field */
|
|
272
359
|
export type FieldExtensionOverride = {
|
|
273
360
|
/** Force a field editor/sidebar extension on a field */
|