@comet/cms-admin 9.0.0-beta.5 → 9.0.0-beta.6
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/lib/blocks/ExternalLinkBlock.d.ts.map +1 -1
- package/lib/blocks/ExternalLinkBlock.js +18 -4
- package/lib/blocks/tipTap/TextBlockStyleContext.d.ts +3 -0
- package/lib/blocks/tipTap/TextBlockStyleContext.d.ts.map +1 -0
- package/lib/blocks/tipTap/TextBlockStyleContext.js +2 -0
- package/lib/blocks/tipTap/TipTapToolbar.d.ts +3 -3
- package/lib/blocks/tipTap/TipTapToolbar.d.ts.map +1 -1
- package/lib/blocks/tipTap/TipTapToolbar.js +28 -28
- package/lib/blocks/tipTap/createTipTapRichTextBlock.d.ts +12 -12
- package/lib/blocks/tipTap/createTipTapRichTextBlock.d.ts.map +1 -1
- package/lib/blocks/tipTap/createTipTapRichTextBlock.js +27 -27
- package/lib/blocks/tipTap/extensions/TextBlockStyleHeading.d.ts +2 -0
- package/lib/blocks/tipTap/extensions/TextBlockStyleHeading.d.ts.map +1 -0
- package/lib/blocks/tipTap/extensions/{BlockStyleHeading.js → TextBlockStyleHeading.js} +12 -12
- package/lib/blocks/tipTap/extensions/TextBlockStyleParagraph.d.ts +2 -0
- package/lib/blocks/tipTap/extensions/TextBlockStyleParagraph.d.ts.map +1 -0
- package/lib/blocks/tipTap/extensions/{BlockStyleParagraph.js → TextBlockStyleParagraph.js} +12 -12
- package/lib/blocks.generated.d.ts +2 -0
- package/lib/blocks.generated.d.ts.map +1 -1
- package/lib/builds/StartBuildsDialog.d.ts.map +1 -1
- package/lib/builds/StartBuildsDialog.js +1 -5
- package/lib/fullTextSearch/SearchHeaderItem.d.ts +2 -0
- package/lib/fullTextSearch/SearchHeaderItem.d.ts.map +1 -0
- package/lib/fullTextSearch/SearchHeaderItem.generated.d.ts +25 -0
- package/lib/fullTextSearch/SearchHeaderItem.generated.d.ts.map +1 -0
- package/lib/fullTextSearch/SearchHeaderItem.generated.js +5 -0
- package/lib/fullTextSearch/SearchHeaderItem.js +175 -0
- package/lib/graphql.generated.d.ts +19 -2
- package/lib/graphql.generated.d.ts.map +1 -1
- package/lib/index.d.ts +3 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/pages/pageSearch/usePageSearch.d.ts.map +1 -1
- package/lib/pages/pageSearch/usePageSearch.js +23 -4
- package/lib/pages/pageTree/PageActions.d.ts.map +1 -1
- package/lib/pages/pageTree/PageActions.js +4 -2
- package/lib/pages/pageTreeConfig.d.ts +5 -0
- package/lib/pages/pageTreeConfig.d.ts.map +1 -1
- package/lib/pages/pagesPage/PagesPageActionToolbar.d.ts.map +1 -1
- package/lib/pages/pagesPage/PagesPageActionToolbar.js +4 -2
- package/lib/storybook.d.js +1 -0
- package/package.json +23 -16
- package/lib/blocks/__stories__/BlockInFinalForm.stories.js +0 -53
- package/lib/blocks/__stories__/RichTextBlock.stories.js +0 -53
- package/lib/blocks/helpers/__stories__/createCompositeBlockSelectField.stories.js +0 -106
- package/lib/blocks/tipTap/BlockStyleContext.d.ts +0 -3
- package/lib/blocks/tipTap/BlockStyleContext.d.ts.map +0 -1
- package/lib/blocks/tipTap/BlockStyleContext.js +0 -2
- package/lib/blocks/tipTap/__stories__/TipTapRichTextBlock.stories.js +0 -1841
- package/lib/blocks/tipTap/extensions/BlockStyleHeading.d.ts +0 -2
- package/lib/blocks/tipTap/extensions/BlockStyleHeading.d.ts.map +0 -1
- package/lib/blocks/tipTap/extensions/BlockStyleParagraph.d.ts +0 -2
- package/lib/blocks/tipTap/extensions/BlockStyleParagraph.d.ts.map +0 -1
- package/lib/common/__stories__/MasterMenuInMasterLayout.stories.js +0 -87
- package/lib/contentScope/__stories__/ContentScopeProvider.stories.js +0 -85
- package/lib/contentScope/__stories__/ContentScopeSelect.stories.js +0 -655
- package/lib/contentScope/noContentScopeFallback/__stories__/NoContentScopeFallback.stories.js +0 -7
- package/lib/dashboard/__stories__/DateTime.stories.js +0 -7
- package/lib/dashboard/widgets/__stories__/DashboardWidgetRoot.stories.js +0 -82
- package/lib/form/file/__stories__/FileUploadField.stories.js +0 -351
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExternalLinkBlock.d.ts","sourceRoot":"","sources":["../../src/blocks/ExternalLinkBlock.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAMzF,OAAO,EAAiB,KAAK,cAAc,EAAE,KAAK,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAEtF,KAAK,KAAK,GAAG,qBAAqB,CAAC;AAEnC,eAAO,MAAM,iBAAiB,EAAE,cAAc,CAAC,qBAAqB,EAAE,KAAK,EAAE,sBAAsB,CAAC,GAAG,kBAAkB,CAAC,KAAK,
|
|
1
|
+
{"version":3,"file":"ExternalLinkBlock.d.ts","sourceRoot":"","sources":["../../src/blocks/ExternalLinkBlock.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAMzF,OAAO,EAAiB,KAAK,cAAc,EAAE,KAAK,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAEtF,KAAK,KAAK,GAAG,qBAAqB,CAAC;AAEnC,eAAO,MAAM,iBAAiB,EAAE,cAAc,CAAC,qBAAqB,EAAE,KAAK,EAAE,sBAAsB,CAAC,GAAG,kBAAkB,CAAC,KAAK,CAuF9H,CAAC"}
|
|
@@ -26,7 +26,8 @@ export var ExternalLinkBlock = _objectSpread(_objectSpread({}, createBlockSkelet
|
|
|
26
26
|
defaultValues: function defaultValues() {
|
|
27
27
|
return {
|
|
28
28
|
targetUrl: undefined,
|
|
29
|
-
openInNewWindow: false
|
|
29
|
+
openInNewWindow: false,
|
|
30
|
+
noFollow: false
|
|
30
31
|
};
|
|
31
32
|
},
|
|
32
33
|
category: BlockCategory.Navigation,
|
|
@@ -36,7 +37,8 @@ export var ExternalLinkBlock = _objectSpread(_objectSpread({}, createBlockSkelet
|
|
|
36
37
|
state2Output: function state2Output(state) {
|
|
37
38
|
return {
|
|
38
39
|
targetUrl: state.targetUrl,
|
|
39
|
-
openInNewWindow: state.openInNewWindow
|
|
40
|
+
openInNewWindow: state.openInNewWindow,
|
|
41
|
+
noFollow: state.noFollow
|
|
40
42
|
};
|
|
41
43
|
},
|
|
42
44
|
output2State: function () {
|
|
@@ -46,7 +48,8 @@ export var ExternalLinkBlock = _objectSpread(_objectSpread({}, createBlockSkelet
|
|
|
46
48
|
case 0:
|
|
47
49
|
return _context.a(2, {
|
|
48
50
|
targetUrl: output.targetUrl,
|
|
49
|
-
openInNewWindow: output.openInNewWindow
|
|
51
|
+
openInNewWindow: output.openInNewWindow,
|
|
52
|
+
noFollow: output.noFollow
|
|
50
53
|
});
|
|
51
54
|
}
|
|
52
55
|
}, _callee);
|
|
@@ -63,7 +66,8 @@ export var ExternalLinkBlock = _objectSpread(_objectSpread({}, createBlockSkelet
|
|
|
63
66
|
if (isLinkTarget(url)) {
|
|
64
67
|
return {
|
|
65
68
|
targetUrl: url,
|
|
66
|
-
openInNewWindow: false
|
|
69
|
+
openInNewWindow: false,
|
|
70
|
+
noFollow: false
|
|
67
71
|
};
|
|
68
72
|
}
|
|
69
73
|
return false;
|
|
@@ -95,6 +99,16 @@ export var ExternalLinkBlock = _objectSpread(_objectSpread({}, createBlockSkelet
|
|
|
95
99
|
defaultMessage: "Open in new window"
|
|
96
100
|
}),
|
|
97
101
|
name: "openInNewWindow"
|
|
102
|
+
}), /*#__PURE__*/_jsx(CheckboxField, {
|
|
103
|
+
label: /*#__PURE__*/_jsx(FormattedMessage, {
|
|
104
|
+
id: "comet.blocks.link.external.noFollow",
|
|
105
|
+
defaultMessage: "No follow"
|
|
106
|
+
}),
|
|
107
|
+
name: "noFollow",
|
|
108
|
+
helperText: /*#__PURE__*/_jsx(FormattedMessage, {
|
|
109
|
+
id: "comet.blocks.link.external.noFollow.helperText",
|
|
110
|
+
defaultMessage: "Adds rel=\"nofollow\" to the link, telling search engines not to follow it. Use for sponsored, paid, user-generated or untrusted links so that no SEO authority is passed to the target."
|
|
111
|
+
})
|
|
98
112
|
})]
|
|
99
113
|
})
|
|
100
114
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextBlockStyleContext.d.ts","sourceRoot":"","sources":["../../../src/blocks/tipTap/TextBlockStyleContext.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAExE,eAAO,MAAM,qBAAqB,iDAA4C,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { type Editor } from "@tiptap/react";
|
|
2
2
|
import type { BlockInterface, LinkBlockInterface } from "../types";
|
|
3
|
-
import type {
|
|
4
|
-
export declare const TipTapToolbar: ({ editor, supports,
|
|
3
|
+
import type { TipTapInlineStyle, TipTapPlaceholder, TipTapSupports, TipTapTextBlockStyle } from "./createTipTapRichTextBlock";
|
|
4
|
+
export declare const TipTapToolbar: ({ editor, supports, textBlockStyles, inlineStyles, placeholders, linkBlock, listLevelMax, }: {
|
|
5
5
|
editor: Editor;
|
|
6
6
|
supports: TipTapSupports[];
|
|
7
|
-
|
|
7
|
+
textBlockStyles: TipTapTextBlockStyle[];
|
|
8
8
|
inlineStyles: TipTapInlineStyle[];
|
|
9
9
|
placeholders: TipTapPlaceholder[];
|
|
10
10
|
linkBlock?: BlockInterface & LinkBlockInterface;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TipTapToolbar.d.ts","sourceRoot":"","sources":["../../../src/blocks/tipTap/TipTapToolbar.tsx"],"names":[],"mappings":"AAiCA,OAAO,EAAE,KAAK,MAAM,EAAkB,MAAM,eAAe,CAAC;AAI5D,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AACnE,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"TipTapToolbar.d.ts","sourceRoot":"","sources":["../../../src/blocks/tipTap/TipTapToolbar.tsx"],"names":[],"mappings":"AAiCA,OAAO,EAAE,KAAK,MAAM,EAAkB,MAAM,eAAe,CAAC;AAI5D,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,cAAc,EAAE,oBAAoB,EAAuB,MAAM,6BAA6B,CAAC;AA8GnJ,eAAO,MAAM,aAAa,GAAI,6FAQ3B;IACC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,eAAe,EAAE,oBAAoB,EAAE,CAAC;IACxC,YAAY,EAAE,iBAAiB,EAAE,CAAC;IAClC,YAAY,EAAE,iBAAiB,EAAE,CAAC;IAClC,SAAS,CAAC,EAAE,cAAc,GAAG,kBAAkB,CAAC;IAChD,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB,4CA2bA,CAAC"}
|
|
@@ -124,7 +124,7 @@ var selectSx = _defineProperty({}, "& .".concat(selectClasses.select, ".").conca
|
|
|
124
124
|
export var TipTapToolbar = function TipTapToolbar(_ref3) {
|
|
125
125
|
var editor = _ref3.editor,
|
|
126
126
|
supports = _ref3.supports,
|
|
127
|
-
|
|
127
|
+
textBlockStyles = _ref3.textBlockStyles,
|
|
128
128
|
inlineStyles = _ref3.inlineStyles,
|
|
129
129
|
placeholders = _ref3.placeholders,
|
|
130
130
|
linkBlock = _ref3.linkBlock,
|
|
@@ -162,7 +162,7 @@ export var TipTapToolbar = function TipTapToolbar(_ref3) {
|
|
|
162
162
|
selector: function selector(_ref4) {
|
|
163
163
|
var _ref6;
|
|
164
164
|
var e = _ref4.editor;
|
|
165
|
-
var
|
|
165
|
+
var activeTextBlockType = function () {
|
|
166
166
|
for (var level = 1; level <= 6; level++) {
|
|
167
167
|
if (e.isActive("heading", {
|
|
168
168
|
level: level
|
|
@@ -172,7 +172,7 @@ export var TipTapToolbar = function TipTapToolbar(_ref3) {
|
|
|
172
172
|
}
|
|
173
173
|
return "paragraph";
|
|
174
174
|
}();
|
|
175
|
-
var
|
|
175
|
+
var activeTipTapTextBlockType = function () {
|
|
176
176
|
if (e.isActive("orderedList")) {
|
|
177
177
|
return "ordered-list";
|
|
178
178
|
}
|
|
@@ -213,9 +213,9 @@ export var TipTapToolbar = function TipTapToolbar(_ref3) {
|
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
215
|
return {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
216
|
+
activeTextBlockType: activeTextBlockType,
|
|
217
|
+
activeTipTapTextBlockType: activeTipTapTextBlockType,
|
|
218
|
+
activeTextBlockStyle: (_ref6 = attrs.textBlockStyle) !== null && _ref6 !== void 0 ? _ref6 : "",
|
|
219
219
|
activeInlineStyle: activeInlineStyle,
|
|
220
220
|
canUndo: e.can().undo(),
|
|
221
221
|
canRedo: e.can().redo(),
|
|
@@ -245,13 +245,13 @@ export var TipTapToolbar = function TipTapToolbar(_ref3) {
|
|
|
245
245
|
return editor.commands.focus();
|
|
246
246
|
}, 0);
|
|
247
247
|
};
|
|
248
|
-
var
|
|
249
|
-
return !style.appliesTo || style.appliesTo.includes(editorState.
|
|
248
|
+
var applicableTextBlockStyles = textBlockStyles.filter(function (style) {
|
|
249
|
+
return !style.appliesTo || style.appliesTo.includes(editorState.activeTipTapTextBlockType);
|
|
250
250
|
});
|
|
251
251
|
var applicableInlineStyles = inlineStyles.filter(function (style) {
|
|
252
|
-
return !style.appliesTo || style.appliesTo.includes(editorState.
|
|
252
|
+
return !style.appliesTo || style.appliesTo.includes(editorState.activeTipTapTextBlockType);
|
|
253
253
|
});
|
|
254
|
-
var
|
|
254
|
+
var handleTextBlockTypeChange = function handleTextBlockTypeChange(e) {
|
|
255
255
|
var value = e.target.value;
|
|
256
256
|
if (value === "paragraph") {
|
|
257
257
|
editor.chain().focus().setParagraph().run();
|
|
@@ -261,28 +261,28 @@ export var TipTapToolbar = function TipTapToolbar(_ref3) {
|
|
|
261
261
|
}).run();
|
|
262
262
|
}
|
|
263
263
|
|
|
264
|
-
// Clear
|
|
265
|
-
if (
|
|
266
|
-
var
|
|
267
|
-
if (
|
|
264
|
+
// Clear textBlockStyle if it's not applicable to the new text block type
|
|
265
|
+
if (textBlockStyles.length > 0) {
|
|
266
|
+
var activeTextBlockStyle = editorState.activeTextBlockStyle;
|
|
267
|
+
if (activeTextBlockStyle) {
|
|
268
268
|
var newType = value === "paragraph" ? "paragraph" : "heading-".concat(value);
|
|
269
|
-
var styleConfig =
|
|
270
|
-
return s.name ===
|
|
269
|
+
var styleConfig = textBlockStyles.find(function (s) {
|
|
270
|
+
return s.name === activeTextBlockStyle;
|
|
271
271
|
});
|
|
272
272
|
if (styleConfig !== null && styleConfig !== void 0 && styleConfig.appliesTo && !styleConfig.appliesTo.includes(newType)) {
|
|
273
273
|
var nodeType = value === "paragraph" ? "paragraph" : "heading";
|
|
274
274
|
editor.chain().updateAttributes(nodeType, {
|
|
275
|
-
|
|
275
|
+
textBlockStyle: null
|
|
276
276
|
}).run();
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
280
|
};
|
|
281
|
-
var
|
|
281
|
+
var handleTextBlockStyleChange = function handleTextBlockStyleChange(e) {
|
|
282
282
|
var value = e.target.value || null;
|
|
283
283
|
var nodeType = editor.isActive("heading") ? "heading" : "paragraph";
|
|
284
284
|
editor.chain().focus().updateAttributes(nodeType, {
|
|
285
|
-
|
|
285
|
+
textBlockStyle: value
|
|
286
286
|
}).run();
|
|
287
287
|
};
|
|
288
288
|
var handleInlineStyleChange = function handleInlineStyleChange(e) {
|
|
@@ -331,8 +331,8 @@ export var TipTapToolbar = function TipTapToolbar(_ref3) {
|
|
|
331
331
|
children: /*#__PURE__*/_jsx(FormControl, {
|
|
332
332
|
sx: selectFormControlSx,
|
|
333
333
|
children: /*#__PURE__*/_jsxs(Select, {
|
|
334
|
-
value: editorState.
|
|
335
|
-
onChange:
|
|
334
|
+
value: editorState.activeTextBlockType,
|
|
335
|
+
onChange: handleTextBlockTypeChange,
|
|
336
336
|
displayEmpty: true,
|
|
337
337
|
variant: "filled",
|
|
338
338
|
MenuProps: {
|
|
@@ -343,7 +343,7 @@ export var TipTapToolbar = function TipTapToolbar(_ref3) {
|
|
|
343
343
|
value: "paragraph",
|
|
344
344
|
dense: true,
|
|
345
345
|
children: /*#__PURE__*/_jsx(FormattedMessage, {
|
|
346
|
-
id: "comet.blocks.tipTapRichText.
|
|
346
|
+
id: "comet.blocks.tipTapRichText.textBlockType.default",
|
|
347
347
|
defaultMessage: "Default"
|
|
348
348
|
})
|
|
349
349
|
}), [1, 2, 3, 4, 5, 6].map(function (level) {
|
|
@@ -351,7 +351,7 @@ export var TipTapToolbar = function TipTapToolbar(_ref3) {
|
|
|
351
351
|
value: String(level),
|
|
352
352
|
dense: true,
|
|
353
353
|
children: /*#__PURE__*/_jsx(FormattedMessage, {
|
|
354
|
-
id: "comet.blocks.tipTapRichText.
|
|
354
|
+
id: "comet.blocks.tipTapRichText.textBlockType.heading",
|
|
355
355
|
defaultMessage: "Heading {level}",
|
|
356
356
|
values: {
|
|
357
357
|
level: level
|
|
@@ -361,12 +361,12 @@ export var TipTapToolbar = function TipTapToolbar(_ref3) {
|
|
|
361
361
|
})]
|
|
362
362
|
})
|
|
363
363
|
})
|
|
364
|
-
}),
|
|
364
|
+
}), applicableTextBlockStyles.length > 0 && /*#__PURE__*/_jsx(ToolbarGroup, {
|
|
365
365
|
children: /*#__PURE__*/_jsx(FormControl, {
|
|
366
366
|
sx: selectFormControlSx,
|
|
367
367
|
children: /*#__PURE__*/_jsxs(Select, {
|
|
368
|
-
value: editorState.
|
|
369
|
-
onChange:
|
|
368
|
+
value: editorState.activeTextBlockStyle,
|
|
369
|
+
onChange: handleTextBlockStyleChange,
|
|
370
370
|
displayEmpty: true,
|
|
371
371
|
variant: "filled",
|
|
372
372
|
MenuProps: {
|
|
@@ -377,10 +377,10 @@ export var TipTapToolbar = function TipTapToolbar(_ref3) {
|
|
|
377
377
|
value: "",
|
|
378
378
|
dense: true,
|
|
379
379
|
children: /*#__PURE__*/_jsx(FormattedMessage, {
|
|
380
|
-
id: "comet.blocks.tipTapRichText.
|
|
380
|
+
id: "comet.blocks.tipTapRichText.textBlockStyle.default",
|
|
381
381
|
defaultMessage: "Default"
|
|
382
382
|
})
|
|
383
|
-
}),
|
|
383
|
+
}), applicableTextBlockStyles.map(function (style) {
|
|
384
384
|
return /*#__PURE__*/_jsx(MenuItem, {
|
|
385
385
|
value: style.name,
|
|
386
386
|
dense: true,
|
|
@@ -2,25 +2,26 @@ import { type JSONContent } from "@tiptap/react";
|
|
|
2
2
|
import type { ComponentType, HTMLAttributes, ReactNode } from "react";
|
|
3
3
|
import { type BlockInterface, type LinkBlockInterface } from "../types";
|
|
4
4
|
export type TipTapSupports = "history" | "bold" | "italic" | "strike" | "sub" | "sup" | "heading" | "ordered-list" | "unordered-list" | "non-breaking-space" | "soft-hyphen" | "link";
|
|
5
|
-
export type
|
|
6
|
-
export
|
|
5
|
+
export type { JSONContent as TipTapRichTextBlockContent } from "@tiptap/core";
|
|
6
|
+
export type TipTapTextBlockType = "paragraph" | "heading-1" | "heading-2" | "heading-3" | "heading-4" | "heading-5" | "heading-6" | "ordered-list" | "unordered-list";
|
|
7
|
+
export interface TipTapTextBlockStyle {
|
|
7
8
|
name: string;
|
|
8
9
|
label: ReactNode;
|
|
9
10
|
/**
|
|
10
|
-
* Limits the block style to the provided block types.
|
|
11
|
-
* If none is specified, the block style is allowed for all block types.
|
|
11
|
+
* Limits the text block style to the provided text block types.
|
|
12
|
+
* If none is specified, the text block style is allowed for all text block types.
|
|
12
13
|
*/
|
|
13
|
-
appliesTo?:
|
|
14
|
+
appliesTo?: TipTapTextBlockType[];
|
|
14
15
|
element: ComponentType<HTMLAttributes<HTMLElement>>;
|
|
15
16
|
}
|
|
16
17
|
export interface TipTapInlineStyle {
|
|
17
18
|
name: string;
|
|
18
19
|
label: ReactNode;
|
|
19
20
|
/**
|
|
20
|
-
* Limits the inline style to the provided block types.
|
|
21
|
-
* If none is specified, the inline style is allowed for all block types.
|
|
21
|
+
* Limits the inline style to the provided text block types.
|
|
22
|
+
* If none is specified, the inline style is allowed for all text block types.
|
|
22
23
|
*/
|
|
23
|
-
appliesTo?:
|
|
24
|
+
appliesTo?: TipTapTextBlockType[];
|
|
24
25
|
element: ComponentType<HTMLAttributes<HTMLElement>>;
|
|
25
26
|
}
|
|
26
27
|
export interface TipTapRichTextBlockState {
|
|
@@ -38,15 +39,15 @@ export interface TipTapPlaceholder {
|
|
|
38
39
|
}
|
|
39
40
|
interface TipTapRichTextBlockFactoryOptions {
|
|
40
41
|
supports?: TipTapSupports[];
|
|
41
|
-
|
|
42
|
+
textBlockStyles?: TipTapTextBlockStyle[];
|
|
42
43
|
inlineStyles?: TipTapInlineStyle[];
|
|
43
44
|
placeholders?: TipTapPlaceholder[];
|
|
44
45
|
link?: BlockInterface & LinkBlockInterface;
|
|
45
46
|
/**
|
|
46
|
-
* Limits the maximum number of top-level blocks (paragraphs, headings, lists)
|
|
47
|
+
* Limits the maximum number of top-level text blocks (paragraphs, headings, lists)
|
|
47
48
|
* that can be created in the editor.
|
|
48
49
|
*/
|
|
49
|
-
|
|
50
|
+
maxTextBlocks?: number;
|
|
50
51
|
/**
|
|
51
52
|
* Limits the maximum nesting depth of list items.
|
|
52
53
|
* A value of 1 means only a flat list (no nesting), 2 allows one level of sub-lists, etc.
|
|
@@ -57,5 +58,4 @@ interface TipTapRichTextBlockFactoryOptions {
|
|
|
57
58
|
* @experimental
|
|
58
59
|
*/
|
|
59
60
|
export declare const createTipTapRichTextBlock: (options?: TipTapRichTextBlockFactoryOptions) => BlockInterface<TipTapRichTextBlockData, TipTapRichTextBlockState, TipTapRichTextBlockInput>;
|
|
60
|
-
export {};
|
|
61
61
|
//# sourceMappingURL=createTipTapRichTextBlock.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTipTapRichTextBlock.d.ts","sourceRoot":"","sources":["../../../src/blocks/tipTap/createTipTapRichTextBlock.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAiB,KAAK,WAAW,EAAa,MAAM,eAAe,CAAC;AAE3E,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAItE,OAAO,EAAiB,KAAK,cAAc,EAAE,KAAK,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAavF,MAAM,MAAM,cAAc,GACpB,SAAS,GACT,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,KAAK,GACL,KAAK,GACL,SAAS,GACT,cAAc,GACd,gBAAgB,GAChB,oBAAoB,GACpB,aAAa,GACb,MAAM,CAAC;AAgBb,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"createTipTapRichTextBlock.d.ts","sourceRoot":"","sources":["../../../src/blocks/tipTap/createTipTapRichTextBlock.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAiB,KAAK,WAAW,EAAa,MAAM,eAAe,CAAC;AAE3E,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAItE,OAAO,EAAiB,KAAK,cAAc,EAAE,KAAK,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAavF,MAAM,MAAM,cAAc,GACpB,SAAS,GACT,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,KAAK,GACL,KAAK,GACL,SAAS,GACT,cAAc,GACd,gBAAgB,GAChB,oBAAoB,GACpB,aAAa,GACb,MAAM,CAAC;AAgBb,YAAY,EAAE,WAAW,IAAI,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAE9E,MAAM,MAAM,mBAAmB,GACzB,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GACX,cAAc,GACd,gBAAgB,CAAC;AAEvB,MAAM,WAAW,oBAAoB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,SAAS,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAClC,OAAO,EAAE,aAAa,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,CAAC;CACvD;AAED,MAAM,WAAW,iBAAiB;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,SAAS,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAClC,OAAO,EAAE,aAAa,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,CAAC;CACvD;AAED,MAAM,WAAW,wBAAwB;IACrC,aAAa,EAAE,WAAW,CAAC;CAC9B;AAED,UAAU,uBAAuB;IAC7B,aAAa,EAAE,WAAW,CAAC;CAC9B;AAED,UAAU,wBAAwB;IAC9B,aAAa,EAAE,WAAW,CAAC;CAC9B;AAED,MAAM,WAAW,iBAAiB;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,SAAS,CAAC;CACpB;AAED,UAAU,iCAAiC;IACvC,QAAQ,CAAC,EAAE,cAAc,EAAE,CAAC;IAC5B,eAAe,CAAC,EAAE,oBAAoB,EAAE,CAAC;IACzC,YAAY,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACnC,YAAY,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACnC,IAAI,CAAC,EAAE,cAAc,GAAG,kBAAkB,CAAC;IAC3C;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAuMD;;GAEG;AACH,eAAO,MAAM,yBAAyB,GAClC,UAAU,iCAAiC,KAC5C,cAAc,CAAC,uBAAuB,EAAE,wBAAwB,EAAE,wBAAwB,CAyF5F,CAAC"}
|
|
@@ -25,16 +25,16 @@ import StarterKit from "@tiptap/starter-kit";
|
|
|
25
25
|
import { FormattedMessage } from "react-intl";
|
|
26
26
|
import { createBlockSkeleton } from "../helpers/createBlockSkeleton";
|
|
27
27
|
import { BlockCategory } from "../types";
|
|
28
|
-
import { BlockStyleContext } from "./BlockStyleContext";
|
|
29
|
-
import { BlockStyleHeading } from "./extensions/BlockStyleHeading";
|
|
30
|
-
import { BlockStyleParagraph } from "./extensions/BlockStyleParagraph";
|
|
31
28
|
import { CmsLink } from "./extensions/CmsLink";
|
|
32
29
|
import { InlineStyleMark } from "./extensions/InlineStyleMark";
|
|
33
30
|
import { NonBreakingSpace } from "./extensions/NonBreakingSpace";
|
|
34
31
|
import { Placeholder } from "./extensions/Placeholder";
|
|
35
32
|
import { SoftHyphen } from "./extensions/SoftHyphen";
|
|
33
|
+
import { TextBlockStyleHeading } from "./extensions/TextBlockStyleHeading";
|
|
34
|
+
import { TextBlockStyleParagraph } from "./extensions/TextBlockStyleParagraph";
|
|
36
35
|
import { InlineStyleContext } from "./InlineStyleContext";
|
|
37
36
|
import { createListLevelMaxExtension, getListNestingDepthFromJson, trimListNesting } from "./listLevelMaxHelpers";
|
|
37
|
+
import { TextBlockStyleContext } from "./TextBlockStyleContext";
|
|
38
38
|
import { TipTapToolbar } from "./TipTapToolbar";
|
|
39
39
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
40
40
|
var defaultSupports = ["history", "heading", "bold", "italic", "strike", "sub", "sup", "ordered-list", "unordered-list", "non-breaking-space", "soft-hyphen"];
|
|
@@ -65,19 +65,19 @@ var emptyContent = {
|
|
|
65
65
|
type: "paragraph"
|
|
66
66
|
}]
|
|
67
67
|
};
|
|
68
|
-
var
|
|
68
|
+
var createMaxTextBlocksExtension = function createMaxTextBlocksExtension(maxTextBlocks) {
|
|
69
69
|
return Extension.create({
|
|
70
|
-
name: "
|
|
70
|
+
name: "maxTextBlocks",
|
|
71
71
|
addKeyboardShortcuts: function addKeyboardShortcuts() {
|
|
72
72
|
return {
|
|
73
73
|
Enter: function Enter(_ref) {
|
|
74
74
|
var editor = _ref.editor;
|
|
75
|
-
if (editor.state.doc.childCount >=
|
|
76
|
-
// Only block Enter when it would create a new block (not inside a list, etc.)
|
|
75
|
+
if (editor.state.doc.childCount >= maxTextBlocks) {
|
|
76
|
+
// Only block Enter when it would create a new text block (not inside a list, etc.)
|
|
77
77
|
var $from = editor.state.selection.$from;
|
|
78
78
|
var isAtEndOfBlock = $from.parentOffset === $from.parent.content.size;
|
|
79
79
|
var parentDepth = $from.depth;
|
|
80
|
-
// If at end of a top-level block (depth 1) or would split a top-level block
|
|
80
|
+
// If at end of a top-level text block (depth 1) or would split a top-level text block
|
|
81
81
|
if (parentDepth === 1 && isAtEndOfBlock) {
|
|
82
82
|
return true; // prevent
|
|
83
83
|
}
|
|
@@ -198,13 +198,13 @@ var TipTapEditor = function TipTapEditor(_ref2) {
|
|
|
198
198
|
var state = _ref2.state,
|
|
199
199
|
updateState = _ref2.updateState,
|
|
200
200
|
supports = _ref2.supports,
|
|
201
|
-
|
|
201
|
+
textBlockStyles = _ref2.textBlockStyles,
|
|
202
202
|
inlineStyles = _ref2.inlineStyles,
|
|
203
203
|
placeholders = _ref2.placeholders,
|
|
204
204
|
linkBlock = _ref2.linkBlock,
|
|
205
|
-
|
|
205
|
+
maxTextBlocks = _ref2.maxTextBlocks,
|
|
206
206
|
listLevelMax = _ref2.listLevelMax;
|
|
207
|
-
var
|
|
207
|
+
var hasTextBlockStyles = textBlockStyles.length > 0;
|
|
208
208
|
var hasInlineStyles = inlineStyles.length > 0;
|
|
209
209
|
var hasLink = supports.includes("link") && !!linkBlock;
|
|
210
210
|
var hasPlaceholders = placeholders.length > 0;
|
|
@@ -213,29 +213,29 @@ var TipTapEditor = function TipTapEditor(_ref2) {
|
|
|
213
213
|
bold: supports.includes("bold") ? {} : false,
|
|
214
214
|
italic: supports.includes("italic") ? {} : false,
|
|
215
215
|
strike: supports.includes("strike") ? {} : false,
|
|
216
|
-
heading: supports.includes("heading") ?
|
|
217
|
-
paragraph:
|
|
216
|
+
heading: supports.includes("heading") ? hasTextBlockStyles ? false : {} : false,
|
|
217
|
+
paragraph: hasTextBlockStyles ? false : undefined,
|
|
218
218
|
orderedList: supports.includes("ordered-list") ? {} : false,
|
|
219
219
|
bulletList: supports.includes("unordered-list") ? {} : false,
|
|
220
220
|
blockquote: false,
|
|
221
221
|
code: false,
|
|
222
222
|
codeBlock: false,
|
|
223
223
|
link: false
|
|
224
|
-
})].concat(_toConsumableArray(
|
|
224
|
+
})].concat(_toConsumableArray(hasTextBlockStyles ? [TextBlockStyleParagraph] : []), _toConsumableArray(hasTextBlockStyles && supports.includes("heading") ? [TextBlockStyleHeading] : []), _toConsumableArray(hasInlineStyles ? [InlineStyleMark] : []), _toConsumableArray(supports.includes("sup") ? [Superscript] : []), _toConsumableArray(supports.includes("sub") ? [Subscript] : []), _toConsumableArray(supports.includes("non-breaking-space") ? [NonBreakingSpace] : []), _toConsumableArray(supports.includes("soft-hyphen") ? [SoftHyphen] : []), _toConsumableArray(hasPlaceholders ? [Placeholder] : []), _toConsumableArray(hasLink ? [CmsLink] : []), _toConsumableArray(maxTextBlocks !== undefined ? [createMaxTextBlocksExtension(maxTextBlocks)] : []), _toConsumableArray(listLevelMax !== undefined ? [createListLevelMaxExtension(listLevelMax)] : [])),
|
|
225
225
|
content: state.tipTapContent,
|
|
226
226
|
onUpdate: function onUpdate(_ref3) {
|
|
227
227
|
var editor = _ref3.editor;
|
|
228
|
-
if (
|
|
229
|
-
// Remove excess blocks (e.g. from paste)
|
|
228
|
+
if (maxTextBlocks !== undefined && editor.state.doc.childCount > maxTextBlocks) {
|
|
229
|
+
// Remove excess text blocks (e.g. from paste)
|
|
230
230
|
var tr = editor.state.tr;
|
|
231
231
|
var doc = editor.state.doc;
|
|
232
|
-
// Find the resolved position after the
|
|
232
|
+
// Find the resolved position after the maxTextBlocks-th child
|
|
233
233
|
var pos = 0;
|
|
234
|
-
for (var i = 0; i <
|
|
234
|
+
for (var i = 0; i < maxTextBlocks; i++) {
|
|
235
235
|
pos += doc.child(i).nodeSize;
|
|
236
236
|
}
|
|
237
237
|
// In ProseMirror, doc content positions are offset by 1 (for the doc open token)
|
|
238
|
-
// Delete from after the last allowed block to end of doc content
|
|
238
|
+
// Delete from after the last allowed text block to end of doc content
|
|
239
239
|
tr["delete"](pos + 1, doc.content.size + 1);
|
|
240
240
|
editor.view.dispatch(tr);
|
|
241
241
|
return;
|
|
@@ -258,8 +258,8 @@ var TipTapEditor = function TipTapEditor(_ref2) {
|
|
|
258
258
|
if (!editor) {
|
|
259
259
|
return null;
|
|
260
260
|
}
|
|
261
|
-
return /*#__PURE__*/_jsx(
|
|
262
|
-
value:
|
|
261
|
+
return /*#__PURE__*/_jsx(TextBlockStyleContext.Provider, {
|
|
262
|
+
value: textBlockStyles,
|
|
263
263
|
children: /*#__PURE__*/_jsx(InlineStyleContext.Provider, {
|
|
264
264
|
value: inlineStyles,
|
|
265
265
|
children: /*#__PURE__*/_jsxs(Box, {
|
|
@@ -272,7 +272,7 @@ var TipTapEditor = function TipTapEditor(_ref2) {
|
|
|
272
272
|
children: [/*#__PURE__*/_jsx(TipTapToolbar, {
|
|
273
273
|
editor: editor,
|
|
274
274
|
supports: supports,
|
|
275
|
-
|
|
275
|
+
textBlockStyles: textBlockStyles,
|
|
276
276
|
inlineStyles: inlineStyles,
|
|
277
277
|
placeholders: placeholders,
|
|
278
278
|
linkBlock: linkBlock,
|
|
@@ -298,13 +298,13 @@ var TipTapEditor = function TipTapEditor(_ref2) {
|
|
|
298
298
|
* @experimental
|
|
299
299
|
*/
|
|
300
300
|
export var createTipTapRichTextBlock = function createTipTapRichTextBlock(options) {
|
|
301
|
-
var _options$supports, _options$
|
|
301
|
+
var _options$supports, _options$textBlockSty, _options$inlineStyles, _options$placeholders;
|
|
302
302
|
var supports = (_options$supports = options === null || options === void 0 ? void 0 : options.supports) !== null && _options$supports !== void 0 ? _options$supports : defaultSupports;
|
|
303
|
-
var
|
|
303
|
+
var textBlockStyles = (_options$textBlockSty = options === null || options === void 0 ? void 0 : options.textBlockStyles) !== null && _options$textBlockSty !== void 0 ? _options$textBlockSty : [];
|
|
304
304
|
var inlineStyles = (_options$inlineStyles = options === null || options === void 0 ? void 0 : options.inlineStyles) !== null && _options$inlineStyles !== void 0 ? _options$inlineStyles : [];
|
|
305
305
|
var placeholders = (_options$placeholders = options === null || options === void 0 ? void 0 : options.placeholders) !== null && _options$placeholders !== void 0 ? _options$placeholders : [];
|
|
306
306
|
var linkBlock = options === null || options === void 0 ? void 0 : options.link;
|
|
307
|
-
var
|
|
307
|
+
var maxTextBlocks = options === null || options === void 0 ? void 0 : options.maxTextBlocks;
|
|
308
308
|
var listLevelMax = options === null || options === void 0 ? void 0 : options.listLevelMax;
|
|
309
309
|
|
|
310
310
|
// Auto-enable link support when a link block is provided
|
|
@@ -399,11 +399,11 @@ export var createTipTapRichTextBlock = function createTipTapRichTextBlock(option
|
|
|
399
399
|
state: state,
|
|
400
400
|
updateState: updateState,
|
|
401
401
|
supports: supports,
|
|
402
|
-
|
|
402
|
+
textBlockStyles: textBlockStyles,
|
|
403
403
|
inlineStyles: inlineStyles,
|
|
404
404
|
placeholders: placeholders,
|
|
405
405
|
linkBlock: linkBlock,
|
|
406
|
-
|
|
406
|
+
maxTextBlocks: maxTextBlocks,
|
|
407
407
|
listLevelMax: listLevelMax
|
|
408
408
|
});
|
|
409
409
|
},
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextBlockStyleHeading.d.ts","sourceRoot":"","sources":["../../../../src/blocks/tipTap/extensions/TextBlockStyleHeading.tsx"],"names":[],"mappings":"AA8BA,eAAO,MAAM,qBAAqB,sFAoBhC,CAAC"}
|
|
@@ -7,13 +7,13 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
7
7
|
import Heading from "@tiptap/extension-heading";
|
|
8
8
|
import { NodeViewContent, NodeViewWrapper, ReactNodeViewRenderer } from "@tiptap/react";
|
|
9
9
|
import { useContext } from "react";
|
|
10
|
-
import {
|
|
10
|
+
import { TextBlockStyleContext } from "../TextBlockStyleContext";
|
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
function
|
|
12
|
+
function TextBlockStyleHeadingView(_ref) {
|
|
13
13
|
var node = _ref.node;
|
|
14
|
-
var
|
|
15
|
-
var styleName = node.attrs.
|
|
16
|
-
var config = styleName ?
|
|
14
|
+
var textBlockStyles = useContext(TextBlockStyleContext);
|
|
15
|
+
var styleName = node.attrs.textBlockStyle;
|
|
16
|
+
var config = styleName ? textBlockStyles.find(function (s) {
|
|
17
17
|
return s.name === styleName;
|
|
18
18
|
}) : undefined;
|
|
19
19
|
var tag = "h".concat(node.attrs.level);
|
|
@@ -21,7 +21,7 @@ function BlockStyleHeadingView(_ref) {
|
|
|
21
21
|
var Element = config.element;
|
|
22
22
|
return /*#__PURE__*/_jsx(NodeViewWrapper, {
|
|
23
23
|
children: /*#__PURE__*/_jsx(Element, {
|
|
24
|
-
"data-block-style": styleName,
|
|
24
|
+
"data-text-block-style": styleName,
|
|
25
25
|
children: /*#__PURE__*/_jsx(NodeViewContent, {})
|
|
26
26
|
})
|
|
27
27
|
});
|
|
@@ -31,27 +31,27 @@ function BlockStyleHeadingView(_ref) {
|
|
|
31
31
|
children: /*#__PURE__*/_jsx(NodeViewContent, {})
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
|
-
export var
|
|
34
|
+
export var TextBlockStyleHeading = Heading.extend({
|
|
35
35
|
addAttributes: function addAttributes() {
|
|
36
36
|
var _this$parent;
|
|
37
37
|
return _objectSpread(_objectSpread({}, (_this$parent = this.parent) === null || _this$parent === void 0 ? void 0 : _this$parent.call(this)), {}, {
|
|
38
|
-
|
|
38
|
+
textBlockStyle: {
|
|
39
39
|
"default": null,
|
|
40
40
|
parseHTML: function parseHTML(element) {
|
|
41
|
-
return element.getAttribute("data-block-style");
|
|
41
|
+
return element.getAttribute("data-text-block-style");
|
|
42
42
|
},
|
|
43
43
|
renderHTML: function renderHTML(attributes) {
|
|
44
|
-
if (!attributes.
|
|
44
|
+
if (!attributes.textBlockStyle) {
|
|
45
45
|
return {};
|
|
46
46
|
}
|
|
47
47
|
return {
|
|
48
|
-
"data-block-style": attributes.
|
|
48
|
+
"data-text-block-style": attributes.textBlockStyle
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
});
|
|
53
53
|
},
|
|
54
54
|
addNodeView: function addNodeView() {
|
|
55
|
-
return ReactNodeViewRenderer(
|
|
55
|
+
return ReactNodeViewRenderer(TextBlockStyleHeadingView);
|
|
56
56
|
}
|
|
57
57
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextBlockStyleParagraph.d.ts","sourceRoot":"","sources":["../../../../src/blocks/tipTap/extensions/TextBlockStyleParagraph.tsx"],"names":[],"mappings":"AA6BA,eAAO,MAAM,uBAAuB,0FAoBlC,CAAC"}
|
|
@@ -7,20 +7,20 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
7
7
|
import Paragraph from "@tiptap/extension-paragraph";
|
|
8
8
|
import { NodeViewContent, NodeViewWrapper, ReactNodeViewRenderer } from "@tiptap/react";
|
|
9
9
|
import { useContext } from "react";
|
|
10
|
-
import {
|
|
10
|
+
import { TextBlockStyleContext } from "../TextBlockStyleContext";
|
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
function
|
|
12
|
+
function TextBlockStyleParagraphView(_ref) {
|
|
13
13
|
var node = _ref.node;
|
|
14
|
-
var
|
|
15
|
-
var styleName = node.attrs.
|
|
16
|
-
var config = styleName ?
|
|
14
|
+
var textBlockStyles = useContext(TextBlockStyleContext);
|
|
15
|
+
var styleName = node.attrs.textBlockStyle;
|
|
16
|
+
var config = styleName ? textBlockStyles.find(function (s) {
|
|
17
17
|
return s.name === styleName;
|
|
18
18
|
}) : undefined;
|
|
19
19
|
if (config) {
|
|
20
20
|
var Element = config.element;
|
|
21
21
|
return /*#__PURE__*/_jsx(NodeViewWrapper, {
|
|
22
22
|
children: /*#__PURE__*/_jsx(Element, {
|
|
23
|
-
"data-block-style": styleName,
|
|
23
|
+
"data-text-block-style": styleName,
|
|
24
24
|
children: /*#__PURE__*/_jsx(NodeViewContent, {})
|
|
25
25
|
})
|
|
26
26
|
});
|
|
@@ -30,27 +30,27 @@ function BlockStyleParagraphView(_ref) {
|
|
|
30
30
|
children: /*#__PURE__*/_jsx(NodeViewContent, {})
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
|
-
export var
|
|
33
|
+
export var TextBlockStyleParagraph = Paragraph.extend({
|
|
34
34
|
addAttributes: function addAttributes() {
|
|
35
35
|
var _this$parent;
|
|
36
36
|
return _objectSpread(_objectSpread({}, (_this$parent = this.parent) === null || _this$parent === void 0 ? void 0 : _this$parent.call(this)), {}, {
|
|
37
|
-
|
|
37
|
+
textBlockStyle: {
|
|
38
38
|
"default": null,
|
|
39
39
|
parseHTML: function parseHTML(element) {
|
|
40
|
-
return element.getAttribute("data-block-style");
|
|
40
|
+
return element.getAttribute("data-text-block-style");
|
|
41
41
|
},
|
|
42
42
|
renderHTML: function renderHTML(attributes) {
|
|
43
|
-
if (!attributes.
|
|
43
|
+
if (!attributes.textBlockStyle) {
|
|
44
44
|
return {};
|
|
45
45
|
}
|
|
46
46
|
return {
|
|
47
|
-
"data-block-style": attributes.
|
|
47
|
+
"data-text-block-style": attributes.textBlockStyle
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
52
|
},
|
|
53
53
|
addNodeView: function addNodeView() {
|
|
54
|
-
return ReactNodeViewRenderer(
|
|
54
|
+
return ReactNodeViewRenderer(TextBlockStyleParagraphView);
|
|
55
55
|
}
|
|
56
56
|
});
|
|
@@ -54,6 +54,7 @@ export interface EmailLinkBlockData {
|
|
|
54
54
|
export interface ExternalLinkBlockData {
|
|
55
55
|
targetUrl?: string;
|
|
56
56
|
openInNewWindow: boolean;
|
|
57
|
+
noFollow: boolean;
|
|
57
58
|
}
|
|
58
59
|
export interface InternalLinkBlockData {
|
|
59
60
|
targetPageAnchor?: string;
|
|
@@ -216,6 +217,7 @@ export interface EmailLinkBlockInput {
|
|
|
216
217
|
export interface ExternalLinkBlockInput {
|
|
217
218
|
targetUrl?: string;
|
|
218
219
|
openInNewWindow: boolean;
|
|
220
|
+
noFollow: boolean;
|
|
219
221
|
}
|
|
220
222
|
export interface InternalLinkBlockInput {
|
|
221
223
|
targetPageId?: string;
|