datocms-plugin-sdk 0.3.34-alpha.0 → 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 +1 -0
- package/dist/cjs/connect.js.map +1 -1
- package/dist/esm/connect.d.ts +8 -1
- package/dist/esm/connect.js +1 -0
- package/dist/esm/connect.js.map +1 -1
- package/dist/esm/types.d.ts +47 -5
- package/dist/types/connect.d.ts +8 -1
- package/dist/types/types.d.ts +47 -5
- package/package.json +3 -2
- package/src/connect.ts +15 -1
- package/src/types.ts +63 -5
- package/types.json +1766 -1373
package/dist/cjs/connect.js
CHANGED
|
@@ -137,6 +137,7 @@ function connect(configuration) {
|
|
|
137
137
|
itemFormSidebarPanels: itemFormSidebarPanels,
|
|
138
138
|
overrideFieldExtensions: toMultifield(configuration.overrideFieldExtensions),
|
|
139
139
|
customMarksForStructuredTextField: toMultifield(configuration.customMarksForStructuredTextField),
|
|
140
|
+
customBlockStylesForStructuredTextField: toMultifield(configuration.customBlockStylesForStructuredTextField),
|
|
140
141
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
141
142
|
onChange: function (newSettings) {
|
|
142
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,MAAe,EACf,GAA6B;QAE7B,IAAI,CA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;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,6 +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
|
+
import { StructuredTextCustomBlockStyle, StructuredTextCustomMark } from '.';
|
|
4
4
|
export declare type SizingUtilities = {
|
|
5
5
|
/**
|
|
6
6
|
* Listens for DOM changes and automatically calls `setHeight` when it detects
|
|
@@ -92,6 +92,13 @@ export declare type FullConnectParameters = {
|
|
|
92
92
|
* @group structuredText
|
|
93
93
|
*/
|
|
94
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;
|
|
95
102
|
/**
|
|
96
103
|
* This function will be called when the plugin needs to render the plugin's
|
|
97
104
|
* configuration form
|
package/dist/esm/connect.js
CHANGED
|
@@ -131,6 +131,7 @@ export function connect(configuration) {
|
|
|
131
131
|
itemFormSidebarPanels: itemFormSidebarPanels,
|
|
132
132
|
overrideFieldExtensions: toMultifield(configuration.overrideFieldExtensions),
|
|
133
133
|
customMarksForStructuredTextField: toMultifield(configuration.customMarksForStructuredTextField),
|
|
134
|
+
customBlockStylesForStructuredTextField: toMultifield(configuration.customBlockStylesForStructuredTextField),
|
|
134
135
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
135
136
|
onChange: function (newSettings) {
|
|
136
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,EACd,yBAAyB,EACzB,0BAA0B,EAC1B,4BAA4B,EAC5B,8CAA8C,EAC9C,mBAAmB,EACnB,kBAAkB,EAClB,yBAAyB,GAE1B,MAAM,UAAU,CAAC;AAqMlB,SAAS,YAAY,CACnB,EAA+D;IAE/D,OAAO,UACL,MAAe,EACf,GAA6B;QAE7B,IAAI,CAAC,EAAE,EAAE;YACP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AEpB,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,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { BlockquoteType, CodeType, HeadingType, ListType, ParagraphType, ThematicBreakType } from 'datocms-structured-text-utils';
|
|
2
3
|
import { Account, Field, Fieldset, Item, ModelBlock, Plugin, Role, Site, SsoUser, Upload, User } from './SiteApiSchema';
|
|
3
4
|
export declare type Icon = string | {
|
|
4
5
|
type: 'svg';
|
|
@@ -33,7 +34,7 @@ export declare type MainNavigationTab = {
|
|
|
33
34
|
* be displayed by ascending `rank`. If you want to specify an explicit value
|
|
34
35
|
* for `rank`, make sure to offer a way for final users to customize it inside
|
|
35
36
|
* the plugin's settings form, otherwise the hardcoded value you choose might
|
|
36
|
-
* clash with the one of another plugin!
|
|
37
|
+
* clash with the one of another plugin!
|
|
37
38
|
*/
|
|
38
39
|
rank?: number;
|
|
39
40
|
};
|
|
@@ -248,24 +249,65 @@ export declare type AddonOverride = {
|
|
|
248
249
|
/** The initial height to set for the iframe that will render the field extension */
|
|
249
250
|
initialHeight?: number;
|
|
250
251
|
};
|
|
252
|
+
export declare type StructuredTextCustomMarkPlacement = [
|
|
253
|
+
'before' | 'after',
|
|
254
|
+
'strong' | 'emphasis' | 'underline' | 'code' | 'highlight' | 'strikethrough'
|
|
255
|
+
];
|
|
251
256
|
/** An object expressing a custom mark for a Structured Text field */
|
|
252
257
|
export declare type StructuredTextCustomMark = {
|
|
253
258
|
/** ID of mark */
|
|
254
259
|
id: string;
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
260
|
+
/** Label representing the custom mark */
|
|
261
|
+
label: string;
|
|
262
|
+
toolbarButton: {
|
|
258
263
|
/**
|
|
259
264
|
* Icon to be shown alongside the label. Can be a FontAwesome icon name (ie.
|
|
260
265
|
* `"address-book"`) or a custom SVG definition. To maintain visual
|
|
261
266
|
* consistency with the rest of the interface, try to use FontAwesome icons
|
|
262
|
-
* whenever possible
|
|
267
|
+
* whenever possible
|
|
263
268
|
*/
|
|
264
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;
|
|
265
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;
|
|
266
290
|
/** How the custom mark will be styled inside the editor */
|
|
267
291
|
appliedStyle: React.CSSProperties;
|
|
268
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
|
+
};
|
|
269
311
|
/** An object expressing some field extensions you want to force on a particular field */
|
|
270
312
|
export declare type FieldExtensionOverride = {
|
|
271
313
|
/** Force a field editor/sidebar extension on a field */
|
package/dist/types/connect.d.ts
CHANGED
|
@@ -1,6 +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
|
+
import { StructuredTextCustomBlockStyle, StructuredTextCustomMark } from '.';
|
|
4
4
|
export declare type SizingUtilities = {
|
|
5
5
|
/**
|
|
6
6
|
* Listens for DOM changes and automatically calls `setHeight` when it detects
|
|
@@ -92,6 +92,13 @@ export declare type FullConnectParameters = {
|
|
|
92
92
|
* @group structuredText
|
|
93
93
|
*/
|
|
94
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;
|
|
95
102
|
/**
|
|
96
103
|
* This function will be called when the plugin needs to render the plugin's
|
|
97
104
|
* configuration form
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { BlockquoteType, CodeType, HeadingType, ListType, ParagraphType, ThematicBreakType } from 'datocms-structured-text-utils';
|
|
2
3
|
import { Account, Field, Fieldset, Item, ModelBlock, Plugin, Role, Site, SsoUser, Upload, User } from './SiteApiSchema';
|
|
3
4
|
export declare type Icon = string | {
|
|
4
5
|
type: 'svg';
|
|
@@ -33,7 +34,7 @@ export declare type MainNavigationTab = {
|
|
|
33
34
|
* be displayed by ascending `rank`. If you want to specify an explicit value
|
|
34
35
|
* for `rank`, make sure to offer a way for final users to customize it inside
|
|
35
36
|
* the plugin's settings form, otherwise the hardcoded value you choose might
|
|
36
|
-
* clash with the one of another plugin!
|
|
37
|
+
* clash with the one of another plugin!
|
|
37
38
|
*/
|
|
38
39
|
rank?: number;
|
|
39
40
|
};
|
|
@@ -248,24 +249,65 @@ export declare type AddonOverride = {
|
|
|
248
249
|
/** The initial height to set for the iframe that will render the field extension */
|
|
249
250
|
initialHeight?: number;
|
|
250
251
|
};
|
|
252
|
+
export declare type StructuredTextCustomMarkPlacement = [
|
|
253
|
+
'before' | 'after',
|
|
254
|
+
'strong' | 'emphasis' | 'underline' | 'code' | 'highlight' | 'strikethrough'
|
|
255
|
+
];
|
|
251
256
|
/** An object expressing a custom mark for a Structured Text field */
|
|
252
257
|
export declare type StructuredTextCustomMark = {
|
|
253
258
|
/** ID of mark */
|
|
254
259
|
id: string;
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
260
|
+
/** Label representing the custom mark */
|
|
261
|
+
label: string;
|
|
262
|
+
toolbarButton: {
|
|
258
263
|
/**
|
|
259
264
|
* Icon to be shown alongside the label. Can be a FontAwesome icon name (ie.
|
|
260
265
|
* `"address-book"`) or a custom SVG definition. To maintain visual
|
|
261
266
|
* consistency with the rest of the interface, try to use FontAwesome icons
|
|
262
|
-
* whenever possible
|
|
267
|
+
* whenever possible
|
|
263
268
|
*/
|
|
264
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;
|
|
265
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;
|
|
266
290
|
/** How the custom mark will be styled inside the editor */
|
|
267
291
|
appliedStyle: React.CSSProperties;
|
|
268
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
|
+
};
|
|
269
311
|
/** An object expressing some field extensions you want to force on a particular field */
|
|
270
312
|
export declare type FieldExtensionOverride = {
|
|
271
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.34-alpha.
|
|
3
|
+
"version": "0.3.34-alpha.1",
|
|
4
4
|
"description": "DatoCMS Plugin SDK",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"datocms",
|
|
@@ -36,11 +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": {
|
|
42
43
|
"@types/react": "^17.0.3",
|
|
43
44
|
"typedoc": "^0.22.8"
|
|
44
45
|
},
|
|
45
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "65f6059283faedafecb15ad3be0b1c79ec45af81"
|
|
46
47
|
}
|
package/src/connect.ts
CHANGED
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
isRenderSidebarPaneParent,
|
|
39
39
|
Parent,
|
|
40
40
|
} from './guards';
|
|
41
|
-
import { StructuredTextCustomMark } from '.';
|
|
41
|
+
import { StructuredTextCustomBlockStyle, StructuredTextCustomMark } from '.';
|
|
42
42
|
|
|
43
43
|
export type SizingUtilities = {
|
|
44
44
|
/**
|
|
@@ -152,6 +152,17 @@ export type FullConnectParameters = {
|
|
|
152
152
|
ctx: FieldIntentCtx,
|
|
153
153
|
) => StructuredTextCustomMark[] | void;
|
|
154
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
|
+
|
|
155
166
|
/**
|
|
156
167
|
* This function will be called when the plugin needs to render the plugin's
|
|
157
168
|
* configuration form
|
|
@@ -357,6 +368,9 @@ export async function connect(
|
|
|
357
368
|
customMarksForStructuredTextField: toMultifield(
|
|
358
369
|
configuration.customMarksForStructuredTextField,
|
|
359
370
|
),
|
|
371
|
+
customBlockStylesForStructuredTextField: toMultifield(
|
|
372
|
+
configuration.customBlockStylesForStructuredTextField,
|
|
373
|
+
),
|
|
360
374
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
361
375
|
onChange(newSettings: any) {
|
|
362
376
|
if (listener) {
|
package/src/types.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BlockquoteType,
|
|
3
|
+
CodeType,
|
|
4
|
+
HeadingType,
|
|
5
|
+
ListType,
|
|
6
|
+
ParagraphType,
|
|
7
|
+
ThematicBreakType,
|
|
8
|
+
} from 'datocms-structured-text-utils';
|
|
9
|
+
|
|
1
10
|
import {
|
|
2
11
|
Account,
|
|
3
12
|
Field,
|
|
@@ -42,7 +51,7 @@ export type MainNavigationTab = {
|
|
|
42
51
|
* be displayed by ascending `rank`. If you want to specify an explicit value
|
|
43
52
|
* for `rank`, make sure to offer a way for final users to customize it inside
|
|
44
53
|
* the plugin's settings form, otherwise the hardcoded value you choose might
|
|
45
|
-
* clash with the one of another plugin!
|
|
54
|
+
* clash with the one of another plugin!
|
|
46
55
|
*/
|
|
47
56
|
rank?: number;
|
|
48
57
|
};
|
|
@@ -291,25 +300,74 @@ export type AddonOverride = {
|
|
|
291
300
|
initialHeight?: number;
|
|
292
301
|
};
|
|
293
302
|
|
|
303
|
+
export type StructuredTextCustomMarkPlacement = [
|
|
304
|
+
'before' | 'after',
|
|
305
|
+
'strong' | 'emphasis' | 'underline' | 'code' | 'highlight' | 'strikethrough',
|
|
306
|
+
];
|
|
307
|
+
|
|
294
308
|
/** An object expressing a custom mark for a Structured Text field */
|
|
295
309
|
export type StructuredTextCustomMark = {
|
|
296
310
|
/** ID of mark */
|
|
297
311
|
id: string;
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
312
|
+
/** Label representing the custom mark */
|
|
313
|
+
label: string;
|
|
314
|
+
toolbarButton: {
|
|
301
315
|
/**
|
|
302
316
|
* Icon to be shown alongside the label. Can be a FontAwesome icon name (ie.
|
|
303
317
|
* `"address-book"`) or a custom SVG definition. To maintain visual
|
|
304
318
|
* consistency with the rest of the interface, try to use FontAwesome icons
|
|
305
|
-
* whenever possible
|
|
319
|
+
* whenever possible
|
|
306
320
|
*/
|
|
307
321
|
icon: Icon;
|
|
322
|
+
/**
|
|
323
|
+
* Expresses where you want the custom mark button to be placed inside the
|
|
324
|
+
* toolbar. If not specified, the item will be placed after the standard
|
|
325
|
+
* marks provided by DatoCMS itself.
|
|
326
|
+
*/
|
|
327
|
+
placement?: StructuredTextCustomMarkPlacement;
|
|
328
|
+
/**
|
|
329
|
+
* If multiple custom marks specify the same `placement` for their toolbar
|
|
330
|
+
* button, they will be sorted by ascending `rank`. If you want to specify
|
|
331
|
+
* an explicit value for `rank`, make sure to offer a way for final users to
|
|
332
|
+
* customize it inside the plugin's settings form, otherwise the hardcoded
|
|
333
|
+
* value you choose might clash with the one of another plugin!
|
|
334
|
+
*/
|
|
335
|
+
rank?: number;
|
|
308
336
|
};
|
|
337
|
+
/**
|
|
338
|
+
* Keyboard shortcut associated with the custom mark, expressed using the
|
|
339
|
+
* https://github.com/ianstormtaylor/is-hotkey syntax (ie. `mod+shift+x`)
|
|
340
|
+
*/
|
|
341
|
+
keyboardShortcut?: string;
|
|
309
342
|
/** How the custom mark will be styled inside the editor */
|
|
310
343
|
appliedStyle: React.CSSProperties;
|
|
311
344
|
};
|
|
312
345
|
|
|
346
|
+
/** An object expressing a custom block style for a Structured Text field */
|
|
347
|
+
export type StructuredTextCustomBlockStyle = {
|
|
348
|
+
/** ID of custom block style */
|
|
349
|
+
id: string;
|
|
350
|
+
/** The block node that can apply this style */
|
|
351
|
+
node:
|
|
352
|
+
| ParagraphType
|
|
353
|
+
| HeadingType
|
|
354
|
+
| ListType
|
|
355
|
+
| BlockquoteType
|
|
356
|
+
| CodeType
|
|
357
|
+
| ThematicBreakType;
|
|
358
|
+
/** ID of custom block style */
|
|
359
|
+
label: string;
|
|
360
|
+
/** How the block will be styled inside the editor to represent the style */
|
|
361
|
+
appliedStyle: React.CSSProperties;
|
|
362
|
+
/**
|
|
363
|
+
* Custom styles for a block node will be sorted by ascending `rank`. If you
|
|
364
|
+
* want to specify an explicit value for `rank`, make sure to offer a way for
|
|
365
|
+
* final users to customize it inside the plugin's settings form, otherwise
|
|
366
|
+
* the hardcoded value you choose might clash with the one of another plugin!
|
|
367
|
+
*/
|
|
368
|
+
rank?: number;
|
|
369
|
+
};
|
|
370
|
+
|
|
313
371
|
/** An object expressing some field extensions you want to force on a particular field */
|
|
314
372
|
export type FieldExtensionOverride = {
|
|
315
373
|
/** Force a field editor/sidebar extension on a field */
|