@contentful/field-editor-rich-text 4.5.0 → 4.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/RichTextEditor.js +11 -11
- package/dist/cjs/SdkProvider.js +2 -1
- package/dist/cjs/Toolbar/_tests_/toolbar.test.js +12 -12
- package/dist/cjs/Toolbar/components/ButtonRedo.js +3 -3
- package/dist/cjs/Toolbar/components/ButtonUndo.js +3 -3
- package/dist/cjs/Toolbar/components/EmbedEntityWidget.js +6 -6
- package/dist/cjs/Toolbar/components/EmbeddedEntityDropdownButton.js +5 -5
- package/dist/cjs/Toolbar/components/StickyToolbarWrapper.js +1 -1
- package/dist/cjs/Toolbar/index.js +28 -28
- package/dist/cjs/dialogs/HypelinkDialog/HyperlinkDialog.js +20 -20
- package/dist/cjs/dialogs/openRichTextDialog.js +1 -1
- package/dist/cjs/dialogs/renderRichTextDialog.js +2 -2
- package/dist/cjs/helpers/__tests__/removeInternalMarks.test.js +8 -8
- package/dist/cjs/plugins/Break/createExitBreakPlugin.test.js +1 -1
- package/dist/cjs/plugins/Break/createSoftBreakPlugin.test.js +1 -1
- package/dist/cjs/plugins/CommandPalette/components/CommandList.js +26 -26
- package/dist/cjs/plugins/CommandPalette/components/CommandPrompt.js +2 -2
- package/dist/cjs/plugins/EmbeddedEntityBlock/LinkedEntityBlock.js +3 -3
- package/dist/cjs/plugins/EmbeddedEntityInline/FetchingWrappedInlineEntryCard.js +11 -11
- package/dist/cjs/plugins/EmbeddedEntityInline/LinkedEntityInline.js +2 -2
- package/dist/cjs/plugins/EmbeddedResourceBlock/LinkedResourceBlock.js +2 -2
- package/dist/cjs/plugins/EmbeddedResourceInline/FetchingWrappedResourceInlineCard.js +5 -5
- package/dist/cjs/plugins/EmbeddedResourceInline/LinkedResourceInline.js +2 -2
- package/dist/cjs/plugins/Heading/__tests__/createHeadingPlugin.test.js +31 -31
- package/dist/cjs/plugins/Heading/components/Heading.js +7 -7
- package/dist/cjs/plugins/Heading/components/ToolbarHeadingButton.js +6 -6
- package/dist/cjs/plugins/Hr/index.js +5 -5
- package/dist/cjs/plugins/Hyperlink/HyperlinkModal.js +19 -19
- package/dist/cjs/plugins/Hyperlink/__tests__/createHyperlinkPlugin.test.js +7 -7
- package/dist/cjs/plugins/Hyperlink/components/EntityHyperlink.js +3 -3
- package/dist/cjs/plugins/Hyperlink/components/LinkPopover.js +13 -13
- package/dist/cjs/plugins/Hyperlink/components/ResourceHyperlink.js +3 -3
- package/dist/cjs/plugins/Hyperlink/components/ToolbarHyperlinkButton.js +2 -2
- package/dist/cjs/plugins/Hyperlink/components/UrlHyperlink.js +3 -3
- package/dist/cjs/plugins/List/__tests__/createListPlugin.test.js +12 -12
- package/dist/cjs/plugins/List/__tests__/insertListBreak.test.js +23 -23
- package/dist/cjs/plugins/List/__tests__/insertListFragment.test.js +20 -20
- package/dist/cjs/plugins/List/components/List.js +1 -1
- package/dist/cjs/plugins/List/components/ListItem.js +1 -1
- package/dist/cjs/plugins/List/components/ToolbarListButton.js +3 -3
- package/dist/cjs/plugins/List/transforms/moveListItems.test.js +12 -12
- package/dist/cjs/plugins/List/transforms/toggleList.spec.js +18 -18
- package/dist/cjs/plugins/Marks/Bold.js +2 -2
- package/dist/cjs/plugins/Marks/Code.js +2 -2
- package/dist/cjs/plugins/Marks/Italic.js +2 -2
- package/dist/cjs/plugins/Marks/Strikethrough.js +6 -6
- package/dist/cjs/plugins/Marks/Subscript.js +4 -4
- package/dist/cjs/plugins/Marks/Superscript.js +4 -4
- package/dist/cjs/plugins/Marks/Underline.js +2 -2
- package/dist/cjs/plugins/Marks/components/MarkToolbarButton.js +2 -2
- package/dist/cjs/plugins/Normalizer/createNormalizerPlugin.test.js +8 -8
- package/dist/cjs/plugins/Paragraph/Paragraph.js +1 -1
- package/dist/cjs/plugins/Paragraph/__tests__/createParagraphPlugin.test.js +31 -31
- package/dist/cjs/plugins/Quote/__test__/createQuotePlugin.test.js +20 -20
- package/dist/cjs/plugins/Quote/components/Quote.js +1 -1
- package/dist/cjs/plugins/Quote/components/ToolbarQuoteButton.js +2 -2
- package/dist/cjs/plugins/Table/__tests__/createTablePlugin.test.js +21 -21
- package/dist/cjs/plugins/Table/__tests__/helpers.test.js +2 -2
- package/dist/cjs/plugins/Table/components/Cell.js +2 -2
- package/dist/cjs/plugins/Table/components/HeaderCell.js +2 -2
- package/dist/cjs/plugins/Table/components/Row.js +1 -1
- package/dist/cjs/plugins/Table/components/Table.js +3 -3
- package/dist/cjs/plugins/Table/components/TableActions.js +11 -11
- package/dist/cjs/plugins/Table/components/ToolbarButton.js +2 -2
- package/dist/cjs/plugins/Text/__tests__/createTextPlugin.test.js +14 -14
- package/dist/cjs/plugins/shared/EmbeddedBlockToolbarIcon.js +4 -4
- package/dist/cjs/plugins/shared/EmbeddedInlineToolbarIcon.js +4 -4
- package/dist/cjs/plugins/shared/FetchingWrappedAssetCard.js +6 -6
- package/dist/cjs/plugins/shared/FetchingWrappedEntryCard.js +6 -6
- package/dist/cjs/plugins/shared/FetchingWrappedResourceCard.js +6 -6
- package/dist/cjs/plugins/shared/LinkedBlockWrapper.js +2 -2
- package/dist/cjs/plugins/shared/LinkedInlineWrapper.js +2 -2
- package/dist/cjs/plugins/shared/ResourceNewBadge.js +1 -1
- package/dist/cjs/plugins/shared/ToolbarButton.js +2 -2
- package/dist/cjs/plugins/shared/__tests__/FetchingWrappedAssetCard.test.js +2 -2
- package/dist/cjs/plugins/shared/__tests__/FetchingWrappedEntryCard.test.js +2 -2
- package/dist/cjs/plugins/shared/__tests__/FetchingWrappedResourceCard.test.js +2 -2
- package/dist/esm/RichTextEditor.js +11 -11
- package/dist/esm/SdkProvider.js +2 -1
- package/dist/esm/Toolbar/_tests_/toolbar.test.js +12 -12
- package/dist/esm/Toolbar/components/ButtonRedo.js +3 -3
- package/dist/esm/Toolbar/components/ButtonUndo.js +3 -3
- package/dist/esm/Toolbar/components/EmbedEntityWidget.js +6 -6
- package/dist/esm/Toolbar/components/EmbeddedEntityDropdownButton.js +5 -5
- package/dist/esm/Toolbar/components/StickyToolbarWrapper.js +1 -1
- package/dist/esm/Toolbar/index.js +30 -30
- package/dist/esm/dialogs/HypelinkDialog/HyperlinkDialog.js +20 -20
- package/dist/esm/dialogs/openRichTextDialog.js +1 -1
- package/dist/esm/dialogs/renderRichTextDialog.js +2 -2
- package/dist/esm/helpers/__tests__/removeInternalMarks.test.js +8 -8
- package/dist/esm/plugins/Break/createExitBreakPlugin.test.js +1 -1
- package/dist/esm/plugins/Break/createSoftBreakPlugin.test.js +1 -1
- package/dist/esm/plugins/CommandPalette/components/CommandList.js +26 -26
- package/dist/esm/plugins/CommandPalette/components/CommandPrompt.js +2 -2
- package/dist/esm/plugins/EmbeddedEntityBlock/LinkedEntityBlock.js +3 -3
- package/dist/esm/plugins/EmbeddedEntityInline/FetchingWrappedInlineEntryCard.js +11 -11
- package/dist/esm/plugins/EmbeddedEntityInline/LinkedEntityInline.js +2 -2
- package/dist/esm/plugins/EmbeddedResourceBlock/LinkedResourceBlock.js +2 -2
- package/dist/esm/plugins/EmbeddedResourceInline/FetchingWrappedResourceInlineCard.js +5 -5
- package/dist/esm/plugins/EmbeddedResourceInline/LinkedResourceInline.js +2 -2
- package/dist/esm/plugins/Heading/__tests__/createHeadingPlugin.test.js +31 -31
- package/dist/esm/plugins/Heading/components/Heading.js +7 -7
- package/dist/esm/plugins/Heading/components/ToolbarHeadingButton.js +6 -6
- package/dist/esm/plugins/Hr/index.js +5 -5
- package/dist/esm/plugins/Hyperlink/HyperlinkModal.js +19 -19
- package/dist/esm/plugins/Hyperlink/__tests__/createHyperlinkPlugin.test.js +7 -7
- package/dist/esm/plugins/Hyperlink/components/EntityHyperlink.js +3 -3
- package/dist/esm/plugins/Hyperlink/components/LinkPopover.js +13 -13
- package/dist/esm/plugins/Hyperlink/components/ResourceHyperlink.js +3 -3
- package/dist/esm/plugins/Hyperlink/components/ToolbarHyperlinkButton.js +2 -2
- package/dist/esm/plugins/Hyperlink/components/UrlHyperlink.js +3 -3
- package/dist/esm/plugins/List/__tests__/createListPlugin.test.js +12 -12
- package/dist/esm/plugins/List/__tests__/insertListBreak.test.js +23 -23
- package/dist/esm/plugins/List/__tests__/insertListFragment.test.js +20 -20
- package/dist/esm/plugins/List/components/List.js +1 -1
- package/dist/esm/plugins/List/components/ListItem.js +1 -1
- package/dist/esm/plugins/List/components/ToolbarListButton.js +3 -3
- package/dist/esm/plugins/List/transforms/moveListItems.test.js +12 -12
- package/dist/esm/plugins/List/transforms/toggleList.spec.js +18 -18
- package/dist/esm/plugins/Marks/Bold.js +2 -2
- package/dist/esm/plugins/Marks/Code.js +2 -2
- package/dist/esm/plugins/Marks/Italic.js +2 -2
- package/dist/esm/plugins/Marks/Strikethrough.js +6 -6
- package/dist/esm/plugins/Marks/Subscript.js +4 -4
- package/dist/esm/plugins/Marks/Superscript.js +4 -4
- package/dist/esm/plugins/Marks/Underline.js +2 -2
- package/dist/esm/plugins/Marks/components/MarkToolbarButton.js +2 -2
- package/dist/esm/plugins/Marks/index.js +2 -2
- package/dist/esm/plugins/Normalizer/createNormalizerPlugin.test.js +8 -8
- package/dist/esm/plugins/Paragraph/Paragraph.js +1 -1
- package/dist/esm/plugins/Paragraph/__tests__/createParagraphPlugin.test.js +31 -31
- package/dist/esm/plugins/Quote/__test__/createQuotePlugin.test.js +20 -20
- package/dist/esm/plugins/Quote/components/Quote.js +1 -1
- package/dist/esm/plugins/Quote/components/ToolbarQuoteButton.js +2 -2
- package/dist/esm/plugins/Table/__tests__/createTablePlugin.test.js +21 -21
- package/dist/esm/plugins/Table/__tests__/helpers.test.js +2 -2
- package/dist/esm/plugins/Table/components/Cell.js +2 -2
- package/dist/esm/plugins/Table/components/HeaderCell.js +2 -2
- package/dist/esm/plugins/Table/components/Row.js +1 -1
- package/dist/esm/plugins/Table/components/Table.js +3 -3
- package/dist/esm/plugins/Table/components/TableActions.js +11 -11
- package/dist/esm/plugins/Table/components/ToolbarButton.js +2 -2
- package/dist/esm/plugins/Text/__tests__/createTextPlugin.test.js +14 -14
- package/dist/esm/plugins/shared/EmbeddedBlockToolbarIcon.js +4 -4
- package/dist/esm/plugins/shared/EmbeddedInlineToolbarIcon.js +4 -4
- package/dist/esm/plugins/shared/FetchingWrappedAssetCard.js +6 -6
- package/dist/esm/plugins/shared/FetchingWrappedEntryCard.js +6 -6
- package/dist/esm/plugins/shared/FetchingWrappedResourceCard.js +6 -6
- package/dist/esm/plugins/shared/LinkedBlockWrapper.js +2 -2
- package/dist/esm/plugins/shared/LinkedInlineWrapper.js +2 -2
- package/dist/esm/plugins/shared/ResourceNewBadge.js +1 -1
- package/dist/esm/plugins/shared/ToolbarButton.js +2 -2
- package/dist/esm/plugins/shared/__tests__/FetchingWrappedAssetCard.test.js +2 -2
- package/dist/esm/plugins/shared/__tests__/FetchingWrappedEntryCard.test.js +2 -2
- package/dist/esm/plugins/shared/__tests__/FetchingWrappedResourceCard.test.js +2 -2
- package/dist/esm/test-utils/jsx.js +1 -1
- package/package.json +6 -4
|
@@ -5,16 +5,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
const _testutils = require("../../../test-utils");
|
|
6
6
|
describe('normalization', ()=>{
|
|
7
7
|
it('can contain inline entries & hyperlinks', ()=>{
|
|
8
|
-
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hp", null, "some text before", (0, _testutils.jsx)("hinline", {
|
|
8
|
+
const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "some text before", /*#__PURE__*/ (0, _testutils.jsx)("hinline", {
|
|
9
9
|
type: "Entry",
|
|
10
10
|
id: "inline-entry"
|
|
11
|
-
}), (0, _testutils.jsx)("hlink", {
|
|
11
|
+
}), /*#__PURE__*/ (0, _testutils.jsx)("hlink", {
|
|
12
12
|
uri: "https://contentful.com"
|
|
13
|
-
}), (0, _testutils.jsx)("hlink", {
|
|
13
|
+
}), /*#__PURE__*/ (0, _testutils.jsx)("hlink", {
|
|
14
14
|
entry: "entry-id"
|
|
15
|
-
}), (0, _testutils.jsx)("hlink", {
|
|
15
|
+
}), /*#__PURE__*/ (0, _testutils.jsx)("hlink", {
|
|
16
16
|
resource: "resource-urn"
|
|
17
|
-
}), (0, _testutils.jsx)("hlink", {
|
|
17
|
+
}), /*#__PURE__*/ (0, _testutils.jsx)("hlink", {
|
|
18
18
|
asset: "asset-id"
|
|
19
19
|
}), "some text after"));
|
|
20
20
|
(0, _testutils.assertOutput)({
|
|
@@ -23,20 +23,20 @@ describe('normalization', ()=>{
|
|
|
23
23
|
});
|
|
24
24
|
});
|
|
25
25
|
it('wraps orphaned text nodes in a paragraph', ()=>{
|
|
26
|
-
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hp", null, "valid text"), (0, _testutils.jsx)("hh1", null, "valid text"), (0, _testutils.jsx)("htable", null, (0, _testutils.jsx)("htr", null, (0, _testutils.jsx)("htd", null, "invalid text"))));
|
|
27
|
-
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hp", null, "valid text"), (0, _testutils.jsx)("hh1", null, "valid text"), (0, _testutils.jsx)("htable", null, (0, _testutils.jsx)("htr", null, (0, _testutils.jsx)("htd", null, (0, _testutils.jsx)("hp", null, "invalid text")))), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
|
|
26
|
+
const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "valid text"), /*#__PURE__*/ (0, _testutils.jsx)("hh1", null, "valid text"), /*#__PURE__*/ (0, _testutils.jsx)("htable", null, /*#__PURE__*/ (0, _testutils.jsx)("htr", null, /*#__PURE__*/ (0, _testutils.jsx)("htd", null, "invalid text"))));
|
|
27
|
+
const expected = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "valid text"), /*#__PURE__*/ (0, _testutils.jsx)("hh1", null, "valid text"), /*#__PURE__*/ (0, _testutils.jsx)("htable", null, /*#__PURE__*/ (0, _testutils.jsx)("htr", null, /*#__PURE__*/ (0, _testutils.jsx)("htd", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "invalid text")))), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null)));
|
|
28
28
|
(0, _testutils.assertOutput)({
|
|
29
29
|
input,
|
|
30
30
|
expected
|
|
31
31
|
});
|
|
32
32
|
});
|
|
33
33
|
it('unwraps nested paragraphs', ()=>{
|
|
34
|
-
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hp", null, "some", (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", {
|
|
34
|
+
const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "some", /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", {
|
|
35
35
|
bold: true,
|
|
36
36
|
italic: true,
|
|
37
37
|
underline: true
|
|
38
38
|
}, "paragraph")), "text"));
|
|
39
|
-
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hp", null, "some", (0, _testutils.jsx)("htext", {
|
|
39
|
+
const expected = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "some", /*#__PURE__*/ (0, _testutils.jsx)("htext", {
|
|
40
40
|
bold: true,
|
|
41
41
|
italic: true,
|
|
42
42
|
underline: true
|
|
@@ -48,76 +48,76 @@ describe('normalization', ()=>{
|
|
|
48
48
|
});
|
|
49
49
|
describe('lifts other invalid children', ()=>{
|
|
50
50
|
it('block void elements', ()=>{
|
|
51
|
-
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("hembed", {
|
|
51
|
+
const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("hembed", {
|
|
52
52
|
type: "Asset",
|
|
53
53
|
id: "1"
|
|
54
|
-
}), " start"), (0, _testutils.jsx)("hp", null, "end ", (0, _testutils.jsx)("hembed", {
|
|
54
|
+
}), " start"), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "end ", /*#__PURE__*/ (0, _testutils.jsx)("hembed", {
|
|
55
55
|
type: "Asset",
|
|
56
56
|
id: "2"
|
|
57
|
-
})), (0, _testutils.jsx)("hp", null, "in ", (0, _testutils.jsx)("hembed", {
|
|
57
|
+
})), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "in ", /*#__PURE__*/ (0, _testutils.jsx)("hembed", {
|
|
58
58
|
type: "Asset",
|
|
59
59
|
id: "3"
|
|
60
|
-
}), " between"), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("hembed", {
|
|
60
|
+
}), " between"), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("hembed", {
|
|
61
61
|
type: "Entry",
|
|
62
62
|
id: "1"
|
|
63
|
-
}), " start"), (0, _testutils.jsx)("hp", null, "end ", (0, _testutils.jsx)("hembed", {
|
|
63
|
+
}), " start"), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "end ", /*#__PURE__*/ (0, _testutils.jsx)("hembed", {
|
|
64
64
|
type: "Entry",
|
|
65
65
|
id: "2"
|
|
66
|
-
})), (0, _testutils.jsx)("hp", null, "in ", (0, _testutils.jsx)("hembed", {
|
|
66
|
+
})), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "in ", /*#__PURE__*/ (0, _testutils.jsx)("hembed", {
|
|
67
67
|
type: "Entry",
|
|
68
68
|
id: "3"
|
|
69
|
-
}), " between"), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("hhr", null), " start"), (0, _testutils.jsx)("hp", null, "end ", (0, _testutils.jsx)("hhr", null)), (0, _testutils.jsx)("hp", null, "in ", (0, _testutils.jsx)("hhr", null), " between"));
|
|
70
|
-
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hembed", {
|
|
69
|
+
}), " between"), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("hhr", null), " start"), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "end ", /*#__PURE__*/ (0, _testutils.jsx)("hhr", null)), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "in ", /*#__PURE__*/ (0, _testutils.jsx)("hhr", null), " between"));
|
|
70
|
+
const expected = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hembed", {
|
|
71
71
|
type: "Asset",
|
|
72
72
|
id: "1"
|
|
73
|
-
}), (0, _testutils.jsx)("hp", null, " start"), (0, _testutils.jsx)("hp", null, "end "), (0, _testutils.jsx)("hembed", {
|
|
73
|
+
}), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, " start"), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "end "), /*#__PURE__*/ (0, _testutils.jsx)("hembed", {
|
|
74
74
|
type: "Asset",
|
|
75
75
|
id: "2"
|
|
76
|
-
}), (0, _testutils.jsx)("hp", null, "in "), (0, _testutils.jsx)("hembed", {
|
|
76
|
+
}), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "in "), /*#__PURE__*/ (0, _testutils.jsx)("hembed", {
|
|
77
77
|
type: "Asset",
|
|
78
78
|
id: "3"
|
|
79
|
-
}), (0, _testutils.jsx)("hp", null, " between"), (0, _testutils.jsx)("hembed", {
|
|
79
|
+
}), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, " between"), /*#__PURE__*/ (0, _testutils.jsx)("hembed", {
|
|
80
80
|
type: "Entry",
|
|
81
81
|
id: "1"
|
|
82
|
-
}), (0, _testutils.jsx)("hp", null, " start"), (0, _testutils.jsx)("hp", null, "end "), (0, _testutils.jsx)("hembed", {
|
|
82
|
+
}), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, " start"), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "end "), /*#__PURE__*/ (0, _testutils.jsx)("hembed", {
|
|
83
83
|
type: "Entry",
|
|
84
84
|
id: "2"
|
|
85
|
-
}), (0, _testutils.jsx)("hp", null, "in "), (0, _testutils.jsx)("hembed", {
|
|
85
|
+
}), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "in "), /*#__PURE__*/ (0, _testutils.jsx)("hembed", {
|
|
86
86
|
type: "Entry",
|
|
87
87
|
id: "3"
|
|
88
|
-
}), (0, _testutils.jsx)("hp", null, " between"), (0, _testutils.jsx)("hhr", null), (0, _testutils.jsx)("hp", null, " start"), (0, _testutils.jsx)("hp", null, "end "), (0, _testutils.jsx)("hhr", null), (0, _testutils.jsx)("hp", null, "in "), (0, _testutils.jsx)("hhr", null), (0, _testutils.jsx)("hp", null, " between"));
|
|
88
|
+
}), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, " between"), /*#__PURE__*/ (0, _testutils.jsx)("hhr", null), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, " start"), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "end "), /*#__PURE__*/ (0, _testutils.jsx)("hhr", null), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "in "), /*#__PURE__*/ (0, _testutils.jsx)("hhr", null), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, " between"));
|
|
89
89
|
(0, _testutils.assertOutput)({
|
|
90
90
|
input,
|
|
91
91
|
expected
|
|
92
92
|
});
|
|
93
93
|
});
|
|
94
94
|
it('handles heading', ()=>{
|
|
95
|
-
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hp", null, "some", (0, _testutils.jsx)("hh1", null, "heading"), "text"));
|
|
96
|
-
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hp", null, "some"), (0, _testutils.jsx)("hh1", null, "heading"), (0, _testutils.jsx)("hp", null, "text"));
|
|
95
|
+
const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "some", /*#__PURE__*/ (0, _testutils.jsx)("hh1", null, "heading"), "text"));
|
|
96
|
+
const expected = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "some"), /*#__PURE__*/ (0, _testutils.jsx)("hh1", null, "heading"), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "text"));
|
|
97
97
|
(0, _testutils.assertOutput)({
|
|
98
98
|
input,
|
|
99
99
|
expected
|
|
100
100
|
});
|
|
101
101
|
});
|
|
102
102
|
it('handles quotes', ()=>{
|
|
103
|
-
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hp", null, "some", (0, _testutils.jsx)("hquote", null, (0, _testutils.jsx)("hp", null, "quote")), "text"));
|
|
104
|
-
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hp", null, "some"), (0, _testutils.jsx)("hquote", null, (0, _testutils.jsx)("hp", null, "quote")), (0, _testutils.jsx)("hp", null, "text"));
|
|
103
|
+
const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "some", /*#__PURE__*/ (0, _testutils.jsx)("hquote", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "quote")), "text"));
|
|
104
|
+
const expected = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "some"), /*#__PURE__*/ (0, _testutils.jsx)("hquote", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "quote")), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "text"));
|
|
105
105
|
(0, _testutils.assertOutput)({
|
|
106
106
|
input,
|
|
107
107
|
expected
|
|
108
108
|
});
|
|
109
109
|
});
|
|
110
110
|
it('handles lists', ()=>{
|
|
111
|
-
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hp", null, "some", (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "list item"))), "text"));
|
|
112
|
-
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hp", null, "some"), (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "list item"))), (0, _testutils.jsx)("hp", null, "text"));
|
|
111
|
+
const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "some", /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "list item"))), "text"));
|
|
112
|
+
const expected = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "some"), /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "list item"))), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "text"));
|
|
113
113
|
(0, _testutils.assertOutput)({
|
|
114
114
|
input,
|
|
115
115
|
expected
|
|
116
116
|
});
|
|
117
117
|
});
|
|
118
118
|
it('handles tables', ()=>{
|
|
119
|
-
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hp", null, "some", (0, _testutils.jsx)("htable", null, (0, _testutils.jsx)("htr", null, (0, _testutils.jsx)("htd", null, (0, _testutils.jsx)("hp", null, "cell 1")), (0, _testutils.jsx)("htd", null, (0, _testutils.jsx)("hp", null, "cell 2")))), "text"));
|
|
120
|
-
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hp", null, "some"), (0, _testutils.jsx)("htable", null, (0, _testutils.jsx)("htr", null, (0, _testutils.jsx)("htd", null, (0, _testutils.jsx)("hp", null, "cell 1")), (0, _testutils.jsx)("htd", null, (0, _testutils.jsx)("hp", null, "cell 2")))), (0, _testutils.jsx)("hp", null, "text"));
|
|
119
|
+
const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "some", /*#__PURE__*/ (0, _testutils.jsx)("htable", null, /*#__PURE__*/ (0, _testutils.jsx)("htr", null, /*#__PURE__*/ (0, _testutils.jsx)("htd", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "cell 1")), /*#__PURE__*/ (0, _testutils.jsx)("htd", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "cell 2")))), "text"));
|
|
120
|
+
const expected = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "some"), /*#__PURE__*/ (0, _testutils.jsx)("htable", null, /*#__PURE__*/ (0, _testutils.jsx)("htr", null, /*#__PURE__*/ (0, _testutils.jsx)("htd", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "cell 1")), /*#__PURE__*/ (0, _testutils.jsx)("htd", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "cell 2")))), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "text"));
|
|
121
121
|
(0, _testutils.assertOutput)({
|
|
122
122
|
input,
|
|
123
123
|
expected
|
|
@@ -5,16 +5,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
const _testutils = require("../../../test-utils");
|
|
6
6
|
describe('normalization', ()=>{
|
|
7
7
|
it('can contain inline entries & hyperlinks', ()=>{
|
|
8
|
-
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hquote", null, (0, _testutils.jsx)("hp", null, "some text before", (0, _testutils.jsx)("hinline", {
|
|
8
|
+
const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hquote", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "some text before", /*#__PURE__*/ (0, _testutils.jsx)("hinline", {
|
|
9
9
|
type: "Entry",
|
|
10
10
|
id: "inline-entry"
|
|
11
|
-
}), (0, _testutils.jsx)("hlink", {
|
|
11
|
+
}), /*#__PURE__*/ (0, _testutils.jsx)("hlink", {
|
|
12
12
|
uri: "https://contentful.com"
|
|
13
|
-
}), (0, _testutils.jsx)("hlink", {
|
|
13
|
+
}), /*#__PURE__*/ (0, _testutils.jsx)("hlink", {
|
|
14
14
|
entry: "entry-id"
|
|
15
|
-
}), (0, _testutils.jsx)("hlink", {
|
|
15
|
+
}), /*#__PURE__*/ (0, _testutils.jsx)("hlink", {
|
|
16
16
|
resource: "resource-urn"
|
|
17
|
-
}), (0, _testutils.jsx)("hlink", {
|
|
17
|
+
}), /*#__PURE__*/ (0, _testutils.jsx)("hlink", {
|
|
18
18
|
asset: "asset-id"
|
|
19
19
|
}), "some text after")));
|
|
20
20
|
(0, _testutils.assertOutput)({
|
|
@@ -23,16 +23,16 @@ describe('normalization', ()=>{
|
|
|
23
23
|
});
|
|
24
24
|
});
|
|
25
25
|
it('unwraps nested quotes', ()=>{
|
|
26
|
-
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hquote", null, (0, _testutils.jsx)("hp", null, "some"), (0, _testutils.jsx)("hquote", null, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", {
|
|
26
|
+
const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hquote", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "some"), /*#__PURE__*/ (0, _testutils.jsx)("hquote", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", {
|
|
27
27
|
bold: true,
|
|
28
28
|
italic: true,
|
|
29
29
|
underline: true
|
|
30
|
-
}, "paragraph"))), (0, _testutils.jsx)("hp", null, "text")));
|
|
31
|
-
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hquote", null, (0, _testutils.jsx)("hp", null, "some"), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", {
|
|
30
|
+
}, "paragraph"))), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "text")));
|
|
31
|
+
const expected = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hquote", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "some"), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", {
|
|
32
32
|
bold: true,
|
|
33
33
|
italic: true,
|
|
34
34
|
underline: true
|
|
35
|
-
}, "paragraph")), (0, _testutils.jsx)("hp", null, "text")), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
|
|
35
|
+
}, "paragraph")), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "text")), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null)));
|
|
36
36
|
(0, _testutils.assertOutput)({
|
|
37
37
|
input,
|
|
38
38
|
expected
|
|
@@ -40,37 +40,37 @@ describe('normalization', ()=>{
|
|
|
40
40
|
});
|
|
41
41
|
describe('lifts other invalid children', ()=>{
|
|
42
42
|
it('block void elements', ()=>{
|
|
43
|
-
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hquote", null, (0, _testutils.jsx)("hp", null, "this"), (0, _testutils.jsx)("hembed", {
|
|
43
|
+
const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hquote", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "this"), /*#__PURE__*/ (0, _testutils.jsx)("hembed", {
|
|
44
44
|
type: "Asset",
|
|
45
45
|
id: "1"
|
|
46
|
-
}), (0, _testutils.jsx)("hp", null, "is"), (0, _testutils.jsx)("hembed", {
|
|
46
|
+
}), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "is"), /*#__PURE__*/ (0, _testutils.jsx)("hembed", {
|
|
47
47
|
type: "Entry",
|
|
48
48
|
id: "1"
|
|
49
|
-
}), (0, _testutils.jsx)("hp", null, "a blockquote"), (0, _testutils.jsx)("hhr", null), (0, _testutils.jsx)("hh1", null, "Heading 1")));
|
|
50
|
-
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hquote", null, (0, _testutils.jsx)("hp", null, "this")), (0, _testutils.jsx)("hembed", {
|
|
49
|
+
}), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "a blockquote"), /*#__PURE__*/ (0, _testutils.jsx)("hhr", null), /*#__PURE__*/ (0, _testutils.jsx)("hh1", null, "Heading 1")));
|
|
50
|
+
const expected = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hquote", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "this")), /*#__PURE__*/ (0, _testutils.jsx)("hembed", {
|
|
51
51
|
type: "Asset",
|
|
52
52
|
id: "1"
|
|
53
|
-
}), (0, _testutils.jsx)("hquote", null, (0, _testutils.jsx)("hp", null, "is")), (0, _testutils.jsx)("hembed", {
|
|
53
|
+
}), /*#__PURE__*/ (0, _testutils.jsx)("hquote", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "is")), /*#__PURE__*/ (0, _testutils.jsx)("hembed", {
|
|
54
54
|
type: "Entry",
|
|
55
55
|
id: "1"
|
|
56
|
-
}), (0, _testutils.jsx)("hquote", null, (0, _testutils.jsx)("hp", null, "a blockquote")), (0, _testutils.jsx)("hhr", null), (0, _testutils.jsx)("hh1", null, "Heading 1"), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("text", null)));
|
|
56
|
+
}), /*#__PURE__*/ (0, _testutils.jsx)("hquote", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "a blockquote")), /*#__PURE__*/ (0, _testutils.jsx)("hhr", null), /*#__PURE__*/ (0, _testutils.jsx)("hh1", null, "Heading 1"), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("text", null)));
|
|
57
57
|
(0, _testutils.assertOutput)({
|
|
58
58
|
input,
|
|
59
59
|
expected
|
|
60
60
|
});
|
|
61
61
|
});
|
|
62
62
|
it('handles lists', ()=>{
|
|
63
|
-
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hquote", null, (0, _testutils.jsx)("hp", null, "some", (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "list item"))), "text")));
|
|
64
|
-
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hquote", null, (0, _testutils.jsx)("hp", null, "some")), (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "list item"))), (0, _testutils.jsx)("hquote", null, (0, _testutils.jsx)("hp", null, "text")), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("text", null)));
|
|
63
|
+
const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hquote", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "some", /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "list item"))), "text")));
|
|
64
|
+
const expected = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hquote", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "some")), /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "list item"))), /*#__PURE__*/ (0, _testutils.jsx)("hquote", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "text")), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("text", null)));
|
|
65
65
|
(0, _testutils.assertOutput)({
|
|
66
66
|
input,
|
|
67
67
|
expected
|
|
68
68
|
});
|
|
69
69
|
});
|
|
70
70
|
it('handles tables', ()=>{
|
|
71
|
-
const table = (0, _testutils.jsx)("htable", null, (0, _testutils.jsx)("htr", null, (0, _testutils.jsx)("htd", null, (0, _testutils.jsx)("hp", null, "cell 1")), (0, _testutils.jsx)("htd", null, (0, _testutils.jsx)("hp", null, "cell 2"))));
|
|
72
|
-
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hquote", null, (0, _testutils.jsx)("hp", null, "some", table, "text")));
|
|
73
|
-
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hquote", null, (0, _testutils.jsx)("hp", null, "some")), table, (0, _testutils.jsx)("hquote", null, (0, _testutils.jsx)("hp", null, "text")), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("text", null)));
|
|
71
|
+
const table = /*#__PURE__*/ (0, _testutils.jsx)("htable", null, /*#__PURE__*/ (0, _testutils.jsx)("htr", null, /*#__PURE__*/ (0, _testutils.jsx)("htd", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "cell 1")), /*#__PURE__*/ (0, _testutils.jsx)("htd", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "cell 2"))));
|
|
72
|
+
const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hquote", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "some", table, "text")));
|
|
73
|
+
const expected = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hquote", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "some")), table, /*#__PURE__*/ (0, _testutils.jsx)("hquote", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "text")), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("text", null)));
|
|
74
74
|
(0, _testutils.assertOutput)({
|
|
75
75
|
input,
|
|
76
76
|
expected
|
|
@@ -64,7 +64,7 @@ const style = (0, _emotion.css)({
|
|
|
64
64
|
fontStyle: 'normal'
|
|
65
65
|
});
|
|
66
66
|
function Quote(props) {
|
|
67
|
-
return _react.createElement("blockquote", {
|
|
67
|
+
return /*#__PURE__*/ _react.createElement("blockquote", {
|
|
68
68
|
...props.attributes,
|
|
69
69
|
className: style
|
|
70
70
|
}, props.children);
|
|
@@ -64,11 +64,11 @@ function ToolbarQuoteButton(props) {
|
|
|
64
64
|
(0, _editor.focus)(editor);
|
|
65
65
|
}
|
|
66
66
|
if (!editor) return null;
|
|
67
|
-
return _react.createElement(_ToolbarButton.ToolbarButton, {
|
|
67
|
+
return /*#__PURE__*/ _react.createElement(_ToolbarButton.ToolbarButton, {
|
|
68
68
|
title: "Blockquote",
|
|
69
69
|
onClick: handleOnClick,
|
|
70
70
|
testId: "quote-toolbar-button",
|
|
71
71
|
isDisabled: props.isDisabled,
|
|
72
72
|
isActive: (0, _editor.isBlockSelected)(editor, _richtexttypes.BLOCKS.QUOTE)
|
|
73
|
-
}, _react.createElement(_f36icons.QuoteIcon, null));
|
|
73
|
+
}, /*#__PURE__*/ _react.createElement(_f36icons.QuoteIcon, null));
|
|
74
74
|
}
|
|
@@ -6,25 +6,25 @@ const _testutils = require("../../../test-utils");
|
|
|
6
6
|
describe('normalization', ()=>{
|
|
7
7
|
describe('Table', ()=>{
|
|
8
8
|
it('removes empty table nodes', ()=>{
|
|
9
|
-
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("htable", null));
|
|
10
|
-
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("text", null)));
|
|
9
|
+
const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("htable", null));
|
|
10
|
+
const expected = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("text", null)));
|
|
11
11
|
(0, _testutils.assertOutput)({
|
|
12
12
|
input,
|
|
13
13
|
expected
|
|
14
14
|
});
|
|
15
15
|
});
|
|
16
16
|
it('moves tables to the root level except nested tables', ()=>{
|
|
17
|
-
const table = (0, _testutils.jsx)("htable", null, (0, _testutils.jsx)("htr", null, (0, _testutils.jsx)("htd", null, (0, _testutils.jsx)("hp", null, "Cell 1")), (0, _testutils.jsx)("htd", null, (0, _testutils.jsx)("hp", null, "Cell 2"))));
|
|
18
|
-
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hp", null, "hello", table), (0, _testutils.jsx)("hquote", null, (0, _testutils.jsx)("hp", null, "quote", table)), (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "item", table))), (0, _testutils.jsx)("htable", null, (0, _testutils.jsx)("htr", null, (0, _testutils.jsx)("htd", null, (0, _testutils.jsx)("hp", null, "cell with table: ", table)))));
|
|
19
|
-
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hp", null, "hello"), table, (0, _testutils.jsx)("hquote", null, (0, _testutils.jsx)("hp", null, "quote")), table, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "item"))), table, (0, _testutils.jsx)("htable", null, (0, _testutils.jsx)("htr", null, (0, _testutils.jsx)("htd", null, (0, _testutils.jsx)("hp", null, "cell with table: "), (0, _testutils.jsx)("hp", null, "Cell 1"), (0, _testutils.jsx)("hp", null, "Cell 2")))), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
|
|
17
|
+
const table = /*#__PURE__*/ (0, _testutils.jsx)("htable", null, /*#__PURE__*/ (0, _testutils.jsx)("htr", null, /*#__PURE__*/ (0, _testutils.jsx)("htd", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "Cell 1")), /*#__PURE__*/ (0, _testutils.jsx)("htd", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "Cell 2"))));
|
|
18
|
+
const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "hello", table), /*#__PURE__*/ (0, _testutils.jsx)("hquote", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "quote", table)), /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "item", table))), /*#__PURE__*/ (0, _testutils.jsx)("htable", null, /*#__PURE__*/ (0, _testutils.jsx)("htr", null, /*#__PURE__*/ (0, _testutils.jsx)("htd", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "cell with table: ", table)))));
|
|
19
|
+
const expected = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "hello"), table, /*#__PURE__*/ (0, _testutils.jsx)("hquote", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "quote")), table, /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "item"))), table, /*#__PURE__*/ (0, _testutils.jsx)("htable", null, /*#__PURE__*/ (0, _testutils.jsx)("htr", null, /*#__PURE__*/ (0, _testutils.jsx)("htd", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "cell with table: "), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "Cell 1"), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "Cell 2")))), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null)));
|
|
20
20
|
(0, _testutils.assertOutput)({
|
|
21
21
|
input,
|
|
22
22
|
expected
|
|
23
23
|
});
|
|
24
24
|
});
|
|
25
25
|
it('removes invalid children', ()=>{
|
|
26
|
-
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("htable", null, (0, _testutils.jsx)("htr", null, (0, _testutils.jsx)("htd", null, (0, _testutils.jsx)("hp", null, "Cell 1")), (0, _testutils.jsx)("htd", null, (0, _testutils.jsx)("hp", null, "Cell 2"))), (0, _testutils.jsx)("htd", null, "invalid cell"), "invalid text"), (0, _testutils.jsx)("hp", null));
|
|
27
|
-
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("htable", null, (0, _testutils.jsx)("htr", null, (0, _testutils.jsx)("htd", null, (0, _testutils.jsx)("hp", null, "Cell 1")), (0, _testutils.jsx)("htd", null, (0, _testutils.jsx)("hp", null, "Cell 2")))), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
|
|
26
|
+
const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("htable", null, /*#__PURE__*/ (0, _testutils.jsx)("htr", null, /*#__PURE__*/ (0, _testutils.jsx)("htd", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "Cell 1")), /*#__PURE__*/ (0, _testutils.jsx)("htd", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "Cell 2"))), /*#__PURE__*/ (0, _testutils.jsx)("htd", null, "invalid cell"), "invalid text"), /*#__PURE__*/ (0, _testutils.jsx)("hp", null));
|
|
27
|
+
const expected = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("htable", null, /*#__PURE__*/ (0, _testutils.jsx)("htr", null, /*#__PURE__*/ (0, _testutils.jsx)("htd", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "Cell 1")), /*#__PURE__*/ (0, _testutils.jsx)("htd", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "Cell 2")))), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null)));
|
|
28
28
|
(0, _testutils.assertOutput)({
|
|
29
29
|
input,
|
|
30
30
|
expected
|
|
@@ -33,22 +33,22 @@ describe('normalization', ()=>{
|
|
|
33
33
|
});
|
|
34
34
|
describe('Table cell', ()=>{
|
|
35
35
|
it('converts invalid children to paragraphs', ()=>{
|
|
36
|
-
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("htable", null, (0, _testutils.jsx)("htr", null, (0, _testutils.jsx)("htd", null, (0, _testutils.jsx)("hp", null, "Cell 1")), (0, _testutils.jsx)("htd", null, (0, _testutils.jsx)("hp", null, "Cell 2"), (0, _testutils.jsx)("hquote", null, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", {
|
|
36
|
+
const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("htable", null, /*#__PURE__*/ (0, _testutils.jsx)("htr", null, /*#__PURE__*/ (0, _testutils.jsx)("htd", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "Cell 1")), /*#__PURE__*/ (0, _testutils.jsx)("htd", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "Cell 2"), /*#__PURE__*/ (0, _testutils.jsx)("hquote", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", {
|
|
37
37
|
bold: true,
|
|
38
38
|
italic: true,
|
|
39
39
|
underline: true
|
|
40
|
-
}, "quote"), (0, _testutils.jsx)("hinline", {
|
|
40
|
+
}, "quote"), /*#__PURE__*/ (0, _testutils.jsx)("hinline", {
|
|
41
41
|
type: "Entry",
|
|
42
42
|
id: "entry-id"
|
|
43
|
-
})))))), (0, _testutils.jsx)("hp", null));
|
|
44
|
-
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("htable", null, (0, _testutils.jsx)("htr", null, (0, _testutils.jsx)("htd", null, (0, _testutils.jsx)("hp", null, "Cell 1")), (0, _testutils.jsx)("htd", null, (0, _testutils.jsx)("hp", null, "Cell 2"), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", {
|
|
43
|
+
})))))), /*#__PURE__*/ (0, _testutils.jsx)("hp", null));
|
|
44
|
+
const expected = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("htable", null, /*#__PURE__*/ (0, _testutils.jsx)("htr", null, /*#__PURE__*/ (0, _testutils.jsx)("htd", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "Cell 1")), /*#__PURE__*/ (0, _testutils.jsx)("htd", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "Cell 2"), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", {
|
|
45
45
|
bold: true,
|
|
46
46
|
italic: true,
|
|
47
47
|
underline: true
|
|
48
|
-
}, "quote"), (0, _testutils.jsx)("hinline", {
|
|
48
|
+
}, "quote"), /*#__PURE__*/ (0, _testutils.jsx)("hinline", {
|
|
49
49
|
type: "Entry",
|
|
50
50
|
id: "entry-id"
|
|
51
|
-
}), (0, _testutils.jsx)("htext", null))))), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
|
|
51
|
+
}), /*#__PURE__*/ (0, _testutils.jsx)("htext", null))))), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null)));
|
|
52
52
|
(0, _testutils.assertOutput)({
|
|
53
53
|
input,
|
|
54
54
|
expected
|
|
@@ -57,32 +57,32 @@ describe('normalization', ()=>{
|
|
|
57
57
|
});
|
|
58
58
|
describe('Table row', ()=>{
|
|
59
59
|
it('must be wrapped in a table', ()=>{
|
|
60
|
-
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("htr", null, (0, _testutils.jsx)("htd", null, (0, _testutils.jsx)("hp", null, "cell"))));
|
|
61
|
-
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("htable", null, (0, _testutils.jsx)("htr", null, (0, _testutils.jsx)("htd", null, (0, _testutils.jsx)("hp", null, "cell")))), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("text", null)));
|
|
60
|
+
const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("htr", null, /*#__PURE__*/ (0, _testutils.jsx)("htd", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "cell"))));
|
|
61
|
+
const expected = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("htable", null, /*#__PURE__*/ (0, _testutils.jsx)("htr", null, /*#__PURE__*/ (0, _testutils.jsx)("htd", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "cell")))), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("text", null)));
|
|
62
62
|
(0, _testutils.assertOutput)({
|
|
63
63
|
input,
|
|
64
64
|
expected
|
|
65
65
|
});
|
|
66
66
|
});
|
|
67
67
|
it('removes empty rows', ()=>{
|
|
68
|
-
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("htr", null));
|
|
69
|
-
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("text", null)));
|
|
68
|
+
const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("htr", null));
|
|
69
|
+
const expected = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("text", null)));
|
|
70
70
|
(0, _testutils.assertOutput)({
|
|
71
71
|
input,
|
|
72
72
|
expected
|
|
73
73
|
});
|
|
74
74
|
});
|
|
75
75
|
it('wraps invalid children in table cells', ()=>{
|
|
76
|
-
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("htable", null, (0, _testutils.jsx)("htr", null, (0, _testutils.jsx)("htd", null, (0, _testutils.jsx)("hp", null, "cell 1")), (0, _testutils.jsx)("hp", null, "cell 2"))));
|
|
77
|
-
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("htable", null, (0, _testutils.jsx)("htr", null, (0, _testutils.jsx)("htd", null, (0, _testutils.jsx)("hp", null, "cell 1")), (0, _testutils.jsx)("htd", null, (0, _testutils.jsx)("hp", null, "cell 2")))), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("text", null)));
|
|
76
|
+
const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("htable", null, /*#__PURE__*/ (0, _testutils.jsx)("htr", null, /*#__PURE__*/ (0, _testutils.jsx)("htd", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "cell 1")), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "cell 2"))));
|
|
77
|
+
const expected = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("htable", null, /*#__PURE__*/ (0, _testutils.jsx)("htr", null, /*#__PURE__*/ (0, _testutils.jsx)("htd", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "cell 1")), /*#__PURE__*/ (0, _testutils.jsx)("htd", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "cell 2")))), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("text", null)));
|
|
78
78
|
(0, _testutils.assertOutput)({
|
|
79
79
|
input,
|
|
80
80
|
expected
|
|
81
81
|
});
|
|
82
82
|
});
|
|
83
83
|
it('ensures all table rows have the same width', ()=>{
|
|
84
|
-
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("htable", null, (0, _testutils.jsx)("htr", null, (0, _testutils.jsx)("htd", null, (0, _testutils.jsx)("hp", null, "cell 1"))), (0, _testutils.jsx)("htr", null, (0, _testutils.jsx)("htd", null, (0, _testutils.jsx)("hp", null, "cell 2")), (0, _testutils.jsx)("htd", null, (0, _testutils.jsx)("hp", null, "cell 3")), (0, _testutils.jsx)("htd", null, (0, _testutils.jsx)("hp", null, "cell 4"))), (0, _testutils.jsx)("htr", null, (0, _testutils.jsx)("htd", null, (0, _testutils.jsx)("hp", null, "cell 5")), (0, _testutils.jsx)("htd", null, (0, _testutils.jsx)("hp", null, "cell 6")))));
|
|
85
|
-
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("htable", null, (0, _testutils.jsx)("htr", null, (0, _testutils.jsx)("htd", null, (0, _testutils.jsx)("hp", null, "cell 1")), (0, _testutils.jsx)("htd", null, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("text", null))), (0, _testutils.jsx)("htd", null, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("text", null)))), (0, _testutils.jsx)("htr", null, (0, _testutils.jsx)("htd", null, (0, _testutils.jsx)("hp", null, "cell 2")), (0, _testutils.jsx)("htd", null, (0, _testutils.jsx)("hp", null, "cell 3")), (0, _testutils.jsx)("htd", null, (0, _testutils.jsx)("hp", null, "cell 4"))), (0, _testutils.jsx)("htr", null, (0, _testutils.jsx)("htd", null, (0, _testutils.jsx)("hp", null, "cell 5")), (0, _testutils.jsx)("htd", null, (0, _testutils.jsx)("hp", null, "cell 6")), (0, _testutils.jsx)("htd", null, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("text", null))))), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("text", null)));
|
|
84
|
+
const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("htable", null, /*#__PURE__*/ (0, _testutils.jsx)("htr", null, /*#__PURE__*/ (0, _testutils.jsx)("htd", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "cell 1"))), /*#__PURE__*/ (0, _testutils.jsx)("htr", null, /*#__PURE__*/ (0, _testutils.jsx)("htd", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "cell 2")), /*#__PURE__*/ (0, _testutils.jsx)("htd", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "cell 3")), /*#__PURE__*/ (0, _testutils.jsx)("htd", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "cell 4"))), /*#__PURE__*/ (0, _testutils.jsx)("htr", null, /*#__PURE__*/ (0, _testutils.jsx)("htd", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "cell 5")), /*#__PURE__*/ (0, _testutils.jsx)("htd", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "cell 6")))));
|
|
85
|
+
const expected = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("htable", null, /*#__PURE__*/ (0, _testutils.jsx)("htr", null, /*#__PURE__*/ (0, _testutils.jsx)("htd", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "cell 1")), /*#__PURE__*/ (0, _testutils.jsx)("htd", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("text", null))), /*#__PURE__*/ (0, _testutils.jsx)("htd", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("text", null)))), /*#__PURE__*/ (0, _testutils.jsx)("htr", null, /*#__PURE__*/ (0, _testutils.jsx)("htd", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "cell 2")), /*#__PURE__*/ (0, _testutils.jsx)("htd", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "cell 3")), /*#__PURE__*/ (0, _testutils.jsx)("htd", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "cell 4"))), /*#__PURE__*/ (0, _testutils.jsx)("htr", null, /*#__PURE__*/ (0, _testutils.jsx)("htd", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "cell 5")), /*#__PURE__*/ (0, _testutils.jsx)("htd", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "cell 6")), /*#__PURE__*/ (0, _testutils.jsx)("htd", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("text", null))))), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("text", null)));
|
|
86
86
|
(0, _testutils.assertOutput)({
|
|
87
87
|
input,
|
|
88
88
|
expected
|
|
@@ -5,12 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
const _testutils = require("../../../test-utils");
|
|
6
6
|
const _helpers = require("../helpers");
|
|
7
7
|
test('insertTableAndFocusFirstCell', ()=>{
|
|
8
|
-
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null), (0, _testutils.jsx)("cursor", null)), (0, _testutils.jsx)("hp", null));
|
|
8
|
+
const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null), /*#__PURE__*/ (0, _testutils.jsx)("cursor", null)), /*#__PURE__*/ (0, _testutils.jsx)("hp", null));
|
|
9
9
|
const { editor } = (0, _testutils.createTestEditor)({
|
|
10
10
|
input
|
|
11
11
|
});
|
|
12
12
|
(0, _helpers.insertTableAndFocusFirstCell)(editor);
|
|
13
|
-
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("htable", null, (0, _testutils.jsx)("htr", null, (0, _testutils.jsx)("hth", null, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null), (0, _testutils.jsx)("cursor", null))), (0, _testutils.jsx)("hth", null, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)))), (0, _testutils.jsx)("htr", null, (0, _testutils.jsx)("htd", null, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null))), (0, _testutils.jsx)("htd", null, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null))))), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
|
|
13
|
+
const expected = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("htable", null, /*#__PURE__*/ (0, _testutils.jsx)("htr", null, /*#__PURE__*/ (0, _testutils.jsx)("hth", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null), /*#__PURE__*/ (0, _testutils.jsx)("cursor", null))), /*#__PURE__*/ (0, _testutils.jsx)("hth", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null)))), /*#__PURE__*/ (0, _testutils.jsx)("htr", null, /*#__PURE__*/ (0, _testutils.jsx)("htd", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null))), /*#__PURE__*/ (0, _testutils.jsx)("htd", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null))))), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null)));
|
|
14
14
|
(0, _testutils.assertOutput)({
|
|
15
15
|
input,
|
|
16
16
|
expected
|
|
@@ -73,9 +73,9 @@ const style = (0, _emotion.css)`
|
|
|
73
73
|
`;
|
|
74
74
|
const Cell = (props)=>{
|
|
75
75
|
const isSelected = (0, _slatereact.useSelected)();
|
|
76
|
-
return _react.createElement("td", {
|
|
76
|
+
return /*#__PURE__*/ _react.createElement("td", {
|
|
77
77
|
...props.attributes,
|
|
78
78
|
...props.element.data,
|
|
79
79
|
className: style
|
|
80
|
-
}, isSelected && _react.createElement(_TableActions.TableActions, null), props.children);
|
|
80
|
+
}, isSelected && /*#__PURE__*/ _react.createElement(_TableActions.TableActions, null), props.children);
|
|
81
81
|
};
|
|
@@ -76,9 +76,9 @@ const style = (0, _emotion.css)`
|
|
|
76
76
|
`;
|
|
77
77
|
const HeaderCell = (props)=>{
|
|
78
78
|
const isSelected = (0, _slatereact.useSelected)();
|
|
79
|
-
return _react.createElement("th", {
|
|
79
|
+
return /*#__PURE__*/ _react.createElement("th", {
|
|
80
80
|
...props.attributes,
|
|
81
81
|
...props.element.data,
|
|
82
82
|
className: style
|
|
83
|
-
}, isSelected && _react.createElement(_TableActions.TableActions, null), props.children);
|
|
83
|
+
}, isSelected && /*#__PURE__*/ _react.createElement(_TableActions.TableActions, null), props.children);
|
|
84
84
|
};
|
|
@@ -65,7 +65,7 @@ const style = (0, _emotion.css)`
|
|
|
65
65
|
background-color: transparent !important;
|
|
66
66
|
}
|
|
67
67
|
`;
|
|
68
|
-
const Row = (props)
|
|
68
|
+
const Row = (props)=>/*#__PURE__*/ _react.createElement("tr", {
|
|
69
69
|
...props.attributes,
|
|
70
70
|
className: style
|
|
71
71
|
}, props.children);
|
|
@@ -69,10 +69,10 @@ const style = (0, _emotion.css)`
|
|
|
69
69
|
overflow: hidden;
|
|
70
70
|
`;
|
|
71
71
|
const Table = (props)=>{
|
|
72
|
-
return _react.createElement("div", {
|
|
72
|
+
return /*#__PURE__*/ _react.createElement("div", {
|
|
73
73
|
"data-block-type": _richtexttypes.BLOCKS.TABLE
|
|
74
|
-
}, _react.createElement("table", {
|
|
74
|
+
}, /*#__PURE__*/ _react.createElement("table", {
|
|
75
75
|
className: style,
|
|
76
76
|
...props.attributes
|
|
77
|
-
}, _react.createElement("tbody", null, props.children)));
|
|
77
|
+
}, /*#__PURE__*/ _react.createElement("tbody", null, props.children)));
|
|
78
78
|
};
|
|
@@ -141,37 +141,37 @@ const TableActions = ()=>{
|
|
|
141
141
|
if (isDisabled) {
|
|
142
142
|
return null;
|
|
143
143
|
}
|
|
144
|
-
return _react.createElement(_f36components.Menu, {
|
|
144
|
+
return /*#__PURE__*/ _react.createElement(_f36components.Menu, {
|
|
145
145
|
placement: "left",
|
|
146
146
|
isOpen: isOpen,
|
|
147
147
|
onOpen: ()=>{
|
|
148
148
|
setOpen(true);
|
|
149
149
|
},
|
|
150
150
|
onClose: close
|
|
151
|
-
}, _react.createElement(_f36components.Menu.Trigger, null, _react.createElement(_f36components.IconButton, {
|
|
151
|
+
}, /*#__PURE__*/ _react.createElement(_f36components.Menu.Trigger, null, /*#__PURE__*/ _react.createElement(_f36components.IconButton, {
|
|
152
152
|
size: "small",
|
|
153
153
|
variant: "transparent",
|
|
154
154
|
tabIndex: -1,
|
|
155
155
|
className: styles.topRight,
|
|
156
|
-
icon: _react.createElement(_f36icons.ChevronDownIcon, null),
|
|
156
|
+
icon: /*#__PURE__*/ _react.createElement(_f36icons.ChevronDownIcon, null),
|
|
157
157
|
"aria-label": "Open table menu",
|
|
158
158
|
testId: "cf-table-actions-button"
|
|
159
|
-
})), _react.createElement(_f36components.Menu.List, null, _react.createElement(_f36components.Menu.Item, {
|
|
159
|
+
})), /*#__PURE__*/ _react.createElement(_f36components.Menu.List, null, /*#__PURE__*/ _react.createElement(_f36components.Menu.Item, {
|
|
160
160
|
onClick: action(_actions.addRowAbove, 'insert', 'Row'),
|
|
161
161
|
disabled: !canInsertRowAbove
|
|
162
|
-
}, "Add row above"), _react.createElement(_f36components.Menu.Item, {
|
|
162
|
+
}, "Add row above"), /*#__PURE__*/ _react.createElement(_f36components.Menu.Item, {
|
|
163
163
|
onClick: action(_actions.addRowBelow, 'insert', 'Row')
|
|
164
|
-
}, "Add row below"), _react.createElement(_f36components.Menu.Item, {
|
|
164
|
+
}, "Add row below"), /*#__PURE__*/ _react.createElement(_f36components.Menu.Item, {
|
|
165
165
|
onClick: action(_actions.addColumnLeft, 'insert', 'Column')
|
|
166
|
-
}, "Add column left"), _react.createElement(_f36components.Menu.Item, {
|
|
166
|
+
}, "Add column left"), /*#__PURE__*/ _react.createElement(_f36components.Menu.Item, {
|
|
167
167
|
onClick: action(_actions.addColumnRight, 'insert', 'Column')
|
|
168
|
-
}, "Add column right"), _react.createElement(_f36components.Menu.Divider, null), _react.createElement(_f36components.Menu.Item, {
|
|
168
|
+
}, "Add column right"), /*#__PURE__*/ _react.createElement(_f36components.Menu.Divider, null), /*#__PURE__*/ _react.createElement(_f36components.Menu.Item, {
|
|
169
169
|
onClick: toggleHeader
|
|
170
|
-
}, isHeaderEnabled ? 'Disable table header' : 'Enable table header'), _react.createElement(_f36components.Menu.Divider, null), _react.createElement(_f36components.Menu.Item, {
|
|
170
|
+
}, isHeaderEnabled ? 'Disable table header' : 'Enable table header'), /*#__PURE__*/ _react.createElement(_f36components.Menu.Divider, null), /*#__PURE__*/ _react.createElement(_f36components.Menu.Item, {
|
|
171
171
|
onClick: action(_platetable.deleteRow, 'remove', 'Row')
|
|
172
|
-
}, "Delete row"), _react.createElement(_f36components.Menu.Item, {
|
|
172
|
+
}, "Delete row"), /*#__PURE__*/ _react.createElement(_f36components.Menu.Item, {
|
|
173
173
|
onClick: action(_platetable.deleteColumn, 'remove', 'Column')
|
|
174
|
-
}, "Delete column"), _react.createElement(_f36components.Menu.Item, {
|
|
174
|
+
}, "Delete column"), /*#__PURE__*/ _react.createElement(_f36components.Menu.Item, {
|
|
175
175
|
onClick: action(_platetable.deleteTable, 'remove', 'Table')
|
|
176
176
|
}, "Delete table")));
|
|
177
177
|
};
|
|
@@ -65,11 +65,11 @@ function ToolbarTableButton(props) {
|
|
|
65
65
|
(0, _editor.focus)(editor);
|
|
66
66
|
}
|
|
67
67
|
if (!editor) return null;
|
|
68
|
-
return _react.createElement(_ToolbarButton.ToolbarButton, {
|
|
68
|
+
return /*#__PURE__*/ _react.createElement(_ToolbarButton.ToolbarButton, {
|
|
69
69
|
title: "Table",
|
|
70
70
|
testId: "table-toolbar-button",
|
|
71
71
|
onClick: handleClick,
|
|
72
72
|
isActive: !!isActive,
|
|
73
73
|
isDisabled: props.isDisabled
|
|
74
|
-
}, _react.createElement(_f36icons.TableIcon, null));
|
|
74
|
+
}, /*#__PURE__*/ _react.createElement(_f36icons.TableIcon, null));
|
|
75
75
|
}
|