@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
|
@@ -63,47 +63,47 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
63
63
|
}
|
|
64
64
|
return newObj;
|
|
65
65
|
}
|
|
66
|
-
const Group = ({ commandGroup, selectedItem })
|
|
66
|
+
const Group = ({ commandGroup, selectedItem })=>/*#__PURE__*/ _react.createElement("section", {
|
|
67
67
|
key: commandGroup.group
|
|
68
|
-
}, _react.createElement(_f36components.SectionHeading, {
|
|
68
|
+
}, /*#__PURE__*/ _react.createElement(_f36components.SectionHeading, {
|
|
69
69
|
as: "h3",
|
|
70
70
|
marginBottom: "spacingS",
|
|
71
71
|
marginTop: "spacingS",
|
|
72
72
|
marginLeft: "spacingM",
|
|
73
73
|
marginRight: "spacingM"
|
|
74
|
-
}, commandGroup.group), commandGroup.commands.map((command)
|
|
74
|
+
}, commandGroup.group), commandGroup.commands.map((command)=>/*#__PURE__*/ _react.createElement("button", {
|
|
75
75
|
key: command.id,
|
|
76
76
|
id: command.id,
|
|
77
77
|
className: (0, _emotion.cx)(_CommandListstyles.default.menuItem, {
|
|
78
78
|
[_CommandListstyles.default.menuItemSelected]: command.id === selectedItem
|
|
79
79
|
}),
|
|
80
80
|
onClick: command.callback
|
|
81
|
-
}, command.label)), _react.createElement("hr", {
|
|
81
|
+
}, command.label)), /*#__PURE__*/ _react.createElement("hr", {
|
|
82
82
|
className: _CommandListstyles.default.menuDivider,
|
|
83
83
|
"aria-orientation": "horizontal"
|
|
84
84
|
}));
|
|
85
|
-
const Asset = ({ command, selectedItem })
|
|
85
|
+
const Asset = ({ command, selectedItem })=>/*#__PURE__*/ _react.createElement("button", {
|
|
86
86
|
key: command.id,
|
|
87
87
|
id: command.id,
|
|
88
88
|
className: (0, _emotion.cx)(_CommandListstyles.default.menuItem, {
|
|
89
89
|
[_CommandListstyles.default.menuItemSelected]: command.id === selectedItem
|
|
90
90
|
}),
|
|
91
91
|
onClick: command.callback
|
|
92
|
-
}, _react.createElement(_f36components.Flex, {
|
|
92
|
+
}, /*#__PURE__*/ _react.createElement(_f36components.Flex, {
|
|
93
93
|
alignItems: "center",
|
|
94
94
|
gap: "spacingS"
|
|
95
|
-
}, command.thumbnail ? _react.createElement("img", {
|
|
95
|
+
}, command.thumbnail ? /*#__PURE__*/ _react.createElement("img", {
|
|
96
96
|
width: "30",
|
|
97
97
|
height: "30",
|
|
98
98
|
src: command.thumbnail,
|
|
99
99
|
alt: "",
|
|
100
100
|
className: _CommandListstyles.default.thumbnail
|
|
101
|
-
}) : _react.createElement(_f36components.AssetIcon, {
|
|
101
|
+
}) : /*#__PURE__*/ _react.createElement(_f36components.AssetIcon, {
|
|
102
102
|
width: "30",
|
|
103
103
|
height: "30",
|
|
104
104
|
className: _CommandListstyles.default.thumbnail
|
|
105
|
-
}), _react.createElement("span", null, command.label)));
|
|
106
|
-
const Item = ({ command, selectedItem })
|
|
105
|
+
}), /*#__PURE__*/ _react.createElement("span", null, command.label)));
|
|
106
|
+
const Item = ({ command, selectedItem })=>/*#__PURE__*/ _react.createElement("button", {
|
|
107
107
|
key: command.id,
|
|
108
108
|
id: command.id,
|
|
109
109
|
className: (0, _emotion.cx)(_CommandListstyles.default.menuItem, {
|
|
@@ -112,16 +112,16 @@ const Item = ({ command, selectedItem })=>_react.createElement("button", {
|
|
|
112
112
|
onClick: command.callback
|
|
113
113
|
}, command.label);
|
|
114
114
|
const CommandListItems = ({ commandItems, selectedItem })=>{
|
|
115
|
-
return _react.createElement(_react.Fragment, null, commandItems.map((command)=>{
|
|
116
|
-
return 'group' in command ? _react.createElement(Group, {
|
|
115
|
+
return /*#__PURE__*/ _react.createElement(_react.Fragment, null, commandItems.map((command)=>{
|
|
116
|
+
return 'group' in command ? /*#__PURE__*/ _react.createElement(Group, {
|
|
117
117
|
key: command.group,
|
|
118
118
|
commandGroup: command,
|
|
119
119
|
selectedItem: selectedItem
|
|
120
|
-
}) : command.asset ? _react.createElement(Asset, {
|
|
120
|
+
}) : command.asset ? /*#__PURE__*/ _react.createElement(Asset, {
|
|
121
121
|
key: command.id,
|
|
122
122
|
command: command,
|
|
123
123
|
selectedItem: selectedItem
|
|
124
|
-
}) : _react.createElement(Item, {
|
|
124
|
+
}) : /*#__PURE__*/ _react.createElement(Item, {
|
|
125
125
|
key: command.id,
|
|
126
126
|
command: command,
|
|
127
127
|
selectedItem: selectedItem
|
|
@@ -139,42 +139,42 @@ const CommandList = ({ query, editor, textContainer })=>{
|
|
|
139
139
|
if (!commandItems.length) {
|
|
140
140
|
return null;
|
|
141
141
|
}
|
|
142
|
-
return _react.createElement("div", {
|
|
142
|
+
return /*#__PURE__*/ _react.createElement("div", {
|
|
143
143
|
className: _CommandListstyles.default.container,
|
|
144
144
|
tabIndex: -1,
|
|
145
145
|
contentEditable: false
|
|
146
|
-
}, _react.createElement("div", {
|
|
146
|
+
}, /*#__PURE__*/ _react.createElement("div", {
|
|
147
147
|
role: "alert"
|
|
148
|
-
}, _react.createElement(_f36components.ScreenReaderOnly, null, "Richtext commands. Currently focused item: ", selectedItem, ". Press ", _react.createElement("kbd", null, "enter"), " to select, ", _react.createElement("kbd", null, "arrows"), " to navigate, ", _react.createElement("kbd", null, "escape"), " to close.")), _react.createElement(_f36utils.Portal, null, _react.createElement("div", {
|
|
148
|
+
}, /*#__PURE__*/ _react.createElement(_f36components.ScreenReaderOnly, null, "Richtext commands. Currently focused item: ", selectedItem, ". Press ", /*#__PURE__*/ _react.createElement("kbd", null, "enter"), " to select, ", /*#__PURE__*/ _react.createElement("kbd", null, "arrows"), " to navigate, ", /*#__PURE__*/ _react.createElement("kbd", null, "escape"), " to close.")), /*#__PURE__*/ _react.createElement(_f36utils.Portal, null, /*#__PURE__*/ _react.createElement("div", {
|
|
149
149
|
"aria-hidden": true,
|
|
150
150
|
ref: popoverContainer,
|
|
151
151
|
className: _CommandListstyles.default.menuPoper,
|
|
152
152
|
style: popper.styles.popper,
|
|
153
153
|
...popper.attributes.popper
|
|
154
|
-
}, _react.createElement(_f36components.Popover, {
|
|
154
|
+
}, /*#__PURE__*/ _react.createElement(_f36components.Popover, {
|
|
155
155
|
isOpen: isOpen,
|
|
156
156
|
usePortal: false,
|
|
157
157
|
autoFocus: false
|
|
158
|
-
}, _react.createElement(_f36components.Popover.Trigger, null, _react.createElement("span", null)), _react.createElement(_f36components.Popover.Content, {
|
|
158
|
+
}, /*#__PURE__*/ _react.createElement(_f36components.Popover.Trigger, null, /*#__PURE__*/ _react.createElement("span", null)), /*#__PURE__*/ _react.createElement(_f36components.Popover.Content, {
|
|
159
159
|
className: _CommandListstyles.default.menuContent,
|
|
160
160
|
testId: "rich-text-commands"
|
|
161
|
-
}, _react.createElement("header", {
|
|
161
|
+
}, /*#__PURE__*/ _react.createElement("header", {
|
|
162
162
|
className: _CommandListstyles.default.menuHeader
|
|
163
|
-
}, _react.createElement(_f36components.SectionHeading, {
|
|
163
|
+
}, /*#__PURE__*/ _react.createElement(_f36components.SectionHeading, {
|
|
164
164
|
marginBottom: "none"
|
|
165
|
-
}, "Richtext commands")), _react.createElement("div", {
|
|
165
|
+
}, "Richtext commands")), /*#__PURE__*/ _react.createElement("div", {
|
|
166
166
|
className: _CommandListstyles.default.menuList,
|
|
167
167
|
"data-test-id": "rich-text-commands-list"
|
|
168
|
-
}, _react.createElement(CommandListItems, {
|
|
168
|
+
}, /*#__PURE__*/ _react.createElement(CommandListItems, {
|
|
169
169
|
commandItems: commandItems,
|
|
170
170
|
selectedItem: selectedItem
|
|
171
|
-
})), _react.createElement("footer", {
|
|
171
|
+
})), /*#__PURE__*/ _react.createElement("footer", {
|
|
172
172
|
className: _CommandListstyles.default.menuFooter
|
|
173
|
-
}, _react.createElement(_f36components.Stack, {
|
|
173
|
+
}, /*#__PURE__*/ _react.createElement(_f36components.Stack, {
|
|
174
174
|
as: "ul",
|
|
175
175
|
margin: "none",
|
|
176
176
|
padding: "none",
|
|
177
177
|
spacing: "spacingS",
|
|
178
178
|
className: _CommandListstyles.default.footerList
|
|
179
|
-
}, _react.createElement("li", null, _react.createElement("kbd", null, "↑"), _react.createElement("kbd", null, "↓"), " to navigate"), _react.createElement("li", null, _react.createElement("kbd", null, "↵"), " to confirm"), _react.createElement("li", null, _react.createElement("kbd", null, "esc"), " to close"))))))));
|
|
179
|
+
}, /*#__PURE__*/ _react.createElement("li", null, /*#__PURE__*/ _react.createElement("kbd", null, "↑"), /*#__PURE__*/ _react.createElement("kbd", null, "↓"), " to navigate"), /*#__PURE__*/ _react.createElement("li", null, /*#__PURE__*/ _react.createElement("kbd", null, "↵"), " to confirm"), /*#__PURE__*/ _react.createElement("li", null, /*#__PURE__*/ _react.createElement("kbd", null, "esc"), " to close"))))))));
|
|
180
180
|
};
|
|
@@ -70,13 +70,13 @@ const CommandPrompt = (props)=>{
|
|
|
70
70
|
]);
|
|
71
71
|
const editor = props.editor;
|
|
72
72
|
const [textElement, setTextElement] = _react.useState();
|
|
73
|
-
return _react.createElement("span", {
|
|
73
|
+
return /*#__PURE__*/ _react.createElement("span", {
|
|
74
74
|
className: styles.commandPrompt,
|
|
75
75
|
ref: (e)=>{
|
|
76
76
|
setTextElement(e);
|
|
77
77
|
},
|
|
78
78
|
...props.attributes
|
|
79
|
-
}, props.children, _react.createElement(_CommandList.CommandList, {
|
|
79
|
+
}, props.children, /*#__PURE__*/ _react.createElement(_CommandList.CommandList, {
|
|
80
80
|
query: query,
|
|
81
81
|
editor: editor,
|
|
82
82
|
textContainer: textElement
|
|
@@ -87,9 +87,9 @@ function LinkedEntityBlock(props) {
|
|
|
87
87
|
editor,
|
|
88
88
|
element
|
|
89
89
|
]);
|
|
90
|
-
return _react.createElement(_LinkedBlockWrapper.LinkedBlockWrapper, {
|
|
90
|
+
return /*#__PURE__*/ _react.createElement(_LinkedBlockWrapper.LinkedBlockWrapper, {
|
|
91
91
|
attributes: attributes,
|
|
92
|
-
card: _react.createElement(_react.Fragment, null, entityType === 'Entry' && _react.createElement(_FetchingWrappedEntryCard.FetchingWrappedEntryCard, {
|
|
92
|
+
card: /*#__PURE__*/ _react.createElement(_react.Fragment, null, entityType === 'Entry' && /*#__PURE__*/ _react.createElement(_FetchingWrappedEntryCard.FetchingWrappedEntryCard, {
|
|
93
93
|
sdk: sdk,
|
|
94
94
|
entryId: entityId,
|
|
95
95
|
locale: sdk.field.locale,
|
|
@@ -98,7 +98,7 @@ function LinkedEntityBlock(props) {
|
|
|
98
98
|
onRemove: handleRemoveClick,
|
|
99
99
|
onEdit: handleEditClick,
|
|
100
100
|
onEntityFetchComplete: onEntityFetchComplete
|
|
101
|
-
}), entityType === 'Asset' && _react.createElement(_FetchingWrappedAssetCard.FetchingWrappedAssetCard, {
|
|
101
|
+
}), entityType === 'Asset' && /*#__PURE__*/ _react.createElement(_FetchingWrappedAssetCard.FetchingWrappedAssetCard, {
|
|
102
102
|
sdk: sdk,
|
|
103
103
|
assetId: entityId,
|
|
104
104
|
locale: sdk.field.locale,
|
|
@@ -91,32 +91,32 @@ function InternalFetchingWrappedInlineEntryCard({ entry, allContentTypes, locale
|
|
|
91
91
|
locale,
|
|
92
92
|
defaultLocale
|
|
93
93
|
]);
|
|
94
|
-
return _react.createElement(_f36components.InlineEntryCard, {
|
|
94
|
+
return /*#__PURE__*/ _react.createElement(_f36components.InlineEntryCard, {
|
|
95
95
|
testId: _richtexttypes.INLINES.EMBEDDED_ENTRY,
|
|
96
96
|
isSelected: isSelected,
|
|
97
97
|
title: contentType ? `${contentType.name}: ${title}` : title,
|
|
98
98
|
status: entryStatus,
|
|
99
99
|
actions: [
|
|
100
|
-
_react.createElement(_f36components.MenuItem, {
|
|
100
|
+
/*#__PURE__*/ _react.createElement(_f36components.MenuItem, {
|
|
101
101
|
key: "edit",
|
|
102
102
|
onClick: onEdit
|
|
103
103
|
}, "Edit"),
|
|
104
|
-
_react.createElement(_f36components.MenuItem, {
|
|
104
|
+
/*#__PURE__*/ _react.createElement(_f36components.MenuItem, {
|
|
105
105
|
key: "remove",
|
|
106
106
|
onClick: onRemove,
|
|
107
107
|
disabled: isDisabled,
|
|
108
108
|
testId: "delete"
|
|
109
109
|
}, "Remove")
|
|
110
110
|
]
|
|
111
|
-
}, _react.createElement(_fieldeditorreference.ScheduledIconWithTooltip, {
|
|
111
|
+
}, /*#__PURE__*/ _react.createElement(_fieldeditorreference.ScheduledIconWithTooltip, {
|
|
112
112
|
getEntityScheduledActions: getEntityScheduledActions,
|
|
113
113
|
entityType: "Entry",
|
|
114
114
|
entityId: entry.sys.id
|
|
115
|
-
}, _react.createElement(_f36icons.ClockIcon, {
|
|
115
|
+
}, /*#__PURE__*/ _react.createElement(_f36icons.ClockIcon, {
|
|
116
116
|
className: styles.scheduledIcon,
|
|
117
117
|
variant: "muted",
|
|
118
118
|
testId: "scheduled-icon"
|
|
119
|
-
})), _react.createElement(_f36components.Text, null, title));
|
|
119
|
+
})), /*#__PURE__*/ _react.createElement(_f36components.Text, null, title));
|
|
120
120
|
}
|
|
121
121
|
function FetchingWrappedInlineEntryCard(props) {
|
|
122
122
|
const { data: entry, status: requestStatus } = (0, _fieldeditorreference.useEntity)('Entry', props.entryId);
|
|
@@ -132,12 +132,12 @@ function FetchingWrappedInlineEntryCard(props) {
|
|
|
132
132
|
onEntityFetchComplete
|
|
133
133
|
]);
|
|
134
134
|
if (requestStatus === 'loading' || requestStatus === 'idle') {
|
|
135
|
-
return _react.createElement(_f36components.InlineEntryCard, {
|
|
135
|
+
return /*#__PURE__*/ _react.createElement(_f36components.InlineEntryCard, {
|
|
136
136
|
isLoading: true
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
139
|
if (requestStatus === 'error') {
|
|
140
|
-
return _react.createElement(_f36components.InlineEntryCard, {
|
|
140
|
+
return /*#__PURE__*/ _react.createElement(_f36components.InlineEntryCard, {
|
|
141
141
|
title: "Content missing or inaccessible",
|
|
142
142
|
testId: _richtexttypes.INLINES.EMBEDDED_ENTRY,
|
|
143
143
|
isSelected: props.isSelected
|
|
@@ -145,12 +145,12 @@ function FetchingWrappedInlineEntryCard(props) {
|
|
|
145
145
|
}
|
|
146
146
|
const entryStatus = getEntityStatus(entry.sys, props.sdk.parameters.instance.useLocalizedEntityStatus ? props.sdk.field.locale : undefined);
|
|
147
147
|
if (entryStatus === 'deleted') {
|
|
148
|
-
return _react.createElement(_f36components.InlineEntryCard, {
|
|
148
|
+
return /*#__PURE__*/ _react.createElement(_f36components.InlineEntryCard, {
|
|
149
149
|
title: "Content missing or inaccessible",
|
|
150
150
|
testId: _richtexttypes.INLINES.EMBEDDED_ENTRY,
|
|
151
151
|
isSelected: props.isSelected,
|
|
152
152
|
actions: [
|
|
153
|
-
_react.createElement(_f36components.MenuItem, {
|
|
153
|
+
/*#__PURE__*/ _react.createElement(_f36components.MenuItem, {
|
|
154
154
|
key: "remove",
|
|
155
155
|
onClick: props.onRemove,
|
|
156
156
|
testId: "delete"
|
|
@@ -158,7 +158,7 @@ function FetchingWrappedInlineEntryCard(props) {
|
|
|
158
158
|
]
|
|
159
159
|
});
|
|
160
160
|
}
|
|
161
|
-
return _react.createElement(InternalFetchingWrappedInlineEntryCard, {
|
|
161
|
+
return /*#__PURE__*/ _react.createElement(InternalFetchingWrappedInlineEntryCard, {
|
|
162
162
|
allContentTypes: props.sdk.space.getCachedContentTypes(),
|
|
163
163
|
getEntityScheduledActions: ()=>getEntityScheduledActions('Entry', props.entryId),
|
|
164
164
|
locale: props.sdk.field.locale,
|
|
@@ -83,9 +83,9 @@ function LinkedEntityInline(props) {
|
|
|
83
83
|
at: pathToElement
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
|
-
return _react.createElement(_LinkedInlineWrapper.LinkedInlineWrapper, {
|
|
86
|
+
return /*#__PURE__*/ _react.createElement(_LinkedInlineWrapper.LinkedInlineWrapper, {
|
|
87
87
|
attributes: attributes,
|
|
88
|
-
card: _react.createElement(_FetchingWrappedInlineEntryCard.FetchingWrappedInlineEntryCard, {
|
|
88
|
+
card: /*#__PURE__*/ _react.createElement(_FetchingWrappedInlineEntryCard.FetchingWrappedInlineEntryCard, {
|
|
89
89
|
sdk: sdk,
|
|
90
90
|
entryId: entryId,
|
|
91
91
|
isSelected: isSelected,
|
|
@@ -39,10 +39,10 @@ function LinkedResourceBlock(props) {
|
|
|
39
39
|
editor,
|
|
40
40
|
element
|
|
41
41
|
]);
|
|
42
|
-
return _react.default.createElement(_LinkedBlockWrapper.LinkedBlockWrapper, {
|
|
42
|
+
return /*#__PURE__*/ _react.default.createElement(_LinkedBlockWrapper.LinkedBlockWrapper, {
|
|
43
43
|
attributes: attributes,
|
|
44
44
|
link: element.data.target,
|
|
45
|
-
card: _react.default.createElement(_FetchingWrappedResourceCard.FetchingWrappedResourceCard, {
|
|
45
|
+
card: /*#__PURE__*/ _react.default.createElement(_FetchingWrappedResourceCard.FetchingWrappedResourceCard, {
|
|
46
46
|
sdk: sdk,
|
|
47
47
|
link: link,
|
|
48
48
|
isDisabled: isDisabled,
|
|
@@ -70,14 +70,14 @@ function FetchingWrappedResourceInlineCard(props) {
|
|
|
70
70
|
requestStatus
|
|
71
71
|
]);
|
|
72
72
|
if (requestStatus === 'error') {
|
|
73
|
-
return _react.createElement(_f36components.InlineEntryCard, {
|
|
73
|
+
return /*#__PURE__*/ _react.createElement(_f36components.InlineEntryCard, {
|
|
74
74
|
title: "Content missing or inaccessible",
|
|
75
75
|
testId: _richtexttypes.INLINES.EMBEDDED_RESOURCE,
|
|
76
76
|
isSelected: props.isSelected
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
79
|
if (requestStatus === 'loading' || data === undefined) {
|
|
80
|
-
return _react.createElement(_f36components.InlineEntryCard, {
|
|
80
|
+
return /*#__PURE__*/ _react.createElement(_f36components.InlineEntryCard, {
|
|
81
81
|
isLoading: true
|
|
82
82
|
});
|
|
83
83
|
}
|
|
@@ -91,18 +91,18 @@ function FetchingWrappedResourceInlineCard(props) {
|
|
|
91
91
|
});
|
|
92
92
|
const truncatedTitle = (0, _utils.truncateTitle)(title, 40);
|
|
93
93
|
const status = getEntityStatus(entry.sys, props.sdk.parameters.instance.useLocalizedEntityStatus ? props.sdk.field.locale : undefined);
|
|
94
|
-
return _react.createElement(_f36components.InlineEntryCard, {
|
|
94
|
+
return /*#__PURE__*/ _react.createElement(_f36components.InlineEntryCard, {
|
|
95
95
|
testId: _richtexttypes.INLINES.EMBEDDED_RESOURCE,
|
|
96
96
|
isSelected: props.isSelected,
|
|
97
97
|
title: `${contentType.name}: ${truncatedTitle} (Space: ${space.name} – Env.: ${entry.sys.environment.sys.id})`,
|
|
98
98
|
status: status,
|
|
99
99
|
actions: [
|
|
100
|
-
_react.createElement(_f36components.MenuItem, {
|
|
100
|
+
/*#__PURE__*/ _react.createElement(_f36components.MenuItem, {
|
|
101
101
|
key: "remove",
|
|
102
102
|
onClick: props.onRemove,
|
|
103
103
|
disabled: props.isDisabled,
|
|
104
104
|
testId: "delete"
|
|
105
105
|
}, "Remove")
|
|
106
106
|
]
|
|
107
|
-
}, _react.createElement(_f36components.Text, null, title));
|
|
107
|
+
}, /*#__PURE__*/ _react.createElement(_f36components.Text, null, title));
|
|
108
108
|
}
|
|
@@ -36,10 +36,10 @@ function LinkedResourceInline(props) {
|
|
|
36
36
|
at: pathToElement
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
|
-
return _react.default.createElement(_LinkedInlineWrapper.LinkedInlineWrapper, {
|
|
39
|
+
return /*#__PURE__*/ _react.default.createElement(_LinkedInlineWrapper.LinkedInlineWrapper, {
|
|
40
40
|
attributes: attributes,
|
|
41
41
|
link: element.data.target,
|
|
42
|
-
card: _react.default.createElement(_FetchingWrappedResourceInlineCard.FetchingWrappedResourceInlineCard, {
|
|
42
|
+
card: /*#__PURE__*/ _react.default.createElement(_FetchingWrappedResourceInlineCard.FetchingWrappedResourceInlineCard, {
|
|
43
43
|
sdk: sdk,
|
|
44
44
|
link: link,
|
|
45
45
|
isDisabled: isDisabled,
|
|
@@ -5,26 +5,26 @@ 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)("hh1", null, "some text before", (0, _testutils.jsx)("hinline", {
|
|
8
|
+
const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hh1", 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
|
-
}), "some text after"), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
|
|
19
|
+
}), "some text after"), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null)));
|
|
20
20
|
(0, _testutils.assertOutput)({
|
|
21
21
|
input,
|
|
22
22
|
expected: input
|
|
23
23
|
});
|
|
24
24
|
});
|
|
25
25
|
it('unwraps nested paragraphs', ()=>{
|
|
26
|
-
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hh1", null, "one", ' ', (0, _testutils.jsx)("hp", null, "two ", (0, _testutils.jsx)("hp", null, "three ")), "four"));
|
|
27
|
-
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hh1", null, "one two three four"), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
|
|
26
|
+
const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hh1", null, "one", ' ', /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "two ", /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "three ")), "four"));
|
|
27
|
+
const expected = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hh1", null, "one two three four"), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null)));
|
|
28
28
|
(0, _testutils.assertOutput)({
|
|
29
29
|
input,
|
|
30
30
|
expected
|
|
@@ -32,84 +32,84 @@ describe('normalization', ()=>{
|
|
|
32
32
|
});
|
|
33
33
|
describe('lifts other invalid children', ()=>{
|
|
34
34
|
it('block void elements', ()=>{
|
|
35
|
-
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hh1", null, (0, _testutils.jsx)("hembed", {
|
|
35
|
+
const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hh1", null, /*#__PURE__*/ (0, _testutils.jsx)("hembed", {
|
|
36
36
|
type: "Asset",
|
|
37
37
|
id: "1"
|
|
38
|
-
}), " start"), (0, _testutils.jsx)("hh1", null, "end ", (0, _testutils.jsx)("hembed", {
|
|
38
|
+
}), " start"), /*#__PURE__*/ (0, _testutils.jsx)("hh1", null, "end ", /*#__PURE__*/ (0, _testutils.jsx)("hembed", {
|
|
39
39
|
type: "Asset",
|
|
40
40
|
id: "2"
|
|
41
|
-
})), (0, _testutils.jsx)("hh1", null, "in ", (0, _testutils.jsx)("hembed", {
|
|
41
|
+
})), /*#__PURE__*/ (0, _testutils.jsx)("hh1", null, "in ", /*#__PURE__*/ (0, _testutils.jsx)("hembed", {
|
|
42
42
|
type: "Asset",
|
|
43
43
|
id: "3"
|
|
44
|
-
}), " between"), (0, _testutils.jsx)("hh1", null, (0, _testutils.jsx)("hembed", {
|
|
44
|
+
}), " between"), /*#__PURE__*/ (0, _testutils.jsx)("hh1", null, /*#__PURE__*/ (0, _testutils.jsx)("hembed", {
|
|
45
45
|
type: "Entry",
|
|
46
46
|
id: "1"
|
|
47
|
-
}), " start"), (0, _testutils.jsx)("hh1", null, "end ", (0, _testutils.jsx)("hembed", {
|
|
47
|
+
}), " start"), /*#__PURE__*/ (0, _testutils.jsx)("hh1", null, "end ", /*#__PURE__*/ (0, _testutils.jsx)("hembed", {
|
|
48
48
|
type: "Entry",
|
|
49
49
|
id: "2"
|
|
50
|
-
})), (0, _testutils.jsx)("hh1", null, "in ", (0, _testutils.jsx)("hembed", {
|
|
50
|
+
})), /*#__PURE__*/ (0, _testutils.jsx)("hh1", null, "in ", /*#__PURE__*/ (0, _testutils.jsx)("hembed", {
|
|
51
51
|
type: "Entry",
|
|
52
52
|
id: "3"
|
|
53
|
-
}), " between"), (0, _testutils.jsx)("hh1", null, (0, _testutils.jsx)("hhr", null), " start"), (0, _testutils.jsx)("hh1", null, "end ", (0, _testutils.jsx)("hhr", null)), (0, _testutils.jsx)("hh1", null, "in ", (0, _testutils.jsx)("hhr", null), " between"));
|
|
54
|
-
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hembed", {
|
|
53
|
+
}), " between"), /*#__PURE__*/ (0, _testutils.jsx)("hh1", null, /*#__PURE__*/ (0, _testutils.jsx)("hhr", null), " start"), /*#__PURE__*/ (0, _testutils.jsx)("hh1", null, "end ", /*#__PURE__*/ (0, _testutils.jsx)("hhr", null)), /*#__PURE__*/ (0, _testutils.jsx)("hh1", null, "in ", /*#__PURE__*/ (0, _testutils.jsx)("hhr", null), " between"));
|
|
54
|
+
const expected = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hembed", {
|
|
55
55
|
type: "Asset",
|
|
56
56
|
id: "1"
|
|
57
|
-
}), (0, _testutils.jsx)("hh1", null, " start"), (0, _testutils.jsx)("hh1", null, "end "), (0, _testutils.jsx)("hembed", {
|
|
57
|
+
}), /*#__PURE__*/ (0, _testutils.jsx)("hh1", null, " start"), /*#__PURE__*/ (0, _testutils.jsx)("hh1", null, "end "), /*#__PURE__*/ (0, _testutils.jsx)("hembed", {
|
|
58
58
|
type: "Asset",
|
|
59
59
|
id: "2"
|
|
60
|
-
}), (0, _testutils.jsx)("hh1", null, "in "), (0, _testutils.jsx)("hembed", {
|
|
60
|
+
}), /*#__PURE__*/ (0, _testutils.jsx)("hh1", null, "in "), /*#__PURE__*/ (0, _testutils.jsx)("hembed", {
|
|
61
61
|
type: "Asset",
|
|
62
62
|
id: "3"
|
|
63
|
-
}), (0, _testutils.jsx)("hh1", null, " between"), (0, _testutils.jsx)("hembed", {
|
|
63
|
+
}), /*#__PURE__*/ (0, _testutils.jsx)("hh1", null, " between"), /*#__PURE__*/ (0, _testutils.jsx)("hembed", {
|
|
64
64
|
type: "Entry",
|
|
65
65
|
id: "1"
|
|
66
|
-
}), (0, _testutils.jsx)("hh1", null, " start"), (0, _testutils.jsx)("hh1", null, "end "), (0, _testutils.jsx)("hembed", {
|
|
66
|
+
}), /*#__PURE__*/ (0, _testutils.jsx)("hh1", null, " start"), /*#__PURE__*/ (0, _testutils.jsx)("hh1", null, "end "), /*#__PURE__*/ (0, _testutils.jsx)("hembed", {
|
|
67
67
|
type: "Entry",
|
|
68
68
|
id: "2"
|
|
69
|
-
}), (0, _testutils.jsx)("hh1", null, "in "), (0, _testutils.jsx)("hembed", {
|
|
69
|
+
}), /*#__PURE__*/ (0, _testutils.jsx)("hh1", null, "in "), /*#__PURE__*/ (0, _testutils.jsx)("hembed", {
|
|
70
70
|
type: "Entry",
|
|
71
71
|
id: "3"
|
|
72
|
-
}), (0, _testutils.jsx)("hh1", null, " between"), (0, _testutils.jsx)("hhr", null), (0, _testutils.jsx)("hh1", null, " start"), (0, _testutils.jsx)("hh1", null, "end "), (0, _testutils.jsx)("hhr", null), (0, _testutils.jsx)("hh1", null, "in "), (0, _testutils.jsx)("hhr", null), (0, _testutils.jsx)("hh1", null, " between"), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
|
|
72
|
+
}), /*#__PURE__*/ (0, _testutils.jsx)("hh1", null, " between"), /*#__PURE__*/ (0, _testutils.jsx)("hhr", null), /*#__PURE__*/ (0, _testutils.jsx)("hh1", null, " start"), /*#__PURE__*/ (0, _testutils.jsx)("hh1", null, "end "), /*#__PURE__*/ (0, _testutils.jsx)("hhr", null), /*#__PURE__*/ (0, _testutils.jsx)("hh1", null, "in "), /*#__PURE__*/ (0, _testutils.jsx)("hhr", null), /*#__PURE__*/ (0, _testutils.jsx)("hh1", null, " between"), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null)));
|
|
73
73
|
(0, _testutils.assertOutput)({
|
|
74
74
|
input,
|
|
75
75
|
expected
|
|
76
76
|
});
|
|
77
77
|
});
|
|
78
78
|
it('nested headings', ()=>{
|
|
79
|
-
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hh1", null, "some", (0, _testutils.jsx)("hh1", null, (0, _testutils.jsx)("htext", {
|
|
79
|
+
const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hh1", null, "some", /*#__PURE__*/ (0, _testutils.jsx)("hh1", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", {
|
|
80
80
|
bold: true,
|
|
81
81
|
italic: true,
|
|
82
82
|
underline: true
|
|
83
83
|
}, "paragraph")), "text"));
|
|
84
|
-
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hh1", null, "some"), (0, _testutils.jsx)("hh1", null, (0, _testutils.jsx)("htext", {
|
|
84
|
+
const expected = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hh1", null, "some"), /*#__PURE__*/ (0, _testutils.jsx)("hh1", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", {
|
|
85
85
|
bold: true,
|
|
86
86
|
italic: true,
|
|
87
87
|
underline: true
|
|
88
|
-
}, "paragraph")), (0, _testutils.jsx)("hh1", null, "text"), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
|
|
88
|
+
}, "paragraph")), /*#__PURE__*/ (0, _testutils.jsx)("hh1", null, "text"), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null)));
|
|
89
89
|
(0, _testutils.assertOutput)({
|
|
90
90
|
input,
|
|
91
91
|
expected
|
|
92
92
|
});
|
|
93
93
|
});
|
|
94
94
|
it('handles quotes', ()=>{
|
|
95
|
-
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hh1", null, "some", (0, _testutils.jsx)("hquote", null, (0, _testutils.jsx)("hp", null, "quote")), "text"));
|
|
96
|
-
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hh1", null, "some"), (0, _testutils.jsx)("hquote", null, (0, _testutils.jsx)("hp", null, "quote")), (0, _testutils.jsx)("hh1", null, "text"), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
|
|
95
|
+
const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hh1", null, "some", /*#__PURE__*/ (0, _testutils.jsx)("hquote", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "quote")), "text"));
|
|
96
|
+
const expected = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hh1", null, "some"), /*#__PURE__*/ (0, _testutils.jsx)("hquote", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "quote")), /*#__PURE__*/ (0, _testutils.jsx)("hh1", null, "text"), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null)));
|
|
97
97
|
(0, _testutils.assertOutput)({
|
|
98
98
|
input,
|
|
99
99
|
expected
|
|
100
100
|
});
|
|
101
101
|
});
|
|
102
102
|
it('handles lists', ()=>{
|
|
103
|
-
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hh1", null, "some", (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "list item"))), "text"));
|
|
104
|
-
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hh1", null, "some"), (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "list item"))), (0, _testutils.jsx)("hh1", null, "text"), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
|
|
103
|
+
const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hh1", null, "some", /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "list item"))), "text"));
|
|
104
|
+
const expected = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hh1", 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)("hh1", null, "text"), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null)));
|
|
105
105
|
(0, _testutils.assertOutput)({
|
|
106
106
|
input,
|
|
107
107
|
expected
|
|
108
108
|
});
|
|
109
109
|
});
|
|
110
110
|
it('handles tables', ()=>{
|
|
111
|
-
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hh1", 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"));
|
|
112
|
-
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hh1", 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)("hh1", null, "text"), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
|
|
111
|
+
const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hh1", 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"));
|
|
112
|
+
const expected = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hh1", 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)("hh1", null, "text"), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null)));
|
|
113
113
|
(0, _testutils.assertOutput)({
|
|
114
114
|
input,
|
|
115
115
|
expected
|
|
@@ -114,17 +114,17 @@ const styles = {
|
|
|
114
114
|
};
|
|
115
115
|
function createHeading(Tag, block) {
|
|
116
116
|
return function Heading(props) {
|
|
117
|
-
return _react.createElement(Tag, {
|
|
117
|
+
return /*#__PURE__*/ _react.createElement(Tag, {
|
|
118
118
|
...props.attributes,
|
|
119
119
|
className: (0, _emotion.cx)(styles.headings.root, styles.headings[block])
|
|
120
120
|
}, props.children);
|
|
121
121
|
};
|
|
122
122
|
}
|
|
123
123
|
const HeadingComponents = {
|
|
124
|
-
[_richtexttypes.BLOCKS.HEADING_1]: _react.memo(createHeading('h1', _richtexttypes.BLOCKS.HEADING_1)),
|
|
125
|
-
[_richtexttypes.BLOCKS.HEADING_2]: _react.memo(createHeading('h2', _richtexttypes.BLOCKS.HEADING_2)),
|
|
126
|
-
[_richtexttypes.BLOCKS.HEADING_3]: _react.memo(createHeading('h3', _richtexttypes.BLOCKS.HEADING_3)),
|
|
127
|
-
[_richtexttypes.BLOCKS.HEADING_4]: _react.memo(createHeading('h4', _richtexttypes.BLOCKS.HEADING_4)),
|
|
128
|
-
[_richtexttypes.BLOCKS.HEADING_5]: _react.memo(createHeading('h5', _richtexttypes.BLOCKS.HEADING_5)),
|
|
129
|
-
[_richtexttypes.BLOCKS.HEADING_6]: _react.memo(createHeading('h6', _richtexttypes.BLOCKS.HEADING_6))
|
|
124
|
+
[_richtexttypes.BLOCKS.HEADING_1]: /*#__PURE__*/ _react.memo(createHeading('h1', _richtexttypes.BLOCKS.HEADING_1)),
|
|
125
|
+
[_richtexttypes.BLOCKS.HEADING_2]: /*#__PURE__*/ _react.memo(createHeading('h2', _richtexttypes.BLOCKS.HEADING_2)),
|
|
126
|
+
[_richtexttypes.BLOCKS.HEADING_3]: /*#__PURE__*/ _react.memo(createHeading('h3', _richtexttypes.BLOCKS.HEADING_3)),
|
|
127
|
+
[_richtexttypes.BLOCKS.HEADING_4]: /*#__PURE__*/ _react.memo(createHeading('h4', _richtexttypes.BLOCKS.HEADING_4)),
|
|
128
|
+
[_richtexttypes.BLOCKS.HEADING_5]: /*#__PURE__*/ _react.memo(createHeading('h5', _richtexttypes.BLOCKS.HEADING_5)),
|
|
129
|
+
[_richtexttypes.BLOCKS.HEADING_6]: /*#__PURE__*/ _react.memo(createHeading('h6', _richtexttypes.BLOCKS.HEADING_6))
|
|
130
130
|
};
|
|
@@ -166,26 +166,26 @@ function ToolbarHeadingButton(props) {
|
|
|
166
166
|
};
|
|
167
167
|
}
|
|
168
168
|
if (!editor) return null;
|
|
169
|
-
return _react.createElement(_f36components.Menu, {
|
|
169
|
+
return /*#__PURE__*/ _react.createElement(_f36components.Menu, {
|
|
170
170
|
isOpen: isOpen,
|
|
171
171
|
onClose: ()=>setOpen(false)
|
|
172
|
-
}, _react.createElement(_f36components.Menu.Trigger, null, _react.createElement(_f36components.Button, {
|
|
172
|
+
}, /*#__PURE__*/ _react.createElement(_f36components.Menu.Trigger, null, /*#__PURE__*/ _react.createElement(_f36components.Button, {
|
|
173
173
|
size: "small",
|
|
174
174
|
testId: "toolbar-heading-toggle",
|
|
175
175
|
variant: "transparent",
|
|
176
|
-
endIcon: _react.createElement(_f36icons.ChevronDownIcon, null),
|
|
176
|
+
endIcon: /*#__PURE__*/ _react.createElement(_f36icons.ChevronDownIcon, null),
|
|
177
177
|
isDisabled: props.isDisabled,
|
|
178
178
|
onClick: ()=>someHeadingsEnabled && setOpen(!isOpen),
|
|
179
179
|
className: styles.button
|
|
180
|
-
}, LABELS[selected])), _react.createElement(_f36components.Menu.List, {
|
|
180
|
+
}, LABELS[selected])), /*#__PURE__*/ _react.createElement(_f36components.Menu.List, {
|
|
181
181
|
testId: "dropdown-heading-list"
|
|
182
|
-
}, Object.keys(LABELS).map((nodeType)=>nodeTypesByEnablement[nodeType] && _react.createElement(_f36components.Menu.Item, {
|
|
182
|
+
}, Object.keys(LABELS).map((nodeType)=>nodeTypesByEnablement[nodeType] && /*#__PURE__*/ _react.createElement(_f36components.Menu.Item, {
|
|
183
183
|
key: nodeType,
|
|
184
184
|
isInitiallyFocused: selected === nodeType,
|
|
185
185
|
onClick: handleOnSelectItem(nodeType),
|
|
186
186
|
testId: `dropdown-option-${nodeType}`,
|
|
187
187
|
disabled: props.isDisabled
|
|
188
|
-
}, _react.createElement("span", {
|
|
188
|
+
}, /*#__PURE__*/ _react.createElement("span", {
|
|
189
189
|
className: (0, _emotion.cx)(styles.dropdown.root, styles.dropdown[nodeType])
|
|
190
190
|
}, LABELS[nodeType]))).filter(Boolean)));
|
|
191
191
|
}
|
|
@@ -146,25 +146,25 @@ function ToolbarHrButton(props) {
|
|
|
146
146
|
(0, _editor.focus)(editor);
|
|
147
147
|
}
|
|
148
148
|
if (!editor) return null;
|
|
149
|
-
return _react.createElement(_ToolbarButton.ToolbarButton, {
|
|
149
|
+
return /*#__PURE__*/ _react.createElement(_ToolbarButton.ToolbarButton, {
|
|
150
150
|
title: "HR",
|
|
151
151
|
isDisabled: props.isDisabled,
|
|
152
152
|
onClick: handleOnClick,
|
|
153
153
|
testId: "hr-toolbar-button",
|
|
154
154
|
isActive: (0, _editor.isBlockSelected)(editor, _richtexttypes.BLOCKS.HR)
|
|
155
|
-
}, _react.createElement(_f36icons.HorizontalRuleIcon, null));
|
|
155
|
+
}, /*#__PURE__*/ _react.createElement(_f36icons.HorizontalRuleIcon, null));
|
|
156
156
|
}
|
|
157
157
|
function Hr(props) {
|
|
158
158
|
const isSelected = _slatereact.useSelected();
|
|
159
159
|
const isFocused = _slatereact.useFocused();
|
|
160
|
-
return _react.createElement("div", {
|
|
160
|
+
return /*#__PURE__*/ _react.createElement("div", {
|
|
161
161
|
...props.attributes,
|
|
162
162
|
className: styles.container,
|
|
163
163
|
"data-void-element": _richtexttypes.BLOCKS.HR
|
|
164
|
-
}, _react.createElement("div", {
|
|
164
|
+
}, /*#__PURE__*/ _react.createElement("div", {
|
|
165
165
|
draggable: true,
|
|
166
166
|
contentEditable: false
|
|
167
|
-
}, _react.createElement("hr", {
|
|
167
|
+
}, /*#__PURE__*/ _react.createElement("hr", {
|
|
168
168
|
className: (0, _emotion.cx)(styles.hr, isSelected && isFocused ? styles.hrSelected : undefined)
|
|
169
169
|
})), props.children);
|
|
170
170
|
}
|