@contentful/field-editor-rich-text 3.16.11 → 3.16.13
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/ContentfulEditorProvider.js +8 -8
- package/dist/cjs/RichTextEditor.js +6 -4
- package/dist/cjs/SdkProvider.js +4 -2
- package/dist/cjs/SyncEditorChanges.js +4 -2
- package/dist/cjs/Toolbar/_tests_/toolbar.test.js +6 -4
- package/dist/cjs/Toolbar/components/EmbedEntityWidget.js +4 -2
- package/dist/cjs/Toolbar/components/EmbeddedEntityDropdownButton.js +4 -2
- package/dist/cjs/Toolbar/components/StickyToolbarWrapper.js +1 -1
- package/dist/cjs/Toolbar/index.js +5 -3
- package/dist/cjs/__fixtures__/FakeSdk.js +3 -3
- package/dist/cjs/__fixtures__/asset/index.js +5 -5
- package/dist/cjs/__fixtures__/entry/index.js +3 -3
- package/dist/cjs/__fixtures__/fixtures.js +3 -1
- package/dist/cjs/dialogs/HypelinkDialog/HyperlinkDialog.js +17 -15
- package/dist/cjs/dialogs/openRichTextDialog.js +4 -2
- package/dist/cjs/dialogs/renderRichTextDialog.js +3 -1
- package/dist/cjs/helpers/__tests__/removeInternalMarks.test.js +1 -1
- package/dist/cjs/helpers/editor.js +42 -42
- package/dist/cjs/helpers/environment.js +3 -3
- package/dist/cjs/helpers/formatDateAndTime.js +3 -3
- package/dist/cjs/helpers/nodeFactory.js +6 -6
- package/dist/cjs/helpers/sdkNavigatorSlideIn.js +1 -1
- package/dist/cjs/helpers/transformers.js +5 -5
- package/dist/cjs/helpers/validations.js +5 -5
- package/dist/cjs/index.js +6 -4
- package/dist/cjs/internal/constants.js +3 -1
- package/dist/cjs/internal/hooks.js +7 -5
- package/dist/cjs/internal/misc.js +12 -10
- package/dist/cjs/internal/queries.js +107 -105
- package/dist/cjs/internal/transforms.js +49 -47
- 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 +9 -7
- package/dist/cjs/plugins/CommandPalette/components/CommandPrompt.js +3 -1
- package/dist/cjs/plugins/CommandPalette/hooks/useCommandList.js +3 -1
- package/dist/cjs/plugins/CommandPalette/onKeyDown.spec.js +5 -3
- package/dist/cjs/plugins/CommandPalette/useCommands.js +2 -2
- package/dist/cjs/plugins/DragAndDrop/index.js +4 -1
- package/dist/cjs/plugins/EmbeddedEntityBlock/LinkedEntityBlock.js +6 -4
- package/dist/cjs/plugins/EmbeddedEntityBlock/index.js +3 -3
- package/dist/cjs/plugins/EmbeddedEntityInline/FetchingWrappedInlineEntryCard.js +7 -5
- package/dist/cjs/plugins/EmbeddedEntityInline/LinkedEntityInline.js +6 -4
- package/dist/cjs/plugins/EmbeddedResourceBlock/LinkedResourceBlock.js +2 -2
- package/dist/cjs/plugins/EmbeddedResourceInline/FetchingWrappedResourceInlineCard.js +7 -5
- package/dist/cjs/plugins/EmbeddedResourceInline/LinkedResourceInline.js +2 -2
- package/dist/cjs/plugins/Heading/components/Heading.js +3 -1
- package/dist/cjs/plugins/Heading/components/ToolbarHeadingButton.js +3 -1
- package/dist/cjs/plugins/Heading/createHeadingPlugin.js +1 -1
- package/dist/cjs/plugins/Hr/index.js +8 -6
- package/dist/cjs/plugins/Hyperlink/HyperlinkModal.js +7 -5
- package/dist/cjs/plugins/Hyperlink/components/EntityHyperlink.js +6 -4
- package/dist/cjs/plugins/Hyperlink/components/LinkPopover.js +4 -2
- package/dist/cjs/plugins/Hyperlink/components/ResourceHyperlink.js +6 -4
- package/dist/cjs/plugins/Hyperlink/components/ToolbarHyperlinkButton.js +3 -1
- package/dist/cjs/plugins/Hyperlink/components/UrlHyperlink.js +4 -2
- package/dist/cjs/plugins/Hyperlink/components/linkHandlers.js +3 -3
- package/dist/cjs/plugins/Hyperlink/createHyperlinkPlugin.js +4 -2
- package/dist/cjs/plugins/Hyperlink/useEntityInfo.js +3 -3
- package/dist/cjs/plugins/Hyperlink/useResourceEntityInfo.js +5 -3
- package/dist/cjs/plugins/Hyperlink/utils.js +4 -4
- package/dist/cjs/plugins/List/__tests__/insertListBreak.test.js +1 -1
- package/dist/cjs/plugins/List/__tests__/insertListFragment.test.js +1 -1
- package/dist/cjs/plugins/List/components/List.js +6 -4
- package/dist/cjs/plugins/List/components/ListItem.js +3 -1
- package/dist/cjs/plugins/List/components/ToolbarListButton.js +3 -1
- package/dist/cjs/plugins/List/insertListBreak.js +2 -2
- package/dist/cjs/plugins/List/insertListFragment.js +1 -1
- package/dist/cjs/plugins/List/onKeyDownList.js +1 -1
- package/dist/cjs/plugins/List/transforms/moveListItemDown.js +1 -1
- package/dist/cjs/plugins/List/transforms/moveListItems.js +1 -1
- package/dist/cjs/plugins/List/transforms/moveListItems.test.js +1 -1
- package/dist/cjs/plugins/List/transforms/toggleList.js +3 -3
- package/dist/cjs/plugins/List/transforms/toggleList.spec.js +9 -9
- package/dist/cjs/plugins/List/transforms/unwrapList.js +1 -1
- package/dist/cjs/plugins/List/utils.js +11 -11
- package/dist/cjs/plugins/List/withList.js +1 -1
- package/dist/cjs/plugins/Marks/Bold.js +6 -4
- package/dist/cjs/plugins/Marks/Code.js +6 -4
- package/dist/cjs/plugins/Marks/Italic.js +6 -4
- package/dist/cjs/plugins/Marks/Subscript.js +7 -5
- package/dist/cjs/plugins/Marks/Superscript.js +7 -5
- package/dist/cjs/plugins/Marks/Underline.js +3 -1
- package/dist/cjs/plugins/Marks/components/MarkToolbarButton.js +5 -3
- package/dist/cjs/plugins/Marks/helpers.js +4 -4
- package/dist/cjs/plugins/Normalizer/createNormalizerPlugin.test.js +3 -3
- package/dist/cjs/plugins/Normalizer/utils.js +3 -3
- package/dist/cjs/plugins/Normalizer/withNormalizer.js +2 -2
- package/dist/cjs/plugins/Paragraph/Paragraph.js +3 -1
- package/dist/cjs/plugins/Paragraph/createParagraphPlugin.js +1 -1
- package/dist/cjs/plugins/PasteHTML/createPasteHTMLPlugin.js +5 -5
- package/dist/cjs/plugins/Quote/components/Quote.js +3 -1
- package/dist/cjs/plugins/Quote/components/ToolbarQuoteButton.js +3 -1
- package/dist/cjs/plugins/Quote/toggleQuote.js +4 -4
- package/dist/cjs/plugins/Quote/withQuote.js +2 -2
- package/dist/cjs/plugins/Table/__tests__/helpers.test.js +1 -1
- package/dist/cjs/plugins/Table/actions/addColumn.js +4 -4
- package/dist/cjs/plugins/Table/actions/addRow.js +3 -3
- package/dist/cjs/plugins/Table/components/Cell.js +3 -1
- package/dist/cjs/plugins/Table/components/HeaderCell.js +3 -1
- package/dist/cjs/plugins/Table/components/Row.js +3 -1
- package/dist/cjs/plugins/Table/components/Table.js +3 -1
- package/dist/cjs/plugins/Table/components/TableActions.js +6 -4
- package/dist/cjs/plugins/Table/components/ToolbarButton.js +3 -1
- package/dist/cjs/plugins/Table/createTablePlugin.js +1 -1
- package/dist/cjs/plugins/Table/helpers.js +12 -12
- package/dist/cjs/plugins/Table/insertTableFragment.js +1 -1
- package/dist/cjs/plugins/Table/onKeyDownTable.js +2 -2
- package/dist/cjs/plugins/Table/tableTracking.js +6 -6
- package/dist/cjs/plugins/Text/__tests__/createTextPlugin.test.js +2 -2
- package/dist/cjs/plugins/Text/createTextPlugin.js +3 -3
- package/dist/cjs/plugins/Tracking/createTrackingPlugin.js +4 -4
- package/dist/cjs/plugins/Tracking/utils.js +3 -1
- package/dist/cjs/plugins/index.js +3 -3
- package/dist/cjs/plugins/shared/EmbeddedBlockToolbarIcon.js +7 -5
- package/dist/cjs/plugins/shared/EmbeddedBlockUtil.js +5 -5
- package/dist/cjs/plugins/shared/EmbeddedInlineToolbarIcon.js +4 -2
- package/dist/cjs/plugins/shared/EmbeddedInlineUtil.js +4 -4
- package/dist/cjs/plugins/shared/FetchingWrappedAssetCard.js +6 -4
- package/dist/cjs/plugins/shared/FetchingWrappedEntryCard.js +7 -5
- package/dist/cjs/plugins/shared/FetchingWrappedResourceCard.js +6 -4
- package/dist/cjs/plugins/shared/LinkedBlockWrapper.js +1 -1
- package/dist/cjs/plugins/shared/LinkedInlineWrapper.js +4 -2
- package/dist/cjs/plugins/shared/ResourceNewBadge.js +3 -1
- package/dist/cjs/plugins/shared/ToolbarButton.js +4 -2
- package/dist/cjs/plugins/shared/__tests__/FetchingWrappedAssetCard.test.js +4 -2
- package/dist/cjs/plugins/shared/__tests__/FetchingWrappedEntryCard.test.js +4 -2
- package/dist/cjs/plugins/shared/__tests__/FetchingWrappedResourceCard.test.js +9 -7
- package/dist/cjs/test-utils/validation.js +3 -3
- package/dist/esm/ContentfulEditorProvider.js +1 -1
- package/dist/esm/RichTextEditor.js +3 -3
- package/dist/esm/SdkProvider.js +1 -1
- package/dist/esm/SyncEditorChanges.js +1 -1
- package/dist/esm/Toolbar/_tests_/toolbar.test.js +3 -3
- package/dist/esm/Toolbar/components/EmbedEntityWidget.js +1 -1
- package/dist/esm/Toolbar/components/EmbeddedEntityDropdownButton.js +1 -1
- package/dist/esm/Toolbar/components/StickyToolbarWrapper.js +1 -1
- package/dist/esm/Toolbar/index.js +2 -2
- package/dist/esm/__fixtures__/FakeSdk.js +3 -3
- package/dist/esm/dialogs/HypelinkDialog/HyperlinkDialog.js +11 -11
- package/dist/esm/dialogs/openRichTextDialog.js +1 -1
- package/dist/esm/helpers/__tests__/removeInternalMarks.test.js +1 -1
- package/dist/esm/helpers/editor.js +3 -3
- package/dist/esm/helpers/sdkNavigatorSlideIn.js +1 -1
- 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 +6 -6
- package/dist/esm/plugins/CommandPalette/onKeyDown.spec.js +2 -2
- package/dist/esm/plugins/CommandPalette/useCommands.js +2 -2
- package/dist/esm/plugins/DragAndDrop/index.js +4 -1
- package/dist/esm/plugins/EmbeddedEntityBlock/LinkedEntityBlock.js +3 -3
- package/dist/esm/plugins/EmbeddedEntityInline/FetchingWrappedInlineEntryCard.js +4 -4
- package/dist/esm/plugins/EmbeddedEntityInline/LinkedEntityInline.js +3 -3
- package/dist/esm/plugins/EmbeddedResourceBlock/LinkedResourceBlock.js +2 -2
- package/dist/esm/plugins/EmbeddedResourceInline/FetchingWrappedResourceInlineCard.js +4 -4
- package/dist/esm/plugins/EmbeddedResourceInline/LinkedResourceInline.js +2 -2
- package/dist/esm/plugins/Heading/createHeadingPlugin.js +1 -1
- package/dist/esm/plugins/Hyperlink/HyperlinkModal.js +4 -4
- package/dist/esm/plugins/Hyperlink/components/EntityHyperlink.js +3 -3
- package/dist/esm/plugins/Hyperlink/components/LinkPopover.js +1 -1
- package/dist/esm/plugins/Hyperlink/components/ResourceHyperlink.js +3 -3
- package/dist/esm/plugins/Hyperlink/components/UrlHyperlink.js +1 -1
- package/dist/esm/plugins/Hyperlink/createHyperlinkPlugin.js +1 -1
- package/dist/esm/plugins/Hyperlink/useEntityInfo.js +3 -3
- package/dist/esm/plugins/Hyperlink/useResourceEntityInfo.js +2 -2
- package/dist/esm/plugins/Hyperlink/utils.js +1 -1
- package/dist/esm/plugins/List/__tests__/insertListBreak.test.js +1 -1
- package/dist/esm/plugins/List/__tests__/insertListFragment.test.js +1 -1
- package/dist/esm/plugins/List/insertListBreak.js +2 -2
- package/dist/esm/plugins/List/insertListFragment.js +1 -1
- package/dist/esm/plugins/List/onKeyDownList.js +1 -1
- package/dist/esm/plugins/List/transforms/moveListItemDown.js +1 -1
- package/dist/esm/plugins/List/transforms/moveListItems.js +1 -1
- package/dist/esm/plugins/List/transforms/moveListItems.test.js +1 -1
- package/dist/esm/plugins/List/transforms/toggleList.js +3 -3
- package/dist/esm/plugins/List/transforms/toggleList.spec.js +9 -9
- package/dist/esm/plugins/List/transforms/unwrapList.js +1 -1
- package/dist/esm/plugins/List/utils.js +1 -1
- package/dist/esm/plugins/List/withList.js +1 -1
- package/dist/esm/plugins/Marks/components/MarkToolbarButton.js +2 -2
- package/dist/esm/plugins/Marks/helpers.js +1 -1
- package/dist/esm/plugins/Normalizer/createNormalizerPlugin.test.js +3 -3
- package/dist/esm/plugins/Normalizer/withNormalizer.js +2 -2
- package/dist/esm/plugins/Paragraph/createParagraphPlugin.js +1 -1
- package/dist/esm/plugins/PasteHTML/createPasteHTMLPlugin.js +1 -1
- package/dist/esm/plugins/Quote/toggleQuote.js +1 -1
- package/dist/esm/plugins/Quote/withQuote.js +2 -2
- package/dist/esm/plugins/Table/__tests__/helpers.test.js +1 -1
- package/dist/esm/plugins/Table/actions/addColumn.js +1 -1
- package/dist/esm/plugins/Table/createTablePlugin.js +1 -1
- package/dist/esm/plugins/Table/insertTableFragment.js +1 -1
- package/dist/esm/plugins/Table/onKeyDownTable.js +2 -2
- package/dist/esm/plugins/Table/tableTracking.js +6 -6
- package/dist/esm/plugins/Text/__tests__/createTextPlugin.test.js +2 -2
- package/dist/esm/plugins/Text/createTextPlugin.js +3 -3
- package/dist/esm/plugins/Tracking/createTrackingPlugin.js +1 -1
- package/dist/esm/plugins/shared/EmbeddedBlockToolbarIcon.js +1 -1
- package/dist/esm/plugins/shared/EmbeddedBlockUtil.js +5 -5
- package/dist/esm/plugins/shared/EmbeddedInlineToolbarIcon.js +1 -1
- package/dist/esm/plugins/shared/EmbeddedInlineUtil.js +4 -4
- package/dist/esm/plugins/shared/FetchingWrappedAssetCard.js +3 -3
- package/dist/esm/plugins/shared/FetchingWrappedEntryCard.js +4 -4
- package/dist/esm/plugins/shared/FetchingWrappedResourceCard.js +3 -3
- package/dist/esm/plugins/shared/LinkedBlockWrapper.js +1 -1
- package/dist/esm/plugins/shared/LinkedInlineWrapper.js +1 -1
- package/dist/esm/plugins/shared/ToolbarButton.js +1 -1
- package/dist/esm/plugins/shared/__tests__/FetchingWrappedAssetCard.test.js +1 -1
- package/dist/esm/plugins/shared/__tests__/FetchingWrappedEntryCard.test.js +1 -1
- package/dist/esm/plugins/shared/__tests__/FetchingWrappedResourceCard.test.js +6 -6
- package/dist/esm/test-utils/validation.js +3 -3
- package/package.json +4 -4
|
@@ -43,7 +43,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
43
43
|
if (cache && cache.has(obj)) {
|
|
44
44
|
return cache.get(obj);
|
|
45
45
|
}
|
|
46
|
-
var newObj = {
|
|
46
|
+
var newObj = {
|
|
47
|
+
__proto__: null
|
|
48
|
+
};
|
|
47
49
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
48
50
|
for(var key in obj){
|
|
49
51
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -61,7 +63,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
61
63
|
}
|
|
62
64
|
return newObj;
|
|
63
65
|
}
|
|
64
|
-
const Group = ({ commandGroup
|
|
66
|
+
const Group = ({ commandGroup, selectedItem })=>_react.createElement("section", {
|
|
65
67
|
key: commandGroup.group
|
|
66
68
|
}, _react.createElement(_f36components.SectionHeading, {
|
|
67
69
|
as: "h3",
|
|
@@ -80,7 +82,7 @@ const Group = ({ commandGroup , selectedItem })=>_react.createElement("section"
|
|
|
80
82
|
className: _CommandListstyles.default.menuDivider,
|
|
81
83
|
"aria-orientation": "horizontal"
|
|
82
84
|
}));
|
|
83
|
-
const Asset = ({ command
|
|
85
|
+
const Asset = ({ command, selectedItem })=>_react.createElement("button", {
|
|
84
86
|
key: command.id,
|
|
85
87
|
id: command.id,
|
|
86
88
|
className: (0, _emotion.cx)(_CommandListstyles.default.menuItem, {
|
|
@@ -101,7 +103,7 @@ const Asset = ({ command , selectedItem })=>_react.createElement("button", {
|
|
|
101
103
|
height: "30",
|
|
102
104
|
className: _CommandListstyles.default.thumbnail
|
|
103
105
|
}), _react.createElement("span", null, command.label)));
|
|
104
|
-
const Item = ({ command
|
|
106
|
+
const Item = ({ command, selectedItem })=>_react.createElement("button", {
|
|
105
107
|
key: command.id,
|
|
106
108
|
id: command.id,
|
|
107
109
|
className: (0, _emotion.cx)(_CommandListstyles.default.menuItem, {
|
|
@@ -109,7 +111,7 @@ const Item = ({ command , selectedItem })=>_react.createElement("button", {
|
|
|
109
111
|
}),
|
|
110
112
|
onClick: command.callback
|
|
111
113
|
}, command.label);
|
|
112
|
-
const CommandListItems = ({ commandItems
|
|
114
|
+
const CommandListItems = ({ commandItems, selectedItem })=>{
|
|
113
115
|
return _react.createElement(_react.Fragment, null, commandItems.map((command)=>{
|
|
114
116
|
return 'group' in command ? _react.createElement(Group, {
|
|
115
117
|
key: command.group,
|
|
@@ -126,14 +128,14 @@ const CommandListItems = ({ commandItems , selectedItem })=>{
|
|
|
126
128
|
});
|
|
127
129
|
}));
|
|
128
130
|
};
|
|
129
|
-
const CommandList = ({ query
|
|
131
|
+
const CommandList = ({ query, editor, textContainer })=>{
|
|
130
132
|
const sdk = (0, _SdkProvider.useSdkContext)();
|
|
131
133
|
const popoverContainer = _react.useRef(null);
|
|
132
134
|
const popper = (0, _reactpopper.usePopper)(textContainer, popoverContainer?.current, {
|
|
133
135
|
placement: 'bottom-start'
|
|
134
136
|
});
|
|
135
137
|
const commandItems = (0, _useCommands.useCommands)(sdk, query, editor);
|
|
136
|
-
const { selectedItem
|
|
138
|
+
const { selectedItem, isOpen } = (0, _useCommandList.useCommandList)(commandItems, popoverContainer);
|
|
137
139
|
if (!commandItems.length) {
|
|
138
140
|
return null;
|
|
139
141
|
}
|
|
@@ -39,7 +39,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
39
39
|
if (cache && cache.has(obj)) {
|
|
40
40
|
return cache.get(obj);
|
|
41
41
|
}
|
|
42
|
-
var newObj = {
|
|
42
|
+
var newObj = {
|
|
43
|
+
__proto__: null
|
|
44
|
+
};
|
|
43
45
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
44
46
|
for(var key in obj){
|
|
45
47
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -36,7 +36,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
36
36
|
if (cache && cache.has(obj)) {
|
|
37
37
|
return cache.get(obj);
|
|
38
38
|
}
|
|
39
|
-
var newObj = {
|
|
39
|
+
var newObj = {
|
|
40
|
+
__proto__: null
|
|
41
|
+
};
|
|
40
42
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
41
43
|
for(var key in obj){
|
|
42
44
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -27,7 +27,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
27
27
|
if (cache && cache.has(obj)) {
|
|
28
28
|
return cache.get(obj);
|
|
29
29
|
}
|
|
30
|
-
var newObj = {
|
|
30
|
+
var newObj = {
|
|
31
|
+
__proto__: null
|
|
32
|
+
};
|
|
31
33
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
32
34
|
for(var key in obj){
|
|
33
35
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -52,7 +54,7 @@ jest.mock('../../internal/transforms', ()=>{
|
|
|
52
54
|
};
|
|
53
55
|
});
|
|
54
56
|
describe('onKeyDown', ()=>{
|
|
55
|
-
const { editor
|
|
57
|
+
const { editor } = (0, _testutils.createTestEditor)({});
|
|
56
58
|
const addMark = jest.spyOn(_transforms, 'addMark');
|
|
57
59
|
const onCommandPaletteAction = jest.spyOn(editor.tracking, 'onCommandPaletteAction');
|
|
58
60
|
afterEach(()=>{
|
|
@@ -70,7 +72,7 @@ describe('onKeyDown', ()=>{
|
|
|
70
72
|
which: 55,
|
|
71
73
|
shiftKey: true
|
|
72
74
|
}}
|
|
73
|
-
`('supports hotKeys for every keyboard layout #{layout}', ({ key
|
|
75
|
+
`('supports hotKeys for every keyboard layout #{layout}', ({ key })=>{
|
|
74
76
|
(0, _onKeyDown.createOnKeyDown)()(editor, {})({
|
|
75
77
|
type: 'keydown',
|
|
76
78
|
...key
|
|
@@ -57,7 +57,7 @@ function isCommandPromptPluginEnabled(sdk) {
|
|
|
57
57
|
}
|
|
58
58
|
function getCommandPermissions(sdk, editor) {
|
|
59
59
|
const canInsertBlocks = !(0, _editor.isNodeTypeSelected)(editor, _richtexttypes.BLOCKS.TABLE);
|
|
60
|
-
const { inlineAllowed
|
|
60
|
+
const { inlineAllowed, entriesAllowed, assetsAllowed } = isCommandPromptPluginEnabled(sdk);
|
|
61
61
|
return {
|
|
62
62
|
inlineAllowed,
|
|
63
63
|
entriesAllowed: entriesAllowed && canInsertBlocks,
|
|
@@ -86,7 +86,7 @@ const getAllowedContentTypesFromValidation = (validations)=>{
|
|
|
86
86
|
};
|
|
87
87
|
const useCommands = (sdk, query, editor)=>{
|
|
88
88
|
const contentTypes = sdk.space.getCachedContentTypes();
|
|
89
|
-
const { inlineAllowed
|
|
89
|
+
const { inlineAllowed, entriesAllowed, assetsAllowed } = getCommandPermissions(sdk, editor);
|
|
90
90
|
const allowedContentTypesFromValidation = getAllowedContentTypesFromValidation(sdk.field.validations);
|
|
91
91
|
const filterContentTypesByValidation = (type)=>contentTypes.filter((contentType)=>allowedContentTypesFromValidation[type]?.[contentType.sys.id]);
|
|
92
92
|
const filteredBlockContentTypes = filterContentTypesByValidation(_richtexttypes.BLOCKS.EMBEDDED_ENTRY);
|
|
@@ -39,7 +39,10 @@ function createDragAndDropPlugin() {
|
|
|
39
39
|
return ON_DROP_ALLOWED_TYPES[node.nodeName] ? !ON_DROP_ALLOWED_TYPES[node.nodeName]?.includes(draggingNode.type) : false;
|
|
40
40
|
});
|
|
41
41
|
if (!dropDisallowed) {
|
|
42
|
-
editor.history.undos.push(
|
|
42
|
+
editor.history.undos.push({
|
|
43
|
+
operations: [],
|
|
44
|
+
selectionBefore: null
|
|
45
|
+
});
|
|
43
46
|
}
|
|
44
47
|
return dropDisallowed;
|
|
45
48
|
}
|
|
@@ -39,7 +39,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
39
39
|
if (cache && cache.has(obj)) {
|
|
40
40
|
return cache.get(obj);
|
|
41
41
|
}
|
|
42
|
-
var newObj = {
|
|
42
|
+
var newObj = {
|
|
43
|
+
__proto__: null
|
|
44
|
+
};
|
|
43
45
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
44
46
|
for(var key in obj){
|
|
45
47
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -58,13 +60,13 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
58
60
|
return newObj;
|
|
59
61
|
}
|
|
60
62
|
function LinkedEntityBlock(props) {
|
|
61
|
-
const { attributes
|
|
62
|
-
const { onEntityFetchComplete
|
|
63
|
+
const { attributes, children, element } = props;
|
|
64
|
+
const { onEntityFetchComplete } = (0, _linkstracking.useLinkTracking)();
|
|
63
65
|
const isSelected = (0, _slatereact.useSelected)();
|
|
64
66
|
const editor = (0, _ContentfulEditorProvider.useContentfulEditor)();
|
|
65
67
|
const sdk = (0, _SdkProvider.useSdkContext)();
|
|
66
68
|
const isDisabled = (0, _slatereact.useReadOnly)();
|
|
67
|
-
const { id: entityId
|
|
69
|
+
const { id: entityId, linkType: entityType } = element.data.target.sys;
|
|
68
70
|
const handleEditClick = _react.useCallback(()=>{
|
|
69
71
|
const openEntity = entityType === 'Asset' ? sdk.navigator.openAsset : sdk.navigator.openEntry;
|
|
70
72
|
return openEntity(entityId, {
|
|
@@ -9,11 +9,11 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
createEmbeddedEntryBlockPlugin: function() {
|
|
13
|
-
return createEmbeddedEntryBlockPlugin;
|
|
14
|
-
},
|
|
15
12
|
createEmbeddedAssetBlockPlugin: function() {
|
|
16
13
|
return createEmbeddedAssetBlockPlugin;
|
|
14
|
+
},
|
|
15
|
+
createEmbeddedEntryBlockPlugin: function() {
|
|
16
|
+
return createEmbeddedEntryBlockPlugin;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
const _richtexttypes = require("@contentful/rich-text-types");
|
|
@@ -42,7 +42,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
42
42
|
if (cache && cache.has(obj)) {
|
|
43
43
|
return cache.get(obj);
|
|
44
44
|
}
|
|
45
|
-
var newObj = {
|
|
45
|
+
var newObj = {
|
|
46
|
+
__proto__: null
|
|
47
|
+
};
|
|
46
48
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
47
49
|
for(var key in obj){
|
|
48
50
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -60,7 +62,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
60
62
|
}
|
|
61
63
|
return newObj;
|
|
62
64
|
}
|
|
63
|
-
const { getEntryTitle
|
|
65
|
+
const { getEntryTitle, getEntryStatus } = _fieldeditorshared.entityHelpers;
|
|
64
66
|
const styles = {
|
|
65
67
|
scheduledIcon: (0, _emotion.css)({
|
|
66
68
|
verticalAlign: 'text-bottom',
|
|
@@ -68,11 +70,11 @@ const styles = {
|
|
|
68
70
|
})
|
|
69
71
|
};
|
|
70
72
|
function FetchingWrappedInlineEntryCard(props) {
|
|
71
|
-
const { data: entry
|
|
72
|
-
const { getEntityScheduledActions
|
|
73
|
+
const { data: entry, status: requestStatus } = (0, _fieldeditorreference.useEntity)('Entry', props.entryId);
|
|
74
|
+
const { getEntityScheduledActions } = (0, _fieldeditorreference.useEntityLoader)();
|
|
73
75
|
const loadEntityScheduledActions = ()=>getEntityScheduledActions('Entry', props.entryId);
|
|
74
76
|
const allContentTypes = props.sdk.space.getCachedContentTypes();
|
|
75
|
-
const { onEntityFetchComplete
|
|
77
|
+
const { onEntityFetchComplete } = props;
|
|
76
78
|
const contentType = _react.useMemo(()=>{
|
|
77
79
|
if (!entry || !allContentTypes) return undefined;
|
|
78
80
|
return allContentTypes.find((contentType)=>contentType.sys.id === entry.sys.contentType.sys.id);
|
|
@@ -39,7 +39,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
39
39
|
if (cache && cache.has(obj)) {
|
|
40
40
|
return cache.get(obj);
|
|
41
41
|
}
|
|
42
|
-
var newObj = {
|
|
42
|
+
var newObj = {
|
|
43
|
+
__proto__: null
|
|
44
|
+
};
|
|
43
45
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
44
46
|
for(var key in obj){
|
|
45
47
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -58,13 +60,13 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
58
60
|
return newObj;
|
|
59
61
|
}
|
|
60
62
|
function LinkedEntityInline(props) {
|
|
61
|
-
const { attributes
|
|
62
|
-
const { onEntityFetchComplete
|
|
63
|
+
const { attributes, children, element } = props;
|
|
64
|
+
const { onEntityFetchComplete } = (0, _linkstracking.useLinkTracking)();
|
|
63
65
|
const isSelected = (0, _slatereact.useSelected)();
|
|
64
66
|
const editor = (0, _ContentfulEditorProvider.useContentfulEditor)();
|
|
65
67
|
const sdk = (0, _SdkProvider.useSdkContext)();
|
|
66
68
|
const isDisabled = (0, _slatereact.useReadOnly)();
|
|
67
|
-
const { id: entryId
|
|
69
|
+
const { id: entryId } = element.data.target.sys;
|
|
68
70
|
function handleEditClick() {
|
|
69
71
|
return sdk.navigator.openEntry(entryId, {
|
|
70
72
|
slideIn: {
|
|
@@ -22,8 +22,8 @@ function _interop_require_default(obj) {
|
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
function LinkedResourceBlock(props) {
|
|
25
|
-
const { attributes
|
|
26
|
-
const { onEntityFetchComplete
|
|
25
|
+
const { attributes, children, element } = props;
|
|
26
|
+
const { onEntityFetchComplete } = (0, _linkstracking.useLinkTracking)();
|
|
27
27
|
const isSelected = (0, _slatereact.useSelected)();
|
|
28
28
|
const editor = (0, _ContentfulEditorProvider.useContentfulEditor)();
|
|
29
29
|
const sdk = (0, _SdkProvider.useSdkContext)();
|
|
@@ -35,7 +35,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
35
35
|
if (cache && cache.has(obj)) {
|
|
36
36
|
return cache.get(obj);
|
|
37
37
|
}
|
|
38
|
-
var newObj = {
|
|
38
|
+
var newObj = {
|
|
39
|
+
__proto__: null
|
|
40
|
+
};
|
|
39
41
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
40
42
|
for(var key in obj){
|
|
41
43
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -53,10 +55,10 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
53
55
|
}
|
|
54
56
|
return newObj;
|
|
55
57
|
}
|
|
56
|
-
const { getEntryTitle
|
|
58
|
+
const { getEntryTitle, getEntryStatus } = _fieldeditorshared.entityHelpers;
|
|
57
59
|
function FetchingWrappedResourceInlineCard(props) {
|
|
58
|
-
const { link
|
|
59
|
-
const { data
|
|
60
|
+
const { link, onEntityFetchComplete } = props;
|
|
61
|
+
const { data, status: requestStatus } = (0, _fieldeditorreference.useResource)(link.linkType, link.urn);
|
|
60
62
|
_react.useEffect(()=>{
|
|
61
63
|
if (requestStatus === 'success') {
|
|
62
64
|
onEntityFetchComplete?.();
|
|
@@ -77,7 +79,7 @@ function FetchingWrappedResourceInlineCard(props) {
|
|
|
77
79
|
isLoading: true
|
|
78
80
|
});
|
|
79
81
|
}
|
|
80
|
-
const { resource: entry
|
|
82
|
+
const { resource: entry, contentType, defaultLocaleCode, space } = data;
|
|
81
83
|
const title = getEntryTitle({
|
|
82
84
|
entry,
|
|
83
85
|
contentType,
|
|
@@ -22,8 +22,8 @@ function _interop_require_default(obj) {
|
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
function LinkedResourceInline(props) {
|
|
25
|
-
const { attributes
|
|
26
|
-
const { onEntityFetchComplete
|
|
25
|
+
const { attributes, children, element } = props;
|
|
26
|
+
const { onEntityFetchComplete } = (0, _linkstracking.useLinkTracking)();
|
|
27
27
|
const isSelected = (0, _slatereact.useSelected)();
|
|
28
28
|
const editor = (0, _ContentfulEditorProvider.useContentfulEditor)();
|
|
29
29
|
const sdk = (0, _SdkProvider.useSdkContext)();
|
|
@@ -38,7 +38,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
38
38
|
if (cache && cache.has(obj)) {
|
|
39
39
|
return cache.get(obj);
|
|
40
40
|
}
|
|
41
|
-
var newObj = {
|
|
41
|
+
var newObj = {
|
|
42
|
+
__proto__: null
|
|
43
|
+
};
|
|
42
44
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
43
45
|
for(var key in obj){
|
|
44
46
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -44,7 +44,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
44
44
|
if (cache && cache.has(obj)) {
|
|
45
45
|
return cache.get(obj);
|
|
46
46
|
}
|
|
47
|
-
var newObj = {
|
|
47
|
+
var newObj = {
|
|
48
|
+
__proto__: null
|
|
49
|
+
};
|
|
48
50
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
49
51
|
for(var key in obj){
|
|
50
52
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -20,7 +20,7 @@ function _interop_require_default(obj) {
|
|
|
20
20
|
default: obj
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
const buildHeadingEventHandler = (type)=>(editor, { options: { hotkey
|
|
23
|
+
const buildHeadingEventHandler = (type)=>(editor, { options: { hotkey } })=>(event)=>{
|
|
24
24
|
if (editor.selection && hotkey && (0, _ishotkey.default)(hotkey, event)) {
|
|
25
25
|
const isActive = (0, _editor.isBlockSelected)(editor, type);
|
|
26
26
|
editor.tracking.onShortcutAction(isActive ? 'remove' : 'insert', {
|
|
@@ -9,17 +9,17 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
|
|
13
|
-
return
|
|
12
|
+
Hr: function() {
|
|
13
|
+
return Hr;
|
|
14
14
|
},
|
|
15
15
|
ToolbarHrButton: function() {
|
|
16
16
|
return ToolbarHrButton;
|
|
17
17
|
},
|
|
18
|
-
Hr: function() {
|
|
19
|
-
return Hr;
|
|
20
|
-
},
|
|
21
18
|
createHrPlugin: function() {
|
|
22
19
|
return createHrPlugin;
|
|
20
|
+
},
|
|
21
|
+
withHrEvents: function() {
|
|
22
|
+
return withHrEvents;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
25
|
const _react = _interop_require_wildcard(require("react"));
|
|
@@ -59,7 +59,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
59
59
|
if (cache && cache.has(obj)) {
|
|
60
60
|
return cache.get(obj);
|
|
61
61
|
}
|
|
62
|
-
var newObj = {
|
|
62
|
+
var newObj = {
|
|
63
|
+
__proto__: null
|
|
64
|
+
};
|
|
63
65
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
64
66
|
for(var key in obj){
|
|
65
67
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -59,7 +59,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
59
59
|
if (cache && cache.has(obj)) {
|
|
60
60
|
return cache.get(obj);
|
|
61
61
|
}
|
|
62
|
-
var newObj = {
|
|
62
|
+
var newObj = {
|
|
63
|
+
__proto__: null
|
|
64
|
+
};
|
|
63
65
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
64
66
|
for(var key in obj){
|
|
65
67
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -140,7 +142,7 @@ function HyperlinkModal(props) {
|
|
|
140
142
|
});
|
|
141
143
|
}
|
|
142
144
|
function entityToLink(entity) {
|
|
143
|
-
const { id
|
|
145
|
+
const { id, type } = entity.sys;
|
|
144
146
|
return {
|
|
145
147
|
sys: {
|
|
146
148
|
id,
|
|
@@ -150,7 +152,7 @@ function HyperlinkModal(props) {
|
|
|
150
152
|
};
|
|
151
153
|
}
|
|
152
154
|
function entityToResourceLink(entity) {
|
|
153
|
-
const { urn
|
|
155
|
+
const { urn } = entity.sys;
|
|
154
156
|
return {
|
|
155
157
|
sys: {
|
|
156
158
|
urn,
|
|
@@ -311,7 +313,7 @@ async function addOrEditLink(editor, sdk, logAction, targetPath) {
|
|
|
311
313
|
shouldCloseOnEscapePress: true,
|
|
312
314
|
shouldCloseOnOverlayClick: true,
|
|
313
315
|
allowHeightOverflow: true
|
|
314
|
-
}, ({ onClose
|
|
316
|
+
}, ({ onClose })=>{
|
|
315
317
|
return _react.createElement(HyperlinkModal, {
|
|
316
318
|
linkTarget: linkTarget,
|
|
317
319
|
linkText: currentLinkText,
|
|
@@ -328,7 +330,7 @@ async function addOrEditLink(editor, sdk, logAction, targetPath) {
|
|
|
328
330
|
logAction(isEditing ? 'cancelEditHyperlinkDialog' : 'cancelCreateHyperlinkDialog');
|
|
329
331
|
return;
|
|
330
332
|
}
|
|
331
|
-
const { linkText: text
|
|
333
|
+
const { linkText: text, linkTarget: url, linkType: type, linkEntity: target } = data;
|
|
332
334
|
(0, _internal.withoutNormalizing)(editor, ()=>{
|
|
333
335
|
(0, _editor.insertLink)(editor, {
|
|
334
336
|
text,
|
|
@@ -37,7 +37,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
37
37
|
if (cache && cache.has(obj)) {
|
|
38
38
|
return cache.get(obj);
|
|
39
39
|
}
|
|
40
|
-
var newObj = {
|
|
40
|
+
var newObj = {
|
|
41
|
+
__proto__: null
|
|
42
|
+
};
|
|
41
43
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
42
44
|
for(var key in obj){
|
|
43
45
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -56,9 +58,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
56
58
|
return newObj;
|
|
57
59
|
}
|
|
58
60
|
function EntityHyperlink(props) {
|
|
59
|
-
const { editor
|
|
60
|
-
const { onEntityFetchComplete
|
|
61
|
-
const { target
|
|
61
|
+
const { editor, sdk, isLinkFocused, pathToElement } = (0, _useHyperlinkCommon.useHyperlinkCommon)(props.element);
|
|
62
|
+
const { onEntityFetchComplete } = (0, _linkstracking.useLinkTracking)();
|
|
63
|
+
const { target } = props.element.data;
|
|
62
64
|
const tooltipContent = (0, _useEntityInfo.useEntityInfo)({
|
|
63
65
|
target,
|
|
64
66
|
sdk,
|
|
@@ -34,7 +34,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
34
34
|
if (cache && cache.has(obj)) {
|
|
35
35
|
return cache.get(obj);
|
|
36
36
|
}
|
|
37
|
-
var newObj = {
|
|
37
|
+
var newObj = {
|
|
38
|
+
__proto__: null
|
|
39
|
+
};
|
|
38
40
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
39
41
|
for(var key in obj){
|
|
40
42
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -52,7 +54,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
52
54
|
}
|
|
53
55
|
return newObj;
|
|
54
56
|
}
|
|
55
|
-
const LinkPopover = ({ isLinkFocused
|
|
57
|
+
const LinkPopover = ({ isLinkFocused, popoverText, handleEditLink, handleRemoveLink, children, handleCopyLink })=>{
|
|
56
58
|
const isEditorFocused = (0, _hooks.useFocused)();
|
|
57
59
|
const popoverContent = _react.useRef(null);
|
|
58
60
|
const [isPopoverContentClicked, setIsPopoverContentClicked] = _react.useState(false);
|
|
@@ -37,7 +37,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
37
37
|
if (cache && cache.has(obj)) {
|
|
38
38
|
return cache.get(obj);
|
|
39
39
|
}
|
|
40
|
-
var newObj = {
|
|
40
|
+
var newObj = {
|
|
41
|
+
__proto__: null
|
|
42
|
+
};
|
|
41
43
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
42
44
|
for(var key in obj){
|
|
43
45
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -56,9 +58,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
56
58
|
return newObj;
|
|
57
59
|
}
|
|
58
60
|
function ResourceHyperlink(props) {
|
|
59
|
-
const { editor
|
|
60
|
-
const { onEntityFetchComplete
|
|
61
|
-
const { target
|
|
61
|
+
const { editor, sdk, isLinkFocused, pathToElement } = (0, _useHyperlinkCommon.useHyperlinkCommon)(props.element);
|
|
62
|
+
const { onEntityFetchComplete } = (0, _linkstracking.useLinkTracking)();
|
|
63
|
+
const { target } = props.element.data;
|
|
62
64
|
const tooltipContent = (0, _useResourceEntityInfo.useResourceEntityInfo)({
|
|
63
65
|
target,
|
|
64
66
|
onEntityFetchComplete
|
|
@@ -36,7 +36,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
36
36
|
if (cache && cache.has(obj)) {
|
|
37
37
|
return cache.get(obj);
|
|
38
38
|
}
|
|
39
|
-
var newObj = {
|
|
39
|
+
var newObj = {
|
|
40
|
+
__proto__: null
|
|
41
|
+
};
|
|
40
42
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
41
43
|
for(var key in obj){
|
|
42
44
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -35,7 +35,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
35
35
|
if (cache && cache.has(obj)) {
|
|
36
36
|
return cache.get(obj);
|
|
37
37
|
}
|
|
38
|
-
var newObj = {
|
|
38
|
+
var newObj = {
|
|
39
|
+
__proto__: null
|
|
40
|
+
};
|
|
39
41
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
40
42
|
for(var key in obj){
|
|
41
43
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -54,7 +56,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
54
56
|
return newObj;
|
|
55
57
|
}
|
|
56
58
|
function UrlHyperlink(props) {
|
|
57
|
-
const { editor
|
|
59
|
+
const { editor, sdk, isLinkFocused, pathToElement } = (0, _useHyperlinkCommon.useHyperlinkCommon)(props.element);
|
|
58
60
|
const uri = props.element.data?.uri;
|
|
59
61
|
const popoverText = _react.createElement(_f36components.TextLink, {
|
|
60
62
|
className: _styles.styles.openLink,
|
|
@@ -9,14 +9,14 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
+
handleCopyLink: function() {
|
|
13
|
+
return handleCopyLink;
|
|
14
|
+
},
|
|
12
15
|
handleEditLink: function() {
|
|
13
16
|
return handleEditLink;
|
|
14
17
|
},
|
|
15
18
|
handleRemoveLink: function() {
|
|
16
19
|
return handleRemoveLink;
|
|
17
|
-
},
|
|
18
|
-
handleCopyLink: function() {
|
|
19
|
-
return handleCopyLink;
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
const _f36components = require("@contentful/f36-components");
|
|
@@ -44,7 +44,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
44
44
|
if (cache && cache.has(obj)) {
|
|
45
45
|
return cache.get(obj);
|
|
46
46
|
}
|
|
47
|
-
var newObj = {
|
|
47
|
+
var newObj = {
|
|
48
|
+
__proto__: null
|
|
49
|
+
};
|
|
48
50
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
49
51
|
for(var key in obj){
|
|
50
52
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -66,7 +68,7 @@ const isAnchor = (element)=>element.nodeName === 'A' && !!element.getAttribute('
|
|
|
66
68
|
const isEntryAnchor = (element)=>element.nodeName === 'A' && element.getAttribute('data-link-type') === 'Entry';
|
|
67
69
|
const isAssetAnchor = (element)=>element.nodeName === 'A' && element.getAttribute('data-link-type') === 'Asset';
|
|
68
70
|
const isResourceAnchor = (element)=>element.nodeName === 'A' && element.getAttribute('data-resource-link-type') === 'Contentful:Entry';
|
|
69
|
-
const buildHyperlinkEventHandler = (sdk)=>(editor, { options: { hotkey
|
|
71
|
+
const buildHyperlinkEventHandler = (sdk)=>(editor, { options: { hotkey } })=>{
|
|
70
72
|
return (event)=>{
|
|
71
73
|
if (!editor.selection) {
|
|
72
74
|
return;
|
|
@@ -11,7 +11,7 @@ Object.defineProperty(exports, "useEntityInfo", {
|
|
|
11
11
|
const _react = require("react");
|
|
12
12
|
const _fieldeditorshared = require("@contentful/field-editor-shared");
|
|
13
13
|
const _utils = require("./utils");
|
|
14
|
-
async function fetchAllData({ sdk
|
|
14
|
+
async function fetchAllData({ sdk, entityId, entityType, localeCode, defaultLocaleCode }) {
|
|
15
15
|
let contentType;
|
|
16
16
|
const getEntity = entityType === 'Entry' ? sdk.space.getEntry : sdk.space.getAsset;
|
|
17
17
|
const entity = await getEntity(entityId);
|
|
@@ -48,7 +48,7 @@ async function fetchAllData({ sdk , entityId , entityType , localeCode , default
|
|
|
48
48
|
contentTypeName: contentType ? contentType.name : ''
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
|
-
function useRequestStatus({ sdk
|
|
51
|
+
function useRequestStatus({ sdk, target, onEntityFetchComplete }) {
|
|
52
52
|
const [requestStatus, setRequestStatus] = (0, _react.useState)({
|
|
53
53
|
type: 'loading'
|
|
54
54
|
});
|
|
@@ -84,7 +84,7 @@ function useRequestStatus({ sdk , target , onEntityFetchComplete }) {
|
|
|
84
84
|
}
|
|
85
85
|
function useEntityInfo(props) {
|
|
86
86
|
const status = useRequestStatus(props);
|
|
87
|
-
const { linkType
|
|
87
|
+
const { linkType } = props.target.sys;
|
|
88
88
|
if (status.type === 'loading') {
|
|
89
89
|
return `Loading ${linkType.toLowerCase()}...`;
|
|
90
90
|
}
|
|
@@ -32,7 +32,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
32
32
|
if (cache && cache.has(obj)) {
|
|
33
33
|
return cache.get(obj);
|
|
34
34
|
}
|
|
35
|
-
var newObj = {
|
|
35
|
+
var newObj = {
|
|
36
|
+
__proto__: null
|
|
37
|
+
};
|
|
36
38
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
37
39
|
for(var key in obj){
|
|
38
40
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -50,8 +52,8 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
50
52
|
}
|
|
51
53
|
return newObj;
|
|
52
54
|
}
|
|
53
|
-
function useResourceEntityInfo({ onEntityFetchComplete
|
|
54
|
-
const { data
|
|
55
|
+
function useResourceEntityInfo({ onEntityFetchComplete, target }) {
|
|
56
|
+
const { data, error, status } = (0, _fieldeditorreference.useResource)(target.sys.linkType, target.sys.urn);
|
|
55
57
|
_react.useEffect(()=>{
|
|
56
58
|
if (status === 'success') {
|
|
57
59
|
onEntityFetchComplete?.();
|
|
@@ -9,11 +9,11 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
hasText: function() {
|
|
13
|
-
return hasText;
|
|
14
|
-
},
|
|
15
12
|
getEntityInfo: function() {
|
|
16
13
|
return getEntityInfo;
|
|
14
|
+
},
|
|
15
|
+
hasText: function() {
|
|
16
|
+
return hasText;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
const _fieldeditorreference = require("@contentful/field-editor-reference");
|
|
@@ -28,7 +28,7 @@ function getEntityInfo(data) {
|
|
|
28
28
|
if (!data) {
|
|
29
29
|
return '';
|
|
30
30
|
}
|
|
31
|
-
const { entityTitle
|
|
31
|
+
const { entityTitle, contentTypeName, entityStatus, jobs } = data;
|
|
32
32
|
const title = (0, _utils.truncateTitle)(entityTitle, 60) || 'Untitled';
|
|
33
33
|
const scheduledActions = jobs.length > 0 ? (0, _fieldeditorreference.getScheduleTooltipContent)({
|
|
34
34
|
job: jobs[0],
|