@contentful/field-editor-rich-text 4.6.0 → 4.8.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/EmbeddedBlockUtil.js +2 -1
- package/dist/cjs/plugins/shared/EmbeddedInlineToolbarIcon.js +4 -4
- package/dist/cjs/plugins/shared/EmbeddedInlineUtil.js +2 -1
- 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/EmbeddedBlockUtil.js +2 -1
- package/dist/esm/plugins/shared/EmbeddedInlineToolbarIcon.js +4 -4
- package/dist/esm/plugins/shared/EmbeddedInlineUtil.js +2 -1
- 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
|
@@ -19,14 +19,14 @@ export function FetchingWrappedResourceInlineCard(props) {
|
|
|
19
19
|
requestStatus
|
|
20
20
|
]);
|
|
21
21
|
if (requestStatus === 'error') {
|
|
22
|
-
return React.createElement(InlineEntryCard, {
|
|
22
|
+
return /*#__PURE__*/ React.createElement(InlineEntryCard, {
|
|
23
23
|
title: "Content missing or inaccessible",
|
|
24
24
|
testId: INLINES.EMBEDDED_RESOURCE,
|
|
25
25
|
isSelected: props.isSelected
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
if (requestStatus === 'loading' || data === undefined) {
|
|
29
|
-
return React.createElement(InlineEntryCard, {
|
|
29
|
+
return /*#__PURE__*/ React.createElement(InlineEntryCard, {
|
|
30
30
|
isLoading: true
|
|
31
31
|
});
|
|
32
32
|
}
|
|
@@ -40,18 +40,18 @@ export function FetchingWrappedResourceInlineCard(props) {
|
|
|
40
40
|
});
|
|
41
41
|
const truncatedTitle = truncateTitle(title, 40);
|
|
42
42
|
const status = getEntityStatus(entry.sys, props.sdk.parameters.instance.useLocalizedEntityStatus ? props.sdk.field.locale : undefined);
|
|
43
|
-
return React.createElement(InlineEntryCard, {
|
|
43
|
+
return /*#__PURE__*/ React.createElement(InlineEntryCard, {
|
|
44
44
|
testId: INLINES.EMBEDDED_RESOURCE,
|
|
45
45
|
isSelected: props.isSelected,
|
|
46
46
|
title: `${contentType.name}: ${truncatedTitle} (Space: ${space.name} – Env.: ${entry.sys.environment.sys.id})`,
|
|
47
47
|
status: status,
|
|
48
48
|
actions: [
|
|
49
|
-
React.createElement(MenuItem, {
|
|
49
|
+
/*#__PURE__*/ React.createElement(MenuItem, {
|
|
50
50
|
key: "remove",
|
|
51
51
|
onClick: props.onRemove,
|
|
52
52
|
disabled: props.isDisabled,
|
|
53
53
|
testId: "delete"
|
|
54
54
|
}, "Remove")
|
|
55
55
|
]
|
|
56
|
-
}, React.createElement(Text, null, title));
|
|
56
|
+
}, /*#__PURE__*/ React.createElement(Text, null, title));
|
|
57
57
|
}
|
|
@@ -21,10 +21,10 @@ export function LinkedResourceInline(props) {
|
|
|
21
21
|
at: pathToElement
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
return React.createElement(LinkedInlineWrapper, {
|
|
24
|
+
return /*#__PURE__*/ React.createElement(LinkedInlineWrapper, {
|
|
25
25
|
attributes: attributes,
|
|
26
26
|
link: element.data.target,
|
|
27
|
-
card: React.createElement(FetchingWrappedResourceInlineCard, {
|
|
27
|
+
card: /*#__PURE__*/ React.createElement(FetchingWrappedResourceInlineCard, {
|
|
28
28
|
sdk: sdk,
|
|
29
29
|
link: link,
|
|
30
30
|
isDisabled: isDisabled,
|
|
@@ -1,26 +1,26 @@
|
|
|
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("hh1", null, "some text before", jsx("hinline", {
|
|
4
|
+
const input = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hh1", 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
|
-
}), "some text after"), jsx("hp", null, jsx("htext", null)));
|
|
15
|
+
}), "some text after"), /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("htext", null)));
|
|
16
16
|
assertOutput({
|
|
17
17
|
input,
|
|
18
18
|
expected: input
|
|
19
19
|
});
|
|
20
20
|
});
|
|
21
21
|
it('unwraps nested paragraphs', ()=>{
|
|
22
|
-
const input = jsx("editor", null, jsx("hh1", null, "one", ' ', jsx("hp", null, "two ", jsx("hp", null, "three ")), "four"));
|
|
23
|
-
const expected = jsx("editor", null, jsx("hh1", null, "one two three four"), jsx("hp", null, jsx("htext", null)));
|
|
22
|
+
const input = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hh1", null, "one", ' ', /*#__PURE__*/ jsx("hp", null, "two ", /*#__PURE__*/ jsx("hp", null, "three ")), "four"));
|
|
23
|
+
const expected = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hh1", null, "one two three four"), /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("htext", null)));
|
|
24
24
|
assertOutput({
|
|
25
25
|
input,
|
|
26
26
|
expected
|
|
@@ -28,84 +28,84 @@ describe('normalization', ()=>{
|
|
|
28
28
|
});
|
|
29
29
|
describe('lifts other invalid children', ()=>{
|
|
30
30
|
it('block void elements', ()=>{
|
|
31
|
-
const input = jsx("editor", null, jsx("hh1", null, jsx("hembed", {
|
|
31
|
+
const input = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hh1", null, /*#__PURE__*/ jsx("hembed", {
|
|
32
32
|
type: "Asset",
|
|
33
33
|
id: "1"
|
|
34
|
-
}), " start"), jsx("hh1", null, "end ", jsx("hembed", {
|
|
34
|
+
}), " start"), /*#__PURE__*/ jsx("hh1", null, "end ", /*#__PURE__*/ jsx("hembed", {
|
|
35
35
|
type: "Asset",
|
|
36
36
|
id: "2"
|
|
37
|
-
})), jsx("hh1", null, "in ", jsx("hembed", {
|
|
37
|
+
})), /*#__PURE__*/ jsx("hh1", null, "in ", /*#__PURE__*/ jsx("hembed", {
|
|
38
38
|
type: "Asset",
|
|
39
39
|
id: "3"
|
|
40
|
-
}), " between"), jsx("hh1", null, jsx("hembed", {
|
|
40
|
+
}), " between"), /*#__PURE__*/ jsx("hh1", null, /*#__PURE__*/ jsx("hembed", {
|
|
41
41
|
type: "Entry",
|
|
42
42
|
id: "1"
|
|
43
|
-
}), " start"), jsx("hh1", null, "end ", jsx("hembed", {
|
|
43
|
+
}), " start"), /*#__PURE__*/ jsx("hh1", null, "end ", /*#__PURE__*/ jsx("hembed", {
|
|
44
44
|
type: "Entry",
|
|
45
45
|
id: "2"
|
|
46
|
-
})), jsx("hh1", null, "in ", jsx("hembed", {
|
|
46
|
+
})), /*#__PURE__*/ jsx("hh1", null, "in ", /*#__PURE__*/ jsx("hembed", {
|
|
47
47
|
type: "Entry",
|
|
48
48
|
id: "3"
|
|
49
|
-
}), " between"), jsx("hh1", null, jsx("hhr", null), " start"), jsx("hh1", null, "end ", jsx("hhr", null)), jsx("hh1", null, "in ", jsx("hhr", null), " between"));
|
|
50
|
-
const expected = jsx("editor", null, jsx("hembed", {
|
|
49
|
+
}), " between"), /*#__PURE__*/ jsx("hh1", null, /*#__PURE__*/ jsx("hhr", null), " start"), /*#__PURE__*/ jsx("hh1", null, "end ", /*#__PURE__*/ jsx("hhr", null)), /*#__PURE__*/ jsx("hh1", null, "in ", /*#__PURE__*/ jsx("hhr", null), " between"));
|
|
50
|
+
const expected = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hembed", {
|
|
51
51
|
type: "Asset",
|
|
52
52
|
id: "1"
|
|
53
|
-
}), jsx("hh1", null, " start"), jsx("hh1", null, "end "), jsx("hembed", {
|
|
53
|
+
}), /*#__PURE__*/ jsx("hh1", null, " start"), /*#__PURE__*/ jsx("hh1", null, "end "), /*#__PURE__*/ jsx("hembed", {
|
|
54
54
|
type: "Asset",
|
|
55
55
|
id: "2"
|
|
56
|
-
}), jsx("hh1", null, "in "), jsx("hembed", {
|
|
56
|
+
}), /*#__PURE__*/ jsx("hh1", null, "in "), /*#__PURE__*/ jsx("hembed", {
|
|
57
57
|
type: "Asset",
|
|
58
58
|
id: "3"
|
|
59
|
-
}), jsx("hh1", null, " between"), jsx("hembed", {
|
|
59
|
+
}), /*#__PURE__*/ jsx("hh1", null, " between"), /*#__PURE__*/ jsx("hembed", {
|
|
60
60
|
type: "Entry",
|
|
61
61
|
id: "1"
|
|
62
|
-
}), jsx("hh1", null, " start"), jsx("hh1", null, "end "), jsx("hembed", {
|
|
62
|
+
}), /*#__PURE__*/ jsx("hh1", null, " start"), /*#__PURE__*/ jsx("hh1", null, "end "), /*#__PURE__*/ jsx("hembed", {
|
|
63
63
|
type: "Entry",
|
|
64
64
|
id: "2"
|
|
65
|
-
}), jsx("hh1", null, "in "), jsx("hembed", {
|
|
65
|
+
}), /*#__PURE__*/ jsx("hh1", null, "in "), /*#__PURE__*/ jsx("hembed", {
|
|
66
66
|
type: "Entry",
|
|
67
67
|
id: "3"
|
|
68
|
-
}), jsx("hh1", null, " between"), jsx("hhr", null), jsx("hh1", null, " start"), jsx("hh1", null, "end "), jsx("hhr", null), jsx("hh1", null, "in "), jsx("hhr", null), jsx("hh1", null, " between"), jsx("hp", null, jsx("htext", null)));
|
|
68
|
+
}), /*#__PURE__*/ jsx("hh1", null, " between"), /*#__PURE__*/ jsx("hhr", null), /*#__PURE__*/ jsx("hh1", null, " start"), /*#__PURE__*/ jsx("hh1", null, "end "), /*#__PURE__*/ jsx("hhr", null), /*#__PURE__*/ jsx("hh1", null, "in "), /*#__PURE__*/ jsx("hhr", null), /*#__PURE__*/ jsx("hh1", null, " between"), /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("htext", null)));
|
|
69
69
|
assertOutput({
|
|
70
70
|
input,
|
|
71
71
|
expected
|
|
72
72
|
});
|
|
73
73
|
});
|
|
74
74
|
it('nested headings', ()=>{
|
|
75
|
-
const input = jsx("editor", null, jsx("hh1", null, "some", jsx("hh1", null, jsx("htext", {
|
|
75
|
+
const input = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hh1", null, "some", /*#__PURE__*/ jsx("hh1", null, /*#__PURE__*/ jsx("htext", {
|
|
76
76
|
bold: true,
|
|
77
77
|
italic: true,
|
|
78
78
|
underline: true
|
|
79
79
|
}, "paragraph")), "text"));
|
|
80
|
-
const expected = jsx("editor", null, jsx("hh1", null, "some"), jsx("hh1", null, jsx("htext", {
|
|
80
|
+
const expected = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hh1", null, "some"), /*#__PURE__*/ jsx("hh1", null, /*#__PURE__*/ jsx("htext", {
|
|
81
81
|
bold: true,
|
|
82
82
|
italic: true,
|
|
83
83
|
underline: true
|
|
84
|
-
}, "paragraph")), jsx("hh1", null, "text"), jsx("hp", null, jsx("htext", null)));
|
|
84
|
+
}, "paragraph")), /*#__PURE__*/ jsx("hh1", null, "text"), /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("htext", null)));
|
|
85
85
|
assertOutput({
|
|
86
86
|
input,
|
|
87
87
|
expected
|
|
88
88
|
});
|
|
89
89
|
});
|
|
90
90
|
it('handles quotes', ()=>{
|
|
91
|
-
const input = jsx("editor", null, jsx("hh1", null, "some", jsx("hquote", null, jsx("hp", null, "quote")), "text"));
|
|
92
|
-
const expected = jsx("editor", null, jsx("hh1", null, "some"), jsx("hquote", null, jsx("hp", null, "quote")), jsx("hh1", null, "text"), jsx("hp", null, jsx("htext", null)));
|
|
91
|
+
const input = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hh1", null, "some", /*#__PURE__*/ jsx("hquote", null, /*#__PURE__*/ jsx("hp", null, "quote")), "text"));
|
|
92
|
+
const expected = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hh1", null, "some"), /*#__PURE__*/ jsx("hquote", null, /*#__PURE__*/ jsx("hp", null, "quote")), /*#__PURE__*/ jsx("hh1", null, "text"), /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("htext", null)));
|
|
93
93
|
assertOutput({
|
|
94
94
|
input,
|
|
95
95
|
expected
|
|
96
96
|
});
|
|
97
97
|
});
|
|
98
98
|
it('handles lists', ()=>{
|
|
99
|
-
const input = jsx("editor", null, jsx("hh1", null, "some", jsx("hul", null, jsx("hli", null, jsx("hp", null, "list item"))), "text"));
|
|
100
|
-
const expected = jsx("editor", null, jsx("hh1", null, "some"), jsx("hul", null, jsx("hli", null, jsx("hp", null, "list item"))), jsx("hh1", null, "text"), jsx("hp", null, jsx("htext", null)));
|
|
99
|
+
const input = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hh1", null, "some", /*#__PURE__*/ jsx("hul", null, /*#__PURE__*/ jsx("hli", null, /*#__PURE__*/ jsx("hp", null, "list item"))), "text"));
|
|
100
|
+
const expected = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hh1", null, "some"), /*#__PURE__*/ jsx("hul", null, /*#__PURE__*/ jsx("hli", null, /*#__PURE__*/ jsx("hp", null, "list item"))), /*#__PURE__*/ jsx("hh1", null, "text"), /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("htext", null)));
|
|
101
101
|
assertOutput({
|
|
102
102
|
input,
|
|
103
103
|
expected
|
|
104
104
|
});
|
|
105
105
|
});
|
|
106
106
|
it('handles tables', ()=>{
|
|
107
|
-
const input = jsx("editor", null, jsx("hh1", 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"));
|
|
108
|
-
const expected = jsx("editor", null, jsx("hh1", 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("hh1", null, "text"), jsx("hp", null, jsx("htext", null)));
|
|
107
|
+
const input = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hh1", 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"));
|
|
108
|
+
const expected = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hh1", 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("hh1", null, "text"), /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("htext", null)));
|
|
109
109
|
assertOutput({
|
|
110
110
|
input,
|
|
111
111
|
expected
|
|
@@ -58,17 +58,17 @@ const styles = {
|
|
|
58
58
|
};
|
|
59
59
|
function createHeading(Tag, block) {
|
|
60
60
|
return function Heading(props) {
|
|
61
|
-
return React.createElement(Tag, {
|
|
61
|
+
return /*#__PURE__*/ React.createElement(Tag, {
|
|
62
62
|
...props.attributes,
|
|
63
63
|
className: cx(styles.headings.root, styles.headings[block])
|
|
64
64
|
}, props.children);
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
67
|
export const HeadingComponents = {
|
|
68
|
-
[BLOCKS.HEADING_1]: React.memo(createHeading('h1', BLOCKS.HEADING_1)),
|
|
69
|
-
[BLOCKS.HEADING_2]: React.memo(createHeading('h2', BLOCKS.HEADING_2)),
|
|
70
|
-
[BLOCKS.HEADING_3]: React.memo(createHeading('h3', BLOCKS.HEADING_3)),
|
|
71
|
-
[BLOCKS.HEADING_4]: React.memo(createHeading('h4', BLOCKS.HEADING_4)),
|
|
72
|
-
[BLOCKS.HEADING_5]: React.memo(createHeading('h5', BLOCKS.HEADING_5)),
|
|
73
|
-
[BLOCKS.HEADING_6]: React.memo(createHeading('h6', BLOCKS.HEADING_6))
|
|
68
|
+
[BLOCKS.HEADING_1]: /*#__PURE__*/ React.memo(createHeading('h1', BLOCKS.HEADING_1)),
|
|
69
|
+
[BLOCKS.HEADING_2]: /*#__PURE__*/ React.memo(createHeading('h2', BLOCKS.HEADING_2)),
|
|
70
|
+
[BLOCKS.HEADING_3]: /*#__PURE__*/ React.memo(createHeading('h3', BLOCKS.HEADING_3)),
|
|
71
|
+
[BLOCKS.HEADING_4]: /*#__PURE__*/ React.memo(createHeading('h4', BLOCKS.HEADING_4)),
|
|
72
|
+
[BLOCKS.HEADING_5]: /*#__PURE__*/ React.memo(createHeading('h5', BLOCKS.HEADING_5)),
|
|
73
|
+
[BLOCKS.HEADING_6]: /*#__PURE__*/ React.memo(createHeading('h6', BLOCKS.HEADING_6))
|
|
74
74
|
};
|
|
@@ -110,26 +110,26 @@ export function ToolbarHeadingButton(props) {
|
|
|
110
110
|
};
|
|
111
111
|
}
|
|
112
112
|
if (!editor) return null;
|
|
113
|
-
return React.createElement(Menu, {
|
|
113
|
+
return /*#__PURE__*/ React.createElement(Menu, {
|
|
114
114
|
isOpen: isOpen,
|
|
115
115
|
onClose: ()=>setOpen(false)
|
|
116
|
-
}, React.createElement(Menu.Trigger, null, React.createElement(Button, {
|
|
116
|
+
}, /*#__PURE__*/ React.createElement(Menu.Trigger, null, /*#__PURE__*/ React.createElement(Button, {
|
|
117
117
|
size: "small",
|
|
118
118
|
testId: "toolbar-heading-toggle",
|
|
119
119
|
variant: "transparent",
|
|
120
|
-
endIcon: React.createElement(ChevronDownIcon, null),
|
|
120
|
+
endIcon: /*#__PURE__*/ React.createElement(ChevronDownIcon, null),
|
|
121
121
|
isDisabled: props.isDisabled,
|
|
122
122
|
onClick: ()=>someHeadingsEnabled && setOpen(!isOpen),
|
|
123
123
|
className: styles.button
|
|
124
|
-
}, LABELS[selected])), React.createElement(Menu.List, {
|
|
124
|
+
}, LABELS[selected])), /*#__PURE__*/ React.createElement(Menu.List, {
|
|
125
125
|
testId: "dropdown-heading-list"
|
|
126
|
-
}, Object.keys(LABELS).map((nodeType)=>nodeTypesByEnablement[nodeType] && React.createElement(Menu.Item, {
|
|
126
|
+
}, Object.keys(LABELS).map((nodeType)=>nodeTypesByEnablement[nodeType] && /*#__PURE__*/ React.createElement(Menu.Item, {
|
|
127
127
|
key: nodeType,
|
|
128
128
|
isInitiallyFocused: selected === nodeType,
|
|
129
129
|
onClick: handleOnSelectItem(nodeType),
|
|
130
130
|
testId: `dropdown-option-${nodeType}`,
|
|
131
131
|
disabled: props.isDisabled
|
|
132
|
-
}, React.createElement("span", {
|
|
132
|
+
}, /*#__PURE__*/ React.createElement("span", {
|
|
133
133
|
className: cx(styles.dropdown.root, styles.dropdown[nodeType])
|
|
134
134
|
}, LABELS[nodeType]))).filter(Boolean)));
|
|
135
135
|
}
|
|
@@ -76,25 +76,25 @@ export function ToolbarHrButton(props) {
|
|
|
76
76
|
focus(editor);
|
|
77
77
|
}
|
|
78
78
|
if (!editor) return null;
|
|
79
|
-
return React.createElement(ToolbarButton, {
|
|
79
|
+
return /*#__PURE__*/ React.createElement(ToolbarButton, {
|
|
80
80
|
title: "HR",
|
|
81
81
|
isDisabled: props.isDisabled,
|
|
82
82
|
onClick: handleOnClick,
|
|
83
83
|
testId: "hr-toolbar-button",
|
|
84
84
|
isActive: isBlockSelected(editor, BLOCKS.HR)
|
|
85
|
-
}, React.createElement(HorizontalRuleIcon, null));
|
|
85
|
+
}, /*#__PURE__*/ React.createElement(HorizontalRuleIcon, null));
|
|
86
86
|
}
|
|
87
87
|
export function Hr(props) {
|
|
88
88
|
const isSelected = Slate.useSelected();
|
|
89
89
|
const isFocused = Slate.useFocused();
|
|
90
|
-
return React.createElement("div", {
|
|
90
|
+
return /*#__PURE__*/ React.createElement("div", {
|
|
91
91
|
...props.attributes,
|
|
92
92
|
className: styles.container,
|
|
93
93
|
"data-void-element": BLOCKS.HR
|
|
94
|
-
}, React.createElement("div", {
|
|
94
|
+
}, /*#__PURE__*/ React.createElement("div", {
|
|
95
95
|
draggable: true,
|
|
96
96
|
contentEditable: false
|
|
97
|
-
}, React.createElement("hr", {
|
|
97
|
+
}, /*#__PURE__*/ React.createElement("hr", {
|
|
98
98
|
className: cx(styles.hr, isSelected && isFocused ? styles.hrSelected : undefined)
|
|
99
99
|
})), props.children);
|
|
100
100
|
}
|
|
@@ -132,30 +132,30 @@ export function HyperlinkModal(props) {
|
|
|
132
132
|
event.preventDefault();
|
|
133
133
|
setLinkEntity(null);
|
|
134
134
|
}
|
|
135
|
-
return React.createElement(EntityProvider, {
|
|
135
|
+
return /*#__PURE__*/ React.createElement(EntityProvider, {
|
|
136
136
|
sdk: props.sdk
|
|
137
|
-
}, React.createElement(React.Fragment, null, React.createElement(ModalContent, null, React.createElement(Form, null, !props.linkType && React.createElement(FormControl, {
|
|
137
|
+
}, /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(ModalContent, null, /*#__PURE__*/ React.createElement(Form, null, !props.linkType && /*#__PURE__*/ React.createElement(FormControl, {
|
|
138
138
|
id: "link-text",
|
|
139
139
|
isRequired: true
|
|
140
|
-
}, React.createElement(FormControl.Label, null, "Link text"), React.createElement(TextInput, {
|
|
140
|
+
}, /*#__PURE__*/ React.createElement(FormControl.Label, null, "Link text"), /*#__PURE__*/ React.createElement(TextInput, {
|
|
141
141
|
testId: "link-text-input",
|
|
142
142
|
name: "link-text",
|
|
143
143
|
value: linkText,
|
|
144
144
|
onChange: (event)=>setLinkText(event.target.value)
|
|
145
|
-
})), enabledLinkTypes.length > 1 && React.createElement(FormControl, {
|
|
145
|
+
})), enabledLinkTypes.length > 1 && /*#__PURE__*/ React.createElement(FormControl, {
|
|
146
146
|
id: "link-type"
|
|
147
|
-
}, React.createElement(FormControl.Label, null, "Link type"), React.createElement(Select, {
|
|
147
|
+
}, /*#__PURE__*/ React.createElement(FormControl.Label, null, "Link type"), /*#__PURE__*/ React.createElement(Select, {
|
|
148
148
|
value: linkType,
|
|
149
149
|
onChange: (event)=>setLinkType(event.target.value),
|
|
150
150
|
testId: "link-type-input",
|
|
151
151
|
isDisabled: props.readonly
|
|
152
|
-
}, enabledLinkTypes.map((nodeType)
|
|
152
|
+
}, enabledLinkTypes.map((nodeType)=>/*#__PURE__*/ React.createElement(Select.Option, {
|
|
153
153
|
key: nodeType,
|
|
154
154
|
value: nodeType
|
|
155
|
-
}, LINK_TYPE_SELECTION_VALUES[nodeType])))), linkType === INLINES.HYPERLINK && React.createElement(FormControl, {
|
|
155
|
+
}, LINK_TYPE_SELECTION_VALUES[nodeType])))), linkType === INLINES.HYPERLINK && /*#__PURE__*/ React.createElement(FormControl, {
|
|
156
156
|
id: "linkTarget",
|
|
157
157
|
isRequired: true
|
|
158
|
-
}, React.createElement(FormControl.Label, null, "Link target"), React.createElement(TextInput, {
|
|
158
|
+
}, /*#__PURE__*/ React.createElement(FormControl.Label, null, "Link target"), /*#__PURE__*/ React.createElement(TextInput, {
|
|
159
159
|
ref: linkTargetInputRef,
|
|
160
160
|
name: "linkTarget",
|
|
161
161
|
value: linkTarget,
|
|
@@ -165,46 +165,46 @@ export function HyperlinkModal(props) {
|
|
|
165
165
|
},
|
|
166
166
|
testId: "link-target-input",
|
|
167
167
|
isDisabled: props.readonly
|
|
168
|
-
}), React.createElement(FormControl.HelpText, null, "A protocol may be required, e.g. https://")), linkType !== INLINES.HYPERLINK && React.createElement("div", null, React.createElement(FormLabel, {
|
|
168
|
+
}), /*#__PURE__*/ React.createElement(FormControl.HelpText, null, "A protocol may be required, e.g. https://")), linkType !== INLINES.HYPERLINK && /*#__PURE__*/ React.createElement("div", null, /*#__PURE__*/ React.createElement(FormLabel, {
|
|
169
169
|
isRequired: true,
|
|
170
170
|
htmlFor: ""
|
|
171
|
-
}, "Link target", ' '), linkEntity && linkEntity.sys.linkType === SYS_LINK_TYPES[linkType] ? React.createElement(React.Fragment, null, !props.readonly && React.createElement(TextLink, {
|
|
171
|
+
}, "Link target", ' '), linkEntity && linkEntity.sys.linkType === SYS_LINK_TYPES[linkType] ? /*#__PURE__*/ React.createElement(React.Fragment, null, !props.readonly && /*#__PURE__*/ React.createElement(TextLink, {
|
|
172
172
|
testId: "entity-selection-link",
|
|
173
173
|
onClick: resetLinkEntity,
|
|
174
174
|
className: styles.removeSelectionLabel
|
|
175
|
-
}, "Remove selection"), React.createElement("div", null, linkType === INLINES.ENTRY_HYPERLINK && isEntryLink(linkEntity) && React.createElement(FetchingWrappedEntryCard, {
|
|
175
|
+
}, "Remove selection"), /*#__PURE__*/ React.createElement("div", null, linkType === INLINES.ENTRY_HYPERLINK && isEntryLink(linkEntity) && /*#__PURE__*/ React.createElement(FetchingWrappedEntryCard, {
|
|
176
176
|
sdk: props.sdk,
|
|
177
177
|
locale: props.sdk.field.locale,
|
|
178
178
|
entryId: linkEntity.sys.id,
|
|
179
179
|
isDisabled: true,
|
|
180
180
|
isSelected: false
|
|
181
|
-
}), linkType === INLINES.RESOURCE_HYPERLINK && isResourceLink(linkEntity) && React.createElement(FetchingWrappedResourceCard, {
|
|
181
|
+
}), linkType === INLINES.RESOURCE_HYPERLINK && isResourceLink(linkEntity) && /*#__PURE__*/ React.createElement(FetchingWrappedResourceCard, {
|
|
182
182
|
sdk: props.sdk,
|
|
183
183
|
link: linkEntity.sys,
|
|
184
184
|
isDisabled: true,
|
|
185
185
|
isSelected: false
|
|
186
|
-
}), linkType === INLINES.ASSET_HYPERLINK && isAssetLink(linkEntity) && React.createElement(FetchingWrappedAssetCard, {
|
|
186
|
+
}), linkType === INLINES.ASSET_HYPERLINK && isAssetLink(linkEntity) && /*#__PURE__*/ React.createElement(FetchingWrappedAssetCard, {
|
|
187
187
|
sdk: props.sdk,
|
|
188
188
|
locale: props.sdk.field.locale,
|
|
189
189
|
assetId: linkEntity.sys.id,
|
|
190
190
|
isDisabled: true,
|
|
191
191
|
isSelected: false
|
|
192
|
-
}))) : React.createElement("div", null, linkType === INLINES.ENTRY_HYPERLINK && React.createElement(TextLink, {
|
|
192
|
+
}))) : /*#__PURE__*/ React.createElement("div", null, linkType === INLINES.ENTRY_HYPERLINK && /*#__PURE__*/ React.createElement(TextLink, {
|
|
193
193
|
testId: "entity-selection-link",
|
|
194
194
|
onClick: selectEntry
|
|
195
|
-
}, "Select entry"), linkType === INLINES.RESOURCE_HYPERLINK && React.createElement(TextLink, {
|
|
195
|
+
}, "Select entry"), linkType === INLINES.RESOURCE_HYPERLINK && /*#__PURE__*/ React.createElement(TextLink, {
|
|
196
196
|
testId: "entity-selection-link",
|
|
197
197
|
onClick: selectResourceEntry
|
|
198
|
-
}, "Select entry"), linkType === INLINES.ASSET_HYPERLINK && React.createElement(TextLink, {
|
|
198
|
+
}, "Select entry"), linkType === INLINES.ASSET_HYPERLINK && /*#__PURE__*/ React.createElement(TextLink, {
|
|
199
199
|
testId: "entity-selection-link",
|
|
200
200
|
onClick: selectAsset
|
|
201
|
-
}, "Select asset"))))), React.createElement(ModalControls, null, React.createElement(Button, {
|
|
201
|
+
}, "Select asset"))))), /*#__PURE__*/ React.createElement(ModalControls, null, /*#__PURE__*/ React.createElement(Button, {
|
|
202
202
|
type: "button",
|
|
203
203
|
onClick: ()=>props.onClose(null),
|
|
204
204
|
variant: "secondary",
|
|
205
205
|
testId: "cancel-cta",
|
|
206
206
|
size: "small"
|
|
207
|
-
}, "Cancel"), React.createElement(Button, {
|
|
207
|
+
}, "Cancel"), /*#__PURE__*/ React.createElement(Button, {
|
|
208
208
|
type: "submit",
|
|
209
209
|
variant: "positive",
|
|
210
210
|
size: "small",
|
|
@@ -241,7 +241,7 @@ export async function addOrEditLink(editor, sdk, logAction, targetPath) {
|
|
|
241
241
|
shouldCloseOnOverlayClick: true,
|
|
242
242
|
allowHeightOverflow: true
|
|
243
243
|
}, ({ onClose })=>{
|
|
244
|
-
return React.createElement(HyperlinkModal, {
|
|
244
|
+
return /*#__PURE__*/ React.createElement(HyperlinkModal, {
|
|
245
245
|
linkTarget: linkTarget,
|
|
246
246
|
linkText: currentLinkText,
|
|
247
247
|
linkType: linkType,
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { assertOutput, jsx } from '../../../test-utils';
|
|
2
2
|
describe('normalization', ()=>{
|
|
3
3
|
it('removes empty links from the document structure', ()=>{
|
|
4
|
-
const input = jsx("editor", null, jsx("hp", null, jsx("htext", null, "link"), jsx("hlink", {
|
|
4
|
+
const input = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("htext", null, "link"), /*#__PURE__*/ jsx("hlink", {
|
|
5
5
|
uri: "https://link.com"
|
|
6
|
-
})), jsx("hp", null, jsx("htext", null, "asset"), jsx("hlink", {
|
|
6
|
+
})), /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("htext", null, "asset"), /*#__PURE__*/ jsx("hlink", {
|
|
7
7
|
asset: "asset-id"
|
|
8
|
-
})), jsx("hp", null, jsx("htext", null, "entry"), jsx("hlink", {
|
|
8
|
+
})), /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("htext", null, "entry"), /*#__PURE__*/ jsx("hlink", {
|
|
9
9
|
entry: "entry-id"
|
|
10
|
-
})), jsx("hp", null, jsx("htext", null, "resource"), jsx("hlink", {
|
|
10
|
+
})), /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("htext", null, "resource"), /*#__PURE__*/ jsx("hlink", {
|
|
11
11
|
resource: "resource-urn"
|
|
12
|
-
})), jsx("hp", null, jsx("htext", null, "explicit empty link"), jsx("hlink", {
|
|
12
|
+
})), /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("htext", null, "explicit empty link"), /*#__PURE__*/ jsx("hlink", {
|
|
13
13
|
uri: "https://link.com"
|
|
14
|
-
}, '')), jsx("hp", null, jsx("htext", null, "link with empty space"), jsx("hlink", {
|
|
14
|
+
}, '')), /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("htext", null, "link with empty space"), /*#__PURE__*/ jsx("hlink", {
|
|
15
15
|
uri: "https://link.com"
|
|
16
16
|
}, " ")));
|
|
17
|
-
const expected = jsx("editor", null, jsx("hp", null, jsx("htext", null, "link")), jsx("hp", null, jsx("htext", null, "asset")), jsx("hp", null, jsx("htext", null, "entry")), jsx("hp", null, jsx("htext", null, "resource")), jsx("hp", null, jsx("htext", null, "explicit empty link")), jsx("hp", null, jsx("htext", null, "link with empty space")));
|
|
17
|
+
const expected = /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("htext", null, "link")), /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("htext", null, "asset")), /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("htext", null, "entry")), /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("htext", null, "resource")), /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("htext", null, "explicit empty link")), /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("htext", null, "link with empty space")));
|
|
18
18
|
assertOutput({
|
|
19
19
|
input,
|
|
20
20
|
expected
|
|
@@ -18,18 +18,18 @@ export function EntityHyperlink(props) {
|
|
|
18
18
|
if (!target) {
|
|
19
19
|
return null;
|
|
20
20
|
}
|
|
21
|
-
const popoverText = React.createElement(Text, {
|
|
21
|
+
const popoverText = /*#__PURE__*/ React.createElement(Text, {
|
|
22
22
|
fontColor: "blue600",
|
|
23
23
|
fontWeight: "fontWeightMedium",
|
|
24
24
|
className: styles.openLink
|
|
25
25
|
}, tooltipContent);
|
|
26
|
-
return React.createElement(LinkPopover, {
|
|
26
|
+
return /*#__PURE__*/ React.createElement(LinkPopover, {
|
|
27
27
|
isLinkFocused: isLinkFocused,
|
|
28
28
|
handleEditLink: ()=>handleEditLink(editor, sdk, pathToElement),
|
|
29
29
|
handleRemoveLink: ()=>handleRemoveLink(editor),
|
|
30
30
|
popoverText: popoverText,
|
|
31
31
|
isEditorFocused: isEditorFocused
|
|
32
|
-
}, React.createElement(Text, {
|
|
32
|
+
}, /*#__PURE__*/ React.createElement(Text, {
|
|
33
33
|
testId: "cf-ui-text-link",
|
|
34
34
|
fontColor: "blue600",
|
|
35
35
|
fontWeight: "fontWeightMedium",
|
|
@@ -19,63 +19,63 @@ export const LinkPopover = ({ isLinkFocused, popoverText, handleEditLink, handle
|
|
|
19
19
|
};
|
|
20
20
|
}, []);
|
|
21
21
|
const isOpen = isLinkFocused && isEditorFocused || isPopoverContentClicked;
|
|
22
|
-
return React.createElement(Popover, {
|
|
22
|
+
return /*#__PURE__*/ React.createElement(Popover, {
|
|
23
23
|
renderOnlyWhenOpen: false,
|
|
24
24
|
usePortal: true,
|
|
25
25
|
autoFocus: false,
|
|
26
26
|
isOpen: isOpen
|
|
27
|
-
}, React.createElement(Popover.Trigger, null, children), React.createElement(Popover.Content, {
|
|
27
|
+
}, /*#__PURE__*/ React.createElement(Popover.Trigger, null, children), /*#__PURE__*/ React.createElement(Popover.Content, {
|
|
28
28
|
className: styles.popover
|
|
29
|
-
}, React.createElement(Flex, {
|
|
29
|
+
}, /*#__PURE__*/ React.createElement(Flex, {
|
|
30
30
|
ref: popoverContent,
|
|
31
31
|
alignItems: "center",
|
|
32
32
|
paddingTop: "spacing2Xs",
|
|
33
33
|
paddingBottom: "spacing2Xs",
|
|
34
34
|
paddingRight: "spacing2Xs",
|
|
35
35
|
paddingLeft: "spacingXs"
|
|
36
|
-
}, popoverText, handleCopyLink && React.createElement(Tooltip, {
|
|
36
|
+
}, popoverText, handleCopyLink && /*#__PURE__*/ React.createElement(Tooltip, {
|
|
37
37
|
placement: "bottom",
|
|
38
38
|
content: "Copy link",
|
|
39
39
|
usePortal: true
|
|
40
|
-
}, React.createElement(IconButton, {
|
|
40
|
+
}, /*#__PURE__*/ React.createElement(IconButton, {
|
|
41
41
|
className: styles.iconButton,
|
|
42
42
|
onClick: handleCopyLink,
|
|
43
43
|
size: "small",
|
|
44
44
|
variant: "transparent",
|
|
45
45
|
"aria-label": "Copy link",
|
|
46
|
-
icon: React.createElement(CopyIcon, {
|
|
46
|
+
icon: /*#__PURE__*/ React.createElement(CopyIcon, {
|
|
47
47
|
size: "tiny"
|
|
48
48
|
})
|
|
49
|
-
})), React.createElement(Tooltip, {
|
|
49
|
+
})), /*#__PURE__*/ React.createElement(Tooltip, {
|
|
50
50
|
placement: "bottom",
|
|
51
51
|
content: "Edit link",
|
|
52
52
|
usePortal: true
|
|
53
|
-
}, React.createElement(IconButton, {
|
|
53
|
+
}, /*#__PURE__*/ React.createElement(IconButton, {
|
|
54
54
|
className: styles.iconButton,
|
|
55
55
|
onClick: handleEditLink,
|
|
56
56
|
size: "small",
|
|
57
57
|
variant: "transparent",
|
|
58
58
|
"aria-label": "Edit link",
|
|
59
|
-
icon: React.createElement(EditIcon, {
|
|
59
|
+
icon: /*#__PURE__*/ React.createElement(EditIcon, {
|
|
60
60
|
size: "tiny"
|
|
61
61
|
})
|
|
62
|
-
})), React.createElement(Tooltip, {
|
|
62
|
+
})), /*#__PURE__*/ React.createElement(Tooltip, {
|
|
63
63
|
placement: "bottom",
|
|
64
64
|
content: "Remove link",
|
|
65
65
|
usePortal: true
|
|
66
|
-
}, React.createElement(IconButton, {
|
|
66
|
+
}, /*#__PURE__*/ React.createElement(IconButton, {
|
|
67
67
|
onClick: handleRemoveLink,
|
|
68
68
|
className: styles.iconButton,
|
|
69
69
|
size: "small",
|
|
70
70
|
variant: "transparent",
|
|
71
71
|
"aria-label": "Remove link",
|
|
72
|
-
icon: React.createElement("svg", {
|
|
72
|
+
icon: /*#__PURE__*/ React.createElement("svg", {
|
|
73
73
|
width: "16",
|
|
74
74
|
height: "16",
|
|
75
75
|
viewBox: "0 0 16 16",
|
|
76
76
|
fill: "none",
|
|
77
77
|
xmlns: "http://www.w3.org/2000/svg"
|
|
78
|
-
}, React.createElement("path", {
|
|
78
|
+
}, /*#__PURE__*/ React.createElement("path", {
|
|
79
79
|
d: "M1.75 8C1.75 8.59674 1.98705 9.16903 2.40901 9.59099C2.83097 10.0129 3.40326 10.25 4 10.25H6.5C6.69891 10.25 6.88968 10.329 7.03033 10.4697C7.17098 10.6103 7.25 10.8011 7.25 11C7.25 11.1989 7.17098 11.3897 7.03033 11.5303C6.88968 11.671 6.69891 11.75 6.5 11.75H4C3.00544 11.75 2.05161 11.3549 1.34835 10.6517C0.645088 9.94839 0.25 8.99456 0.25 8C0.25 7.00544 0.645088 6.05161 1.34835 5.34835C2.05161 4.64509 3.00544 4.25 4 4.25H6.5C6.69891 4.25 6.88968 4.32902 7.03033 4.46967C7.17098 4.61032 7.25 4.80109 7.25 5C7.25 5.19891 7.17098 5.38968 7.03033 5.53033C6.88968 5.67098 6.69891 5.75 6.5 5.75H4C3.40326 5.75 2.83097 5.98705 2.40901 6.40901C1.98705 6.83097 1.75 7.40326 1.75 8ZM12 4.25H9.5C9.30109 4.25 9.11032 4.32902 8.96967 4.46967C8.82902 4.61032 8.75 4.80109 8.75 5C8.75 5.19891 8.82902 5.38968 8.96967 5.53033C9.11032 5.67098 9.30109 5.75 9.5 5.75H12C12.5967 5.75 13.169 5.98705 13.591 6.40901C14.0129 6.83097 14.25 7.40326 14.25 8C14.25 8.59674 14.0129 9.16903 13.591 9.59099C13.169 10.0129 12.5967 10.25 12 10.25H9.5C9.30109 10.25 9.11032 10.329 8.96967 10.4697C8.82902 10.6103 8.75 10.8011 8.75 11C8.75 11.1989 8.82902 11.3897 8.96967 11.5303C9.11032 11.671 9.30109 11.75 9.5 11.75H12C12.9946 11.75 13.9484 11.3549 14.6517 10.6517C15.3549 9.94839 15.75 8.99456 15.75 8C15.75 7.00544 15.3549 6.05161 14.6517 5.34835C13.9484 4.64509 12.9946 4.25 12 4.25Z",
|
|
80
80
|
fill: "black"
|
|
81
81
|
}))
|
|
@@ -17,18 +17,18 @@ export function ResourceHyperlink(props) {
|
|
|
17
17
|
if (!target) {
|
|
18
18
|
return null;
|
|
19
19
|
}
|
|
20
|
-
const popoverText = React.createElement(Text, {
|
|
20
|
+
const popoverText = /*#__PURE__*/ React.createElement(Text, {
|
|
21
21
|
fontColor: "blue600",
|
|
22
22
|
fontWeight: "fontWeightMedium",
|
|
23
23
|
className: styles.openLink
|
|
24
24
|
}, tooltipContent);
|
|
25
|
-
return React.createElement(LinkPopover, {
|
|
25
|
+
return /*#__PURE__*/ React.createElement(LinkPopover, {
|
|
26
26
|
isLinkFocused: isLinkFocused,
|
|
27
27
|
handleEditLink: ()=>handleEditLink(editor, sdk, pathToElement),
|
|
28
28
|
handleRemoveLink: ()=>handleRemoveLink(editor),
|
|
29
29
|
popoverText: popoverText,
|
|
30
30
|
isEditorFocused: isEditorFocused
|
|
31
|
-
}, React.createElement(Text, {
|
|
31
|
+
}, /*#__PURE__*/ React.createElement(Text, {
|
|
32
32
|
testId: "cf-ui-text-link",
|
|
33
33
|
fontColor: "blue600",
|
|
34
34
|
fontWeight: "fontWeightMedium",
|
|
@@ -19,11 +19,11 @@ export function ToolbarHyperlinkButton(props) {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
if (!editor) return null;
|
|
22
|
-
return React.createElement(ToolbarButton, {
|
|
22
|
+
return /*#__PURE__*/ React.createElement(ToolbarButton, {
|
|
23
23
|
title: "Hyperlink",
|
|
24
24
|
testId: "hyperlink-toolbar-button",
|
|
25
25
|
onClick: handleClick,
|
|
26
26
|
isActive: isActive,
|
|
27
27
|
isDisabled: props.isDisabled
|
|
28
|
-
}, React.createElement(LinkIcon, null));
|
|
28
|
+
}, /*#__PURE__*/ React.createElement(LinkIcon, null));
|
|
29
29
|
}
|
|
@@ -7,20 +7,20 @@ import { useHyperlinkCommon } from './useHyperlinkCommon';
|
|
|
7
7
|
export function UrlHyperlink(props) {
|
|
8
8
|
const { editor, sdk, isLinkFocused, pathToElement, isEditorFocused } = useHyperlinkCommon(props.element);
|
|
9
9
|
const uri = props.element.data?.uri;
|
|
10
|
-
const popoverText = React.createElement(TextLink, {
|
|
10
|
+
const popoverText = /*#__PURE__*/ React.createElement(TextLink, {
|
|
11
11
|
className: styles.openLink,
|
|
12
12
|
href: uri,
|
|
13
13
|
rel: "noopener noreferrer",
|
|
14
14
|
target: "_blank"
|
|
15
15
|
}, uri);
|
|
16
|
-
return React.createElement(LinkPopover, {
|
|
16
|
+
return /*#__PURE__*/ React.createElement(LinkPopover, {
|
|
17
17
|
isLinkFocused: isLinkFocused,
|
|
18
18
|
handleEditLink: ()=>handleEditLink(editor, sdk, pathToElement),
|
|
19
19
|
handleRemoveLink: ()=>handleRemoveLink(editor),
|
|
20
20
|
handleCopyLink: ()=>handleCopyLink(uri),
|
|
21
21
|
popoverText: popoverText,
|
|
22
22
|
isEditorFocused: isEditorFocused
|
|
23
|
-
}, React.createElement(TextLink, {
|
|
23
|
+
}, /*#__PURE__*/ React.createElement(TextLink, {
|
|
24
24
|
testId: "cf-ui-text-link",
|
|
25
25
|
href: uri,
|
|
26
26
|
onClick: (e)=>e.preventDefault(),
|