@contentful/field-editor-rich-text 4.6.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/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/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
|
@@ -12,16 +12,16 @@ const styles = {
|
|
|
12
12
|
})
|
|
13
13
|
};
|
|
14
14
|
export const ToolbarSuperscriptButton = createMarkToolbarButton({
|
|
15
|
-
title:
|
|
15
|
+
title: 'Superscript',
|
|
16
16
|
mark: MARKS.SUPERSCRIPT,
|
|
17
|
-
icon: React.createElement(SuperscriptIcon, null)
|
|
17
|
+
icon: /*#__PURE__*/ React.createElement(SuperscriptIcon, null)
|
|
18
18
|
});
|
|
19
19
|
export const ToolbarDropdownSuperscriptButton = createMarkToolbarButton({
|
|
20
|
-
title:
|
|
20
|
+
title: 'Superscript',
|
|
21
21
|
mark: MARKS.SUPERSCRIPT
|
|
22
22
|
});
|
|
23
23
|
export function Superscript(props) {
|
|
24
|
-
return React.createElement("sup", {
|
|
24
|
+
return /*#__PURE__*/ React.createElement("sup", {
|
|
25
25
|
...props.attributes,
|
|
26
26
|
className: styles.superscript
|
|
27
27
|
}, props.children);
|
|
@@ -8,10 +8,10 @@ import { buildMarkEventHandler } from './helpers';
|
|
|
8
8
|
export const ToolbarUnderlineButton = createMarkToolbarButton({
|
|
9
9
|
title: 'Underline',
|
|
10
10
|
mark: MARKS.UNDERLINE,
|
|
11
|
-
icon: React.createElement(FormatUnderlinedIcon, null)
|
|
11
|
+
icon: /*#__PURE__*/ React.createElement(FormatUnderlinedIcon, null)
|
|
12
12
|
});
|
|
13
13
|
export function Underline(props) {
|
|
14
|
-
return React.createElement("u", props.attributes, props.children);
|
|
14
|
+
return /*#__PURE__*/ React.createElement("u", props.attributes, props.children);
|
|
15
15
|
}
|
|
16
16
|
export const createUnderlinePlugin = ()=>createDefaultUnderlinePlugin({
|
|
17
17
|
type: MARKS.UNDERLINE,
|
|
@@ -29,7 +29,7 @@ export const createMarkToolbarButton = ({ mark, title, icon })=>{
|
|
|
29
29
|
]);
|
|
30
30
|
if (!editor) return null;
|
|
31
31
|
if (!icon) {
|
|
32
|
-
return React.createElement(Menu.Item, {
|
|
32
|
+
return /*#__PURE__*/ React.createElement(Menu.Item, {
|
|
33
33
|
onClick: handleClick,
|
|
34
34
|
disabled: isDisabled,
|
|
35
35
|
className: cx({
|
|
@@ -38,7 +38,7 @@ export const createMarkToolbarButton = ({ mark, title, icon })=>{
|
|
|
38
38
|
testId: `${mark}-toolbar-button`
|
|
39
39
|
}, title);
|
|
40
40
|
}
|
|
41
|
-
return React.createElement(ToolbarButton, {
|
|
41
|
+
return /*#__PURE__*/ React.createElement(ToolbarButton, {
|
|
42
42
|
title: title,
|
|
43
43
|
testId: `${mark}-toolbar-button`,
|
|
44
44
|
onClick: handleClick,
|
|
@@ -2,8 +2,8 @@ import { createBoldPlugin } from './Bold';
|
|
|
2
2
|
import { createCodePlugin } from './Code';
|
|
3
3
|
import { createItalicPlugin } from './Italic';
|
|
4
4
|
import { createStrikethroughPlugin } from './Strikethrough';
|
|
5
|
-
import { createSubscriptPlugin } from
|
|
6
|
-
import { createSuperscriptPlugin } from
|
|
5
|
+
import { createSubscriptPlugin } from './Subscript';
|
|
6
|
+
import { createSuperscriptPlugin } from './Superscript';
|
|
7
7
|
import { createUnderlinePlugin } from './Underline';
|
|
8
8
|
export const createMarksPlugin = ()=>({
|
|
9
9
|
key: 'Marks',
|
|
@@ -12,12 +12,12 @@ describe('Normalizer', ()=>{
|
|
|
12
12
|
];
|
|
13
13
|
let input;
|
|
14
14
|
beforeEach(()=>{
|
|
15
|
-
input = jsx("editor", null, jsx("hul", null, jsx("hli", null, jsx("hembed", {
|
|
15
|
+
input = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hul", null, /*#__PURE__*/ jsx("hli", null, /*#__PURE__*/ jsx("hembed", {
|
|
16
16
|
type: "Entry",
|
|
17
17
|
id: "embedded-entry"
|
|
18
|
-
}), jsx("hp", null, "List item"))));
|
|
18
|
+
}), /*#__PURE__*/ jsx("hp", null, "List item"))));
|
|
19
19
|
});
|
|
20
|
-
const expected = jsx("editor", null, jsx("hul", null, jsx("hli", null, jsx("hp", null, "List item"))));
|
|
20
|
+
const expected = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hul", null, /*#__PURE__*/ jsx("hli", null, /*#__PURE__*/ jsx("hp", null, "List item"))));
|
|
21
21
|
describe('rule.match', ()=>{
|
|
22
22
|
it('matches elements of type "plugin.type" by default', ()=>{
|
|
23
23
|
const { editor } = createTestEditor({
|
|
@@ -51,13 +51,13 @@ describe('Normalizer', ()=>{
|
|
|
51
51
|
describe('rule.transform', ()=>{
|
|
52
52
|
it('works with conditional transformation', ()=>{
|
|
53
53
|
const { editor } = createTestEditor({
|
|
54
|
-
input: jsx("editor", null, jsx("hul", null, jsx("hli", null, jsx("hembed", {
|
|
54
|
+
input: /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hul", null, /*#__PURE__*/ jsx("hli", null, /*#__PURE__*/ jsx("hembed", {
|
|
55
55
|
type: "Entry",
|
|
56
56
|
id: "embedded-entry"
|
|
57
|
-
}), jsx("hinline", {
|
|
57
|
+
}), /*#__PURE__*/ jsx("hinline", {
|
|
58
58
|
type: "Entry",
|
|
59
59
|
id: "inline-entry"
|
|
60
|
-
}), jsx("hp", null, "List item")))),
|
|
60
|
+
}), /*#__PURE__*/ jsx("hp", null, "List item")))),
|
|
61
61
|
plugins: [
|
|
62
62
|
mockPlugin({
|
|
63
63
|
isElement: true,
|
|
@@ -78,10 +78,10 @@ describe('Normalizer', ()=>{
|
|
|
78
78
|
});
|
|
79
79
|
assertOutput({
|
|
80
80
|
editor,
|
|
81
|
-
expected: jsx("editor", null, jsx("hul", null, jsx("hli", null, jsx("hp", null, jsx("hinline", {
|
|
81
|
+
expected: /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hul", null, /*#__PURE__*/ jsx("hli", null, /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("hinline", {
|
|
82
82
|
type: "Entry",
|
|
83
83
|
id: "inline-entry"
|
|
84
|
-
})), jsx("hp", null, "List item"))))
|
|
84
|
+
})), /*#__PURE__*/ jsx("hp", null, "List item"))))
|
|
85
85
|
});
|
|
86
86
|
});
|
|
87
87
|
});
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { assertOutput, jsx } from '../../../test-utils';
|
|
2
2
|
describe('normalization', ()=>{
|
|
3
3
|
it('can contain inline entries & hyperlinks', ()=>{
|
|
4
|
-
const input = jsx("editor", null, jsx("hp", null, "some text before", jsx("hinline", {
|
|
4
|
+
const input = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hp", null, "some text before", /*#__PURE__*/ jsx("hinline", {
|
|
5
5
|
type: "Entry",
|
|
6
6
|
id: "inline-entry"
|
|
7
|
-
}), jsx("hlink", {
|
|
7
|
+
}), /*#__PURE__*/ jsx("hlink", {
|
|
8
8
|
uri: "https://contentful.com"
|
|
9
|
-
}), jsx("hlink", {
|
|
9
|
+
}), /*#__PURE__*/ jsx("hlink", {
|
|
10
10
|
entry: "entry-id"
|
|
11
|
-
}), jsx("hlink", {
|
|
11
|
+
}), /*#__PURE__*/ jsx("hlink", {
|
|
12
12
|
resource: "resource-urn"
|
|
13
|
-
}), jsx("hlink", {
|
|
13
|
+
}), /*#__PURE__*/ jsx("hlink", {
|
|
14
14
|
asset: "asset-id"
|
|
15
15
|
}), "some text after"));
|
|
16
16
|
assertOutput({
|
|
@@ -19,20 +19,20 @@ describe('normalization', ()=>{
|
|
|
19
19
|
});
|
|
20
20
|
});
|
|
21
21
|
it('wraps orphaned text nodes in a paragraph', ()=>{
|
|
22
|
-
const input = jsx("editor", null, jsx("hp", null, "valid text"), jsx("hh1", null, "valid text"), jsx("htable", null, jsx("htr", null, jsx("htd", null, "invalid text"))));
|
|
23
|
-
const expected = jsx("editor", null, jsx("hp", null, "valid text"), jsx("hh1", null, "valid text"), jsx("htable", null, jsx("htr", null, jsx("htd", null, jsx("hp", null, "invalid text")))), jsx("hp", null, jsx("htext", null)));
|
|
22
|
+
const input = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hp", null, "valid text"), /*#__PURE__*/ jsx("hh1", null, "valid text"), /*#__PURE__*/ jsx("htable", null, /*#__PURE__*/ jsx("htr", null, /*#__PURE__*/ jsx("htd", null, "invalid text"))));
|
|
23
|
+
const expected = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hp", null, "valid text"), /*#__PURE__*/ jsx("hh1", null, "valid text"), /*#__PURE__*/ jsx("htable", null, /*#__PURE__*/ jsx("htr", null, /*#__PURE__*/ jsx("htd", null, /*#__PURE__*/ jsx("hp", null, "invalid text")))), /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("htext", null)));
|
|
24
24
|
assertOutput({
|
|
25
25
|
input,
|
|
26
26
|
expected
|
|
27
27
|
});
|
|
28
28
|
});
|
|
29
29
|
it('unwraps nested paragraphs', ()=>{
|
|
30
|
-
const input = jsx("editor", null, jsx("hp", null, "some", jsx("hp", null, jsx("htext", {
|
|
30
|
+
const input = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hp", null, "some", /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("htext", {
|
|
31
31
|
bold: true,
|
|
32
32
|
italic: true,
|
|
33
33
|
underline: true
|
|
34
34
|
}, "paragraph")), "text"));
|
|
35
|
-
const expected = jsx("editor", null, jsx("hp", null, "some", jsx("htext", {
|
|
35
|
+
const expected = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hp", null, "some", /*#__PURE__*/ jsx("htext", {
|
|
36
36
|
bold: true,
|
|
37
37
|
italic: true,
|
|
38
38
|
underline: true
|
|
@@ -44,76 +44,76 @@ describe('normalization', ()=>{
|
|
|
44
44
|
});
|
|
45
45
|
describe('lifts other invalid children', ()=>{
|
|
46
46
|
it('block void elements', ()=>{
|
|
47
|
-
const input = jsx("editor", null, jsx("hp", null, jsx("hembed", {
|
|
47
|
+
const input = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("hembed", {
|
|
48
48
|
type: "Asset",
|
|
49
49
|
id: "1"
|
|
50
|
-
}), " start"), jsx("hp", null, "end ", jsx("hembed", {
|
|
50
|
+
}), " start"), /*#__PURE__*/ jsx("hp", null, "end ", /*#__PURE__*/ jsx("hembed", {
|
|
51
51
|
type: "Asset",
|
|
52
52
|
id: "2"
|
|
53
|
-
})), jsx("hp", null, "in ", jsx("hembed", {
|
|
53
|
+
})), /*#__PURE__*/ jsx("hp", null, "in ", /*#__PURE__*/ jsx("hembed", {
|
|
54
54
|
type: "Asset",
|
|
55
55
|
id: "3"
|
|
56
|
-
}), " between"), jsx("hp", null, jsx("hembed", {
|
|
56
|
+
}), " between"), /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("hembed", {
|
|
57
57
|
type: "Entry",
|
|
58
58
|
id: "1"
|
|
59
|
-
}), " start"), jsx("hp", null, "end ", jsx("hembed", {
|
|
59
|
+
}), " start"), /*#__PURE__*/ jsx("hp", null, "end ", /*#__PURE__*/ jsx("hembed", {
|
|
60
60
|
type: "Entry",
|
|
61
61
|
id: "2"
|
|
62
|
-
})), jsx("hp", null, "in ", jsx("hembed", {
|
|
62
|
+
})), /*#__PURE__*/ jsx("hp", null, "in ", /*#__PURE__*/ jsx("hembed", {
|
|
63
63
|
type: "Entry",
|
|
64
64
|
id: "3"
|
|
65
|
-
}), " between"), jsx("hp", null, jsx("hhr", null), " start"), jsx("hp", null, "end ", jsx("hhr", null)), jsx("hp", null, "in ", jsx("hhr", null), " between"));
|
|
66
|
-
const expected = jsx("editor", null, jsx("hembed", {
|
|
65
|
+
}), " between"), /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("hhr", null), " start"), /*#__PURE__*/ jsx("hp", null, "end ", /*#__PURE__*/ jsx("hhr", null)), /*#__PURE__*/ jsx("hp", null, "in ", /*#__PURE__*/ jsx("hhr", null), " between"));
|
|
66
|
+
const expected = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hembed", {
|
|
67
67
|
type: "Asset",
|
|
68
68
|
id: "1"
|
|
69
|
-
}), jsx("hp", null, " start"), jsx("hp", null, "end "), jsx("hembed", {
|
|
69
|
+
}), /*#__PURE__*/ jsx("hp", null, " start"), /*#__PURE__*/ jsx("hp", null, "end "), /*#__PURE__*/ jsx("hembed", {
|
|
70
70
|
type: "Asset",
|
|
71
71
|
id: "2"
|
|
72
|
-
}), jsx("hp", null, "in "), jsx("hembed", {
|
|
72
|
+
}), /*#__PURE__*/ jsx("hp", null, "in "), /*#__PURE__*/ jsx("hembed", {
|
|
73
73
|
type: "Asset",
|
|
74
74
|
id: "3"
|
|
75
|
-
}), jsx("hp", null, " between"), jsx("hembed", {
|
|
75
|
+
}), /*#__PURE__*/ jsx("hp", null, " between"), /*#__PURE__*/ jsx("hembed", {
|
|
76
76
|
type: "Entry",
|
|
77
77
|
id: "1"
|
|
78
|
-
}), jsx("hp", null, " start"), jsx("hp", null, "end "), jsx("hembed", {
|
|
78
|
+
}), /*#__PURE__*/ jsx("hp", null, " start"), /*#__PURE__*/ jsx("hp", null, "end "), /*#__PURE__*/ jsx("hembed", {
|
|
79
79
|
type: "Entry",
|
|
80
80
|
id: "2"
|
|
81
|
-
}), jsx("hp", null, "in "), jsx("hembed", {
|
|
81
|
+
}), /*#__PURE__*/ jsx("hp", null, "in "), /*#__PURE__*/ jsx("hembed", {
|
|
82
82
|
type: "Entry",
|
|
83
83
|
id: "3"
|
|
84
|
-
}), jsx("hp", null, " between"), jsx("hhr", null), jsx("hp", null, " start"), jsx("hp", null, "end "), jsx("hhr", null), jsx("hp", null, "in "), jsx("hhr", null), jsx("hp", null, " between"));
|
|
84
|
+
}), /*#__PURE__*/ jsx("hp", null, " between"), /*#__PURE__*/ jsx("hhr", null), /*#__PURE__*/ jsx("hp", null, " start"), /*#__PURE__*/ jsx("hp", null, "end "), /*#__PURE__*/ jsx("hhr", null), /*#__PURE__*/ jsx("hp", null, "in "), /*#__PURE__*/ jsx("hhr", null), /*#__PURE__*/ jsx("hp", null, " between"));
|
|
85
85
|
assertOutput({
|
|
86
86
|
input,
|
|
87
87
|
expected
|
|
88
88
|
});
|
|
89
89
|
});
|
|
90
90
|
it('handles heading', ()=>{
|
|
91
|
-
const input = jsx("editor", null, jsx("hp", null, "some", jsx("hh1", null, "heading"), "text"));
|
|
92
|
-
const expected = jsx("editor", null, jsx("hp", null, "some"), jsx("hh1", null, "heading"), jsx("hp", null, "text"));
|
|
91
|
+
const input = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hp", null, "some", /*#__PURE__*/ jsx("hh1", null, "heading"), "text"));
|
|
92
|
+
const expected = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hp", null, "some"), /*#__PURE__*/ jsx("hh1", null, "heading"), /*#__PURE__*/ jsx("hp", null, "text"));
|
|
93
93
|
assertOutput({
|
|
94
94
|
input,
|
|
95
95
|
expected
|
|
96
96
|
});
|
|
97
97
|
});
|
|
98
98
|
it('handles quotes', ()=>{
|
|
99
|
-
const input = jsx("editor", null, jsx("hp", null, "some", jsx("hquote", null, jsx("hp", null, "quote")), "text"));
|
|
100
|
-
const expected = jsx("editor", null, jsx("hp", null, "some"), jsx("hquote", null, jsx("hp", null, "quote")), jsx("hp", null, "text"));
|
|
99
|
+
const input = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hp", null, "some", /*#__PURE__*/ jsx("hquote", null, /*#__PURE__*/ jsx("hp", null, "quote")), "text"));
|
|
100
|
+
const expected = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hp", null, "some"), /*#__PURE__*/ jsx("hquote", null, /*#__PURE__*/ jsx("hp", null, "quote")), /*#__PURE__*/ jsx("hp", null, "text"));
|
|
101
101
|
assertOutput({
|
|
102
102
|
input,
|
|
103
103
|
expected
|
|
104
104
|
});
|
|
105
105
|
});
|
|
106
106
|
it('handles lists', ()=>{
|
|
107
|
-
const input = jsx("editor", null, jsx("hp", null, "some", jsx("hul", null, jsx("hli", null, jsx("hp", null, "list item"))), "text"));
|
|
108
|
-
const expected = jsx("editor", null, jsx("hp", null, "some"), jsx("hul", null, jsx("hli", null, jsx("hp", null, "list item"))), jsx("hp", null, "text"));
|
|
107
|
+
const input = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hp", null, "some", /*#__PURE__*/ jsx("hul", null, /*#__PURE__*/ jsx("hli", null, /*#__PURE__*/ jsx("hp", null, "list item"))), "text"));
|
|
108
|
+
const expected = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hp", null, "some"), /*#__PURE__*/ jsx("hul", null, /*#__PURE__*/ jsx("hli", null, /*#__PURE__*/ jsx("hp", null, "list item"))), /*#__PURE__*/ jsx("hp", null, "text"));
|
|
109
109
|
assertOutput({
|
|
110
110
|
input,
|
|
111
111
|
expected
|
|
112
112
|
});
|
|
113
113
|
});
|
|
114
114
|
it('handles tables', ()=>{
|
|
115
|
-
const input = jsx("editor", null, jsx("hp", null, "some", jsx("htable", null, jsx("htr", null, jsx("htd", null, jsx("hp", null, "cell 1")), jsx("htd", null, jsx("hp", null, "cell 2")))), "text"));
|
|
116
|
-
const expected = jsx("editor", null, jsx("hp", null, "some"), jsx("htable", null, jsx("htr", null, jsx("htd", null, jsx("hp", null, "cell 1")), jsx("htd", null, jsx("hp", null, "cell 2")))), jsx("hp", null, "text"));
|
|
115
|
+
const input = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hp", null, "some", /*#__PURE__*/ jsx("htable", null, /*#__PURE__*/ jsx("htr", null, /*#__PURE__*/ jsx("htd", null, /*#__PURE__*/ jsx("hp", null, "cell 1")), /*#__PURE__*/ jsx("htd", null, /*#__PURE__*/ jsx("hp", null, "cell 2")))), "text"));
|
|
116
|
+
const expected = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hp", null, "some"), /*#__PURE__*/ jsx("htable", null, /*#__PURE__*/ jsx("htr", null, /*#__PURE__*/ jsx("htd", null, /*#__PURE__*/ jsx("hp", null, "cell 1")), /*#__PURE__*/ jsx("htd", null, /*#__PURE__*/ jsx("hp", null, "cell 2")))), /*#__PURE__*/ jsx("hp", null, "text"));
|
|
117
117
|
assertOutput({
|
|
118
118
|
input,
|
|
119
119
|
expected
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { assertOutput, jsx } from '../../../test-utils';
|
|
2
2
|
describe('normalization', ()=>{
|
|
3
3
|
it('can contain inline entries & hyperlinks', ()=>{
|
|
4
|
-
const input = jsx("editor", null, jsx("hquote", null, jsx("hp", null, "some text before", jsx("hinline", {
|
|
4
|
+
const input = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hquote", null, /*#__PURE__*/ jsx("hp", null, "some text before", /*#__PURE__*/ jsx("hinline", {
|
|
5
5
|
type: "Entry",
|
|
6
6
|
id: "inline-entry"
|
|
7
|
-
}), jsx("hlink", {
|
|
7
|
+
}), /*#__PURE__*/ jsx("hlink", {
|
|
8
8
|
uri: "https://contentful.com"
|
|
9
|
-
}), jsx("hlink", {
|
|
9
|
+
}), /*#__PURE__*/ jsx("hlink", {
|
|
10
10
|
entry: "entry-id"
|
|
11
|
-
}), jsx("hlink", {
|
|
11
|
+
}), /*#__PURE__*/ jsx("hlink", {
|
|
12
12
|
resource: "resource-urn"
|
|
13
|
-
}), jsx("hlink", {
|
|
13
|
+
}), /*#__PURE__*/ jsx("hlink", {
|
|
14
14
|
asset: "asset-id"
|
|
15
15
|
}), "some text after")));
|
|
16
16
|
assertOutput({
|
|
@@ -19,16 +19,16 @@ describe('normalization', ()=>{
|
|
|
19
19
|
});
|
|
20
20
|
});
|
|
21
21
|
it('unwraps nested quotes', ()=>{
|
|
22
|
-
const input = jsx("editor", null, jsx("hquote", null, jsx("hp", null, "some"), jsx("hquote", null, jsx("hp", null, jsx("htext", {
|
|
22
|
+
const input = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hquote", null, /*#__PURE__*/ jsx("hp", null, "some"), /*#__PURE__*/ jsx("hquote", null, /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("htext", {
|
|
23
23
|
bold: true,
|
|
24
24
|
italic: true,
|
|
25
25
|
underline: true
|
|
26
|
-
}, "paragraph"))), jsx("hp", null, "text")));
|
|
27
|
-
const expected = jsx("editor", null, jsx("hquote", null, jsx("hp", null, "some"), jsx("hp", null, jsx("htext", {
|
|
26
|
+
}, "paragraph"))), /*#__PURE__*/ jsx("hp", null, "text")));
|
|
27
|
+
const expected = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hquote", null, /*#__PURE__*/ jsx("hp", null, "some"), /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("htext", {
|
|
28
28
|
bold: true,
|
|
29
29
|
italic: true,
|
|
30
30
|
underline: true
|
|
31
|
-
}, "paragraph")), jsx("hp", null, "text")), jsx("hp", null, jsx("htext", null)));
|
|
31
|
+
}, "paragraph")), /*#__PURE__*/ jsx("hp", null, "text")), /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("htext", null)));
|
|
32
32
|
assertOutput({
|
|
33
33
|
input,
|
|
34
34
|
expected
|
|
@@ -36,37 +36,37 @@ describe('normalization', ()=>{
|
|
|
36
36
|
});
|
|
37
37
|
describe('lifts other invalid children', ()=>{
|
|
38
38
|
it('block void elements', ()=>{
|
|
39
|
-
const input = jsx("editor", null, jsx("hquote", null, jsx("hp", null, "this"), jsx("hembed", {
|
|
39
|
+
const input = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hquote", null, /*#__PURE__*/ jsx("hp", null, "this"), /*#__PURE__*/ jsx("hembed", {
|
|
40
40
|
type: "Asset",
|
|
41
41
|
id: "1"
|
|
42
|
-
}), jsx("hp", null, "is"), jsx("hembed", {
|
|
42
|
+
}), /*#__PURE__*/ jsx("hp", null, "is"), /*#__PURE__*/ jsx("hembed", {
|
|
43
43
|
type: "Entry",
|
|
44
44
|
id: "1"
|
|
45
|
-
}), jsx("hp", null, "a blockquote"), jsx("hhr", null), jsx("hh1", null, "Heading 1")));
|
|
46
|
-
const expected = jsx("editor", null, jsx("hquote", null, jsx("hp", null, "this")), jsx("hembed", {
|
|
45
|
+
}), /*#__PURE__*/ jsx("hp", null, "a blockquote"), /*#__PURE__*/ jsx("hhr", null), /*#__PURE__*/ jsx("hh1", null, "Heading 1")));
|
|
46
|
+
const expected = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hquote", null, /*#__PURE__*/ jsx("hp", null, "this")), /*#__PURE__*/ jsx("hembed", {
|
|
47
47
|
type: "Asset",
|
|
48
48
|
id: "1"
|
|
49
|
-
}), jsx("hquote", null, jsx("hp", null, "is")), jsx("hembed", {
|
|
49
|
+
}), /*#__PURE__*/ jsx("hquote", null, /*#__PURE__*/ jsx("hp", null, "is")), /*#__PURE__*/ jsx("hembed", {
|
|
50
50
|
type: "Entry",
|
|
51
51
|
id: "1"
|
|
52
|
-
}), jsx("hquote", null, jsx("hp", null, "a blockquote")), jsx("hhr", null), jsx("hh1", null, "Heading 1"), jsx("hp", null, jsx("text", null)));
|
|
52
|
+
}), /*#__PURE__*/ jsx("hquote", null, /*#__PURE__*/ jsx("hp", null, "a blockquote")), /*#__PURE__*/ jsx("hhr", null), /*#__PURE__*/ jsx("hh1", null, "Heading 1"), /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("text", null)));
|
|
53
53
|
assertOutput({
|
|
54
54
|
input,
|
|
55
55
|
expected
|
|
56
56
|
});
|
|
57
57
|
});
|
|
58
58
|
it('handles lists', ()=>{
|
|
59
|
-
const input = jsx("editor", null, jsx("hquote", null, jsx("hp", null, "some", jsx("hul", null, jsx("hli", null, jsx("hp", null, "list item"))), "text")));
|
|
60
|
-
const expected = jsx("editor", null, jsx("hquote", null, jsx("hp", null, "some")), jsx("hul", null, jsx("hli", null, jsx("hp", null, "list item"))), jsx("hquote", null, jsx("hp", null, "text")), jsx("hp", null, jsx("text", null)));
|
|
59
|
+
const input = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hquote", null, /*#__PURE__*/ jsx("hp", null, "some", /*#__PURE__*/ jsx("hul", null, /*#__PURE__*/ jsx("hli", null, /*#__PURE__*/ jsx("hp", null, "list item"))), "text")));
|
|
60
|
+
const expected = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hquote", null, /*#__PURE__*/ jsx("hp", null, "some")), /*#__PURE__*/ jsx("hul", null, /*#__PURE__*/ jsx("hli", null, /*#__PURE__*/ jsx("hp", null, "list item"))), /*#__PURE__*/ jsx("hquote", null, /*#__PURE__*/ jsx("hp", null, "text")), /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("text", null)));
|
|
61
61
|
assertOutput({
|
|
62
62
|
input,
|
|
63
63
|
expected
|
|
64
64
|
});
|
|
65
65
|
});
|
|
66
66
|
it('handles tables', ()=>{
|
|
67
|
-
const table = jsx("htable", null, jsx("htr", null, jsx("htd", null, jsx("hp", null, "cell 1")), jsx("htd", null, jsx("hp", null, "cell 2"))));
|
|
68
|
-
const input = jsx("editor", null, jsx("hquote", null, jsx("hp", null, "some", table, "text")));
|
|
69
|
-
const expected = jsx("editor", null, jsx("hquote", null, jsx("hp", null, "some")), table, jsx("hquote", null, jsx("hp", null, "text")), jsx("hp", null, jsx("text", null)));
|
|
67
|
+
const table = /*#__PURE__*/ jsx("htable", null, /*#__PURE__*/ jsx("htr", null, /*#__PURE__*/ jsx("htd", null, /*#__PURE__*/ jsx("hp", null, "cell 1")), /*#__PURE__*/ jsx("htd", null, /*#__PURE__*/ jsx("hp", null, "cell 2"))));
|
|
68
|
+
const input = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hquote", null, /*#__PURE__*/ jsx("hp", null, "some", table, "text")));
|
|
69
|
+
const expected = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hquote", null, /*#__PURE__*/ jsx("hp", null, "some")), table, /*#__PURE__*/ jsx("hquote", null, /*#__PURE__*/ jsx("hp", null, "text")), /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("text", null)));
|
|
70
70
|
assertOutput({
|
|
71
71
|
input,
|
|
72
72
|
expected
|
|
@@ -13,11 +13,11 @@ export function ToolbarQuoteButton(props) {
|
|
|
13
13
|
focus(editor);
|
|
14
14
|
}
|
|
15
15
|
if (!editor) return null;
|
|
16
|
-
return React.createElement(ToolbarButton, {
|
|
16
|
+
return /*#__PURE__*/ React.createElement(ToolbarButton, {
|
|
17
17
|
title: "Blockquote",
|
|
18
18
|
onClick: handleOnClick,
|
|
19
19
|
testId: "quote-toolbar-button",
|
|
20
20
|
isDisabled: props.isDisabled,
|
|
21
21
|
isActive: isBlockSelected(editor, BLOCKS.QUOTE)
|
|
22
|
-
}, React.createElement(QuoteIcon, null));
|
|
22
|
+
}, /*#__PURE__*/ React.createElement(QuoteIcon, null));
|
|
23
23
|
}
|
|
@@ -2,25 +2,25 @@ import { assertOutput, jsx } from '../../../test-utils';
|
|
|
2
2
|
describe('normalization', ()=>{
|
|
3
3
|
describe('Table', ()=>{
|
|
4
4
|
it('removes empty table nodes', ()=>{
|
|
5
|
-
const input = jsx("editor", null, jsx("htable", null));
|
|
6
|
-
const expected = jsx("editor", null, jsx("hp", null, jsx("text", null)));
|
|
5
|
+
const input = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("htable", null));
|
|
6
|
+
const expected = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("text", null)));
|
|
7
7
|
assertOutput({
|
|
8
8
|
input,
|
|
9
9
|
expected
|
|
10
10
|
});
|
|
11
11
|
});
|
|
12
12
|
it('moves tables to the root level except nested tables', ()=>{
|
|
13
|
-
const table = jsx("htable", null, jsx("htr", null, jsx("htd", null, jsx("hp", null, "Cell 1")), jsx("htd", null, jsx("hp", null, "Cell 2"))));
|
|
14
|
-
const input = jsx("editor", null, jsx("hp", null, "hello", table), jsx("hquote", null, jsx("hp", null, "quote", table)), jsx("hul", null, jsx("hli", null, jsx("hp", null, "item", table))), jsx("htable", null, jsx("htr", null, jsx("htd", null, jsx("hp", null, "cell with table: ", table)))));
|
|
15
|
-
const expected = jsx("editor", null, jsx("hp", null, "hello"), table, jsx("hquote", null, jsx("hp", null, "quote")), table, jsx("hul", null, jsx("hli", null, jsx("hp", null, "item"))), table, jsx("htable", null, jsx("htr", null, jsx("htd", null, jsx("hp", null, "cell with table: "), jsx("hp", null, "Cell 1"), jsx("hp", null, "Cell 2")))), jsx("hp", null, jsx("htext", null)));
|
|
13
|
+
const table = /*#__PURE__*/ jsx("htable", null, /*#__PURE__*/ jsx("htr", null, /*#__PURE__*/ jsx("htd", null, /*#__PURE__*/ jsx("hp", null, "Cell 1")), /*#__PURE__*/ jsx("htd", null, /*#__PURE__*/ jsx("hp", null, "Cell 2"))));
|
|
14
|
+
const input = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hp", null, "hello", table), /*#__PURE__*/ jsx("hquote", null, /*#__PURE__*/ jsx("hp", null, "quote", table)), /*#__PURE__*/ jsx("hul", null, /*#__PURE__*/ jsx("hli", null, /*#__PURE__*/ jsx("hp", null, "item", table))), /*#__PURE__*/ jsx("htable", null, /*#__PURE__*/ jsx("htr", null, /*#__PURE__*/ jsx("htd", null, /*#__PURE__*/ jsx("hp", null, "cell with table: ", table)))));
|
|
15
|
+
const expected = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hp", null, "hello"), table, /*#__PURE__*/ jsx("hquote", null, /*#__PURE__*/ jsx("hp", null, "quote")), table, /*#__PURE__*/ jsx("hul", null, /*#__PURE__*/ jsx("hli", null, /*#__PURE__*/ jsx("hp", null, "item"))), table, /*#__PURE__*/ jsx("htable", null, /*#__PURE__*/ jsx("htr", null, /*#__PURE__*/ jsx("htd", null, /*#__PURE__*/ jsx("hp", null, "cell with table: "), /*#__PURE__*/ jsx("hp", null, "Cell 1"), /*#__PURE__*/ jsx("hp", null, "Cell 2")))), /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("htext", null)));
|
|
16
16
|
assertOutput({
|
|
17
17
|
input,
|
|
18
18
|
expected
|
|
19
19
|
});
|
|
20
20
|
});
|
|
21
21
|
it('removes invalid children', ()=>{
|
|
22
|
-
const input = jsx("editor", null, jsx("htable", null, jsx("htr", null, jsx("htd", null, jsx("hp", null, "Cell 1")), jsx("htd", null, jsx("hp", null, "Cell 2"))), jsx("htd", null, "invalid cell"), "invalid text"), jsx("hp", null));
|
|
23
|
-
const expected = jsx("editor", null, jsx("htable", null, jsx("htr", null, jsx("htd", null, jsx("hp", null, "Cell 1")), jsx("htd", null, jsx("hp", null, "Cell 2")))), jsx("hp", null, jsx("htext", null)));
|
|
22
|
+
const input = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("htable", null, /*#__PURE__*/ jsx("htr", null, /*#__PURE__*/ jsx("htd", null, /*#__PURE__*/ jsx("hp", null, "Cell 1")), /*#__PURE__*/ jsx("htd", null, /*#__PURE__*/ jsx("hp", null, "Cell 2"))), /*#__PURE__*/ jsx("htd", null, "invalid cell"), "invalid text"), /*#__PURE__*/ jsx("hp", null));
|
|
23
|
+
const expected = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("htable", null, /*#__PURE__*/ jsx("htr", null, /*#__PURE__*/ jsx("htd", null, /*#__PURE__*/ jsx("hp", null, "Cell 1")), /*#__PURE__*/ jsx("htd", null, /*#__PURE__*/ jsx("hp", null, "Cell 2")))), /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("htext", null)));
|
|
24
24
|
assertOutput({
|
|
25
25
|
input,
|
|
26
26
|
expected
|
|
@@ -29,22 +29,22 @@ describe('normalization', ()=>{
|
|
|
29
29
|
});
|
|
30
30
|
describe('Table cell', ()=>{
|
|
31
31
|
it('converts invalid children to paragraphs', ()=>{
|
|
32
|
-
const input = jsx("editor", null, jsx("htable", null, jsx("htr", null, jsx("htd", null, jsx("hp", null, "Cell 1")), jsx("htd", null, jsx("hp", null, "Cell 2"), jsx("hquote", null, jsx("hp", null, jsx("htext", {
|
|
32
|
+
const input = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("htable", null, /*#__PURE__*/ jsx("htr", null, /*#__PURE__*/ jsx("htd", null, /*#__PURE__*/ jsx("hp", null, "Cell 1")), /*#__PURE__*/ jsx("htd", null, /*#__PURE__*/ jsx("hp", null, "Cell 2"), /*#__PURE__*/ jsx("hquote", null, /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("htext", {
|
|
33
33
|
bold: true,
|
|
34
34
|
italic: true,
|
|
35
35
|
underline: true
|
|
36
|
-
}, "quote"), jsx("hinline", {
|
|
36
|
+
}, "quote"), /*#__PURE__*/ jsx("hinline", {
|
|
37
37
|
type: "Entry",
|
|
38
38
|
id: "entry-id"
|
|
39
|
-
})))))), jsx("hp", null));
|
|
40
|
-
const expected = jsx("editor", null, jsx("htable", null, jsx("htr", null, jsx("htd", null, jsx("hp", null, "Cell 1")), jsx("htd", null, jsx("hp", null, "Cell 2"), jsx("hp", null, jsx("htext", {
|
|
39
|
+
})))))), /*#__PURE__*/ jsx("hp", null));
|
|
40
|
+
const expected = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("htable", null, /*#__PURE__*/ jsx("htr", null, /*#__PURE__*/ jsx("htd", null, /*#__PURE__*/ jsx("hp", null, "Cell 1")), /*#__PURE__*/ jsx("htd", null, /*#__PURE__*/ jsx("hp", null, "Cell 2"), /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("htext", {
|
|
41
41
|
bold: true,
|
|
42
42
|
italic: true,
|
|
43
43
|
underline: true
|
|
44
|
-
}, "quote"), jsx("hinline", {
|
|
44
|
+
}, "quote"), /*#__PURE__*/ jsx("hinline", {
|
|
45
45
|
type: "Entry",
|
|
46
46
|
id: "entry-id"
|
|
47
|
-
}), jsx("htext", null))))), jsx("hp", null, jsx("htext", null)));
|
|
47
|
+
}), /*#__PURE__*/ jsx("htext", null))))), /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("htext", null)));
|
|
48
48
|
assertOutput({
|
|
49
49
|
input,
|
|
50
50
|
expected
|
|
@@ -53,32 +53,32 @@ describe('normalization', ()=>{
|
|
|
53
53
|
});
|
|
54
54
|
describe('Table row', ()=>{
|
|
55
55
|
it('must be wrapped in a table', ()=>{
|
|
56
|
-
const input = jsx("editor", null, jsx("htr", null, jsx("htd", null, jsx("hp", null, "cell"))));
|
|
57
|
-
const expected = jsx("editor", null, jsx("htable", null, jsx("htr", null, jsx("htd", null, jsx("hp", null, "cell")))), jsx("hp", null, jsx("text", null)));
|
|
56
|
+
const input = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("htr", null, /*#__PURE__*/ jsx("htd", null, /*#__PURE__*/ jsx("hp", null, "cell"))));
|
|
57
|
+
const expected = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("htable", null, /*#__PURE__*/ jsx("htr", null, /*#__PURE__*/ jsx("htd", null, /*#__PURE__*/ jsx("hp", null, "cell")))), /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("text", null)));
|
|
58
58
|
assertOutput({
|
|
59
59
|
input,
|
|
60
60
|
expected
|
|
61
61
|
});
|
|
62
62
|
});
|
|
63
63
|
it('removes empty rows', ()=>{
|
|
64
|
-
const input = jsx("editor", null, jsx("htr", null));
|
|
65
|
-
const expected = jsx("editor", null, jsx("hp", null, jsx("text", null)));
|
|
64
|
+
const input = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("htr", null));
|
|
65
|
+
const expected = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("text", null)));
|
|
66
66
|
assertOutput({
|
|
67
67
|
input,
|
|
68
68
|
expected
|
|
69
69
|
});
|
|
70
70
|
});
|
|
71
71
|
it('wraps invalid children in table cells', ()=>{
|
|
72
|
-
const input = jsx("editor", null, jsx("htable", null, jsx("htr", null, jsx("htd", null, jsx("hp", null, "cell 1")), jsx("hp", null, "cell 2"))));
|
|
73
|
-
const expected = jsx("editor", null, jsx("htable", null, jsx("htr", null, jsx("htd", null, jsx("hp", null, "cell 1")), jsx("htd", null, jsx("hp", null, "cell 2")))), jsx("hp", null, jsx("text", null)));
|
|
72
|
+
const input = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("htable", null, /*#__PURE__*/ jsx("htr", null, /*#__PURE__*/ jsx("htd", null, /*#__PURE__*/ jsx("hp", null, "cell 1")), /*#__PURE__*/ jsx("hp", null, "cell 2"))));
|
|
73
|
+
const expected = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("htable", null, /*#__PURE__*/ jsx("htr", null, /*#__PURE__*/ jsx("htd", null, /*#__PURE__*/ jsx("hp", null, "cell 1")), /*#__PURE__*/ jsx("htd", null, /*#__PURE__*/ jsx("hp", null, "cell 2")))), /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("text", null)));
|
|
74
74
|
assertOutput({
|
|
75
75
|
input,
|
|
76
76
|
expected
|
|
77
77
|
});
|
|
78
78
|
});
|
|
79
79
|
it('ensures all table rows have the same width', ()=>{
|
|
80
|
-
const input = jsx("editor", null, jsx("htable", null, jsx("htr", null, jsx("htd", null, jsx("hp", null, "cell 1"))), jsx("htr", null, jsx("htd", null, jsx("hp", null, "cell 2")), jsx("htd", null, jsx("hp", null, "cell 3")), jsx("htd", null, jsx("hp", null, "cell 4"))), jsx("htr", null, jsx("htd", null, jsx("hp", null, "cell 5")), jsx("htd", null, jsx("hp", null, "cell 6")))));
|
|
81
|
-
const expected = jsx("editor", null, jsx("htable", null, jsx("htr", null, jsx("htd", null, jsx("hp", null, "cell 1")), jsx("htd", null, jsx("hp", null, jsx("text", null))), jsx("htd", null, jsx("hp", null, jsx("text", null)))), jsx("htr", null, jsx("htd", null, jsx("hp", null, "cell 2")), jsx("htd", null, jsx("hp", null, "cell 3")), jsx("htd", null, jsx("hp", null, "cell 4"))), jsx("htr", null, jsx("htd", null, jsx("hp", null, "cell 5")), jsx("htd", null, jsx("hp", null, "cell 6")), jsx("htd", null, jsx("hp", null, jsx("text", null))))), jsx("hp", null, jsx("text", null)));
|
|
80
|
+
const input = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("htable", null, /*#__PURE__*/ jsx("htr", null, /*#__PURE__*/ jsx("htd", null, /*#__PURE__*/ jsx("hp", null, "cell 1"))), /*#__PURE__*/ jsx("htr", null, /*#__PURE__*/ jsx("htd", null, /*#__PURE__*/ jsx("hp", null, "cell 2")), /*#__PURE__*/ jsx("htd", null, /*#__PURE__*/ jsx("hp", null, "cell 3")), /*#__PURE__*/ jsx("htd", null, /*#__PURE__*/ jsx("hp", null, "cell 4"))), /*#__PURE__*/ jsx("htr", null, /*#__PURE__*/ jsx("htd", null, /*#__PURE__*/ jsx("hp", null, "cell 5")), /*#__PURE__*/ jsx("htd", null, /*#__PURE__*/ jsx("hp", null, "cell 6")))));
|
|
81
|
+
const expected = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("htable", null, /*#__PURE__*/ jsx("htr", null, /*#__PURE__*/ jsx("htd", null, /*#__PURE__*/ jsx("hp", null, "cell 1")), /*#__PURE__*/ jsx("htd", null, /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("text", null))), /*#__PURE__*/ jsx("htd", null, /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("text", null)))), /*#__PURE__*/ jsx("htr", null, /*#__PURE__*/ jsx("htd", null, /*#__PURE__*/ jsx("hp", null, "cell 2")), /*#__PURE__*/ jsx("htd", null, /*#__PURE__*/ jsx("hp", null, "cell 3")), /*#__PURE__*/ jsx("htd", null, /*#__PURE__*/ jsx("hp", null, "cell 4"))), /*#__PURE__*/ jsx("htr", null, /*#__PURE__*/ jsx("htd", null, /*#__PURE__*/ jsx("hp", null, "cell 5")), /*#__PURE__*/ jsx("htd", null, /*#__PURE__*/ jsx("hp", null, "cell 6")), /*#__PURE__*/ jsx("htd", null, /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("text", null))))), /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("text", null)));
|
|
82
82
|
assertOutput({
|
|
83
83
|
input,
|
|
84
84
|
expected
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx, assertOutput, createTestEditor } from '../../../test-utils';
|
|
2
2
|
import { insertTableAndFocusFirstCell } from '../helpers';
|
|
3
3
|
test('insertTableAndFocusFirstCell', ()=>{
|
|
4
|
-
const input = jsx("editor", null, jsx("hp", null, jsx("htext", null), jsx("cursor", null)), jsx("hp", null));
|
|
4
|
+
const input = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("htext", null), /*#__PURE__*/ jsx("cursor", null)), /*#__PURE__*/ jsx("hp", null));
|
|
5
5
|
const { editor } = createTestEditor({
|
|
6
6
|
input
|
|
7
7
|
});
|
|
8
8
|
insertTableAndFocusFirstCell(editor);
|
|
9
|
-
const expected = jsx("editor", null, jsx("htable", null, jsx("htr", null, jsx("hth", null, jsx("hp", null, jsx("htext", null), jsx("cursor", null))), jsx("hth", null, jsx("hp", null, jsx("htext", null)))), jsx("htr", null, jsx("htd", null, jsx("hp", null, jsx("htext", null))), jsx("htd", null, jsx("hp", null, jsx("htext", null))))), jsx("hp", null, jsx("htext", null)));
|
|
9
|
+
const expected = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("htable", null, /*#__PURE__*/ jsx("htr", null, /*#__PURE__*/ jsx("hth", null, /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("htext", null), /*#__PURE__*/ jsx("cursor", null))), /*#__PURE__*/ jsx("hth", null, /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("htext", null)))), /*#__PURE__*/ jsx("htr", null, /*#__PURE__*/ jsx("htd", null, /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("htext", null))), /*#__PURE__*/ jsx("htd", null, /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("htext", null))))), /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("htext", null)));
|
|
10
10
|
assertOutput({
|
|
11
11
|
input,
|
|
12
12
|
expected
|
|
@@ -17,9 +17,9 @@ const style = css`
|
|
|
17
17
|
`;
|
|
18
18
|
export const Cell = (props)=>{
|
|
19
19
|
const isSelected = useSelected();
|
|
20
|
-
return React.createElement("td", {
|
|
20
|
+
return /*#__PURE__*/ React.createElement("td", {
|
|
21
21
|
...props.attributes,
|
|
22
22
|
...props.element.data,
|
|
23
23
|
className: style
|
|
24
|
-
}, isSelected && React.createElement(TableActions, null), props.children);
|
|
24
|
+
}, isSelected && /*#__PURE__*/ React.createElement(TableActions, null), props.children);
|
|
25
25
|
};
|
|
@@ -20,9 +20,9 @@ const style = css`
|
|
|
20
20
|
`;
|
|
21
21
|
export const HeaderCell = (props)=>{
|
|
22
22
|
const isSelected = useSelected();
|
|
23
|
-
return React.createElement("th", {
|
|
23
|
+
return /*#__PURE__*/ React.createElement("th", {
|
|
24
24
|
...props.attributes,
|
|
25
25
|
...props.element.data,
|
|
26
26
|
className: style
|
|
27
|
-
}, isSelected && React.createElement(TableActions, null), props.children);
|
|
27
|
+
}, isSelected && /*#__PURE__*/ React.createElement(TableActions, null), props.children);
|
|
28
28
|
};
|
|
@@ -9,7 +9,7 @@ const style = css`
|
|
|
9
9
|
background-color: transparent !important;
|
|
10
10
|
}
|
|
11
11
|
`;
|
|
12
|
-
export const Row = (props)
|
|
12
|
+
export const Row = (props)=>/*#__PURE__*/ React.createElement("tr", {
|
|
13
13
|
...props.attributes,
|
|
14
14
|
className: style
|
|
15
15
|
}, props.children);
|
|
@@ -13,10 +13,10 @@ const style = css`
|
|
|
13
13
|
overflow: hidden;
|
|
14
14
|
`;
|
|
15
15
|
export const Table = (props)=>{
|
|
16
|
-
return React.createElement("div", {
|
|
16
|
+
return /*#__PURE__*/ React.createElement("div", {
|
|
17
17
|
"data-block-type": BLOCKS.TABLE
|
|
18
|
-
}, React.createElement("table", {
|
|
18
|
+
}, /*#__PURE__*/ React.createElement("table", {
|
|
19
19
|
className: style,
|
|
20
20
|
...props.attributes
|
|
21
|
-
}, React.createElement("tbody", null, props.children)));
|
|
21
|
+
}, /*#__PURE__*/ React.createElement("tbody", null, props.children)));
|
|
22
22
|
};
|