@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
|
@@ -9,21 +9,21 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
|
|
13
|
-
return
|
|
12
|
+
ContentfulEditorIdProvider: function() {
|
|
13
|
+
return ContentfulEditorIdProvider;
|
|
14
14
|
},
|
|
15
15
|
editorContext: function() {
|
|
16
16
|
return editorContext;
|
|
17
17
|
},
|
|
18
|
-
|
|
19
|
-
return
|
|
20
|
-
},
|
|
21
|
-
useContentfulEditorId: function() {
|
|
22
|
-
return useContentfulEditorId;
|
|
18
|
+
getContentfulEditorId: function() {
|
|
19
|
+
return getContentfulEditorId;
|
|
23
20
|
},
|
|
24
21
|
useContentfulEditor: function() {
|
|
25
22
|
return useContentfulEditor;
|
|
26
23
|
},
|
|
24
|
+
useContentfulEditorId: function() {
|
|
25
|
+
return useContentfulEditorId;
|
|
26
|
+
},
|
|
27
27
|
useContentfulEditorRef: function() {
|
|
28
28
|
return useContentfulEditorRef;
|
|
29
29
|
}
|
|
@@ -31,7 +31,7 @@ _export(exports, {
|
|
|
31
31
|
const _react = require("react");
|
|
32
32
|
const _hooks = require("./internal/hooks");
|
|
33
33
|
function getContentfulEditorId(sdk) {
|
|
34
|
-
const { entry
|
|
34
|
+
const { entry, field } = sdk;
|
|
35
35
|
const sys = entry.getSys();
|
|
36
36
|
return `rich-text-editor-${sys.id}-${field.id}-${field.locale}`;
|
|
37
37
|
}
|
|
@@ -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)) {
|
|
@@ -78,7 +80,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
78
80
|
return newObj;
|
|
79
81
|
}
|
|
80
82
|
const ConnectedRichTextEditor = (props)=>{
|
|
81
|
-
const { sdk
|
|
83
|
+
const { sdk, onAction, restrictedMarks } = props;
|
|
82
84
|
const id = (0, _ContentfulEditorProvider.getContentfulEditorId)(sdk);
|
|
83
85
|
const plugins = _react.useMemo(()=>(0, _plugins.getPlugins)(sdk, onAction ?? _noop.default, restrictedMarks), [
|
|
84
86
|
sdk,
|
|
@@ -127,7 +129,7 @@ const ConnectedRichTextEditor = (props)=>{
|
|
|
127
129
|
})))));
|
|
128
130
|
};
|
|
129
131
|
const RichTextEditor = (props)=>{
|
|
130
|
-
const { sdk
|
|
132
|
+
const { sdk, isInitiallyDisabled, onAction, restrictedMarks, ...otherProps } = props;
|
|
131
133
|
const isEmptyValue = _react.useCallback((value)=>!value || (0, _fastdeepequal.default)(value, _richtexttypes.EMPTY_DOCUMENT), []);
|
|
132
134
|
const id = (0, _ContentfulEditorProvider.getContentfulEditorId)(props.sdk);
|
|
133
135
|
return _react.createElement(_fieldeditorreference.EntityProvider, {
|
|
@@ -138,7 +140,7 @@ const RichTextEditor = (props)=>{
|
|
|
138
140
|
isInitiallyDisabled: isInitiallyDisabled,
|
|
139
141
|
isEmptyValue: isEmptyValue,
|
|
140
142
|
isEqualValues: _fastdeepequal.default
|
|
141
|
-
}, ({ lastRemoteValue
|
|
143
|
+
}, ({ lastRemoteValue, disabled, setValue })=>_react.createElement(ConnectedRichTextEditor, {
|
|
142
144
|
...otherProps,
|
|
143
145
|
key: `rich-text-editor-${id}`,
|
|
144
146
|
value: lastRemoteValue,
|
package/dist/cjs/SdkProvider.js
CHANGED
|
@@ -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)) {
|
|
@@ -62,7 +64,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
62
64
|
}
|
|
63
65
|
return newObj;
|
|
64
66
|
}
|
|
65
|
-
function useSdk({ sdk
|
|
67
|
+
function useSdk({ sdk }) {
|
|
66
68
|
const sdkMemo = _react.useMemo(()=>sdk, []);
|
|
67
69
|
return sdkMemo;
|
|
68
70
|
}
|
|
@@ -40,7 +40,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
40
40
|
if (cache && cache.has(obj)) {
|
|
41
41
|
return cache.get(obj);
|
|
42
42
|
}
|
|
43
|
-
var newObj = {
|
|
43
|
+
var newObj = {
|
|
44
|
+
__proto__: null
|
|
45
|
+
};
|
|
44
46
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
45
47
|
for(var key in obj){
|
|
46
48
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -94,7 +96,7 @@ const useOnValueChanged = (onChange)=>{
|
|
|
94
96
|
setEditorOnChange
|
|
95
97
|
]);
|
|
96
98
|
};
|
|
97
|
-
const SyncEditorChanges = ({ incomingValue
|
|
99
|
+
const SyncEditorChanges = ({ incomingValue, onChange })=>{
|
|
98
100
|
useAcceptIncomingChanges(incomingValue);
|
|
99
101
|
useOnValueChanged(onChange);
|
|
100
102
|
return null;
|
|
@@ -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)) {
|
|
@@ -85,7 +87,7 @@ describe('Toolbar', ()=>{
|
|
|
85
87
|
test('everything on the toolbar should be disabled', async ()=>{
|
|
86
88
|
const sdk = mockSdk();
|
|
87
89
|
const id = (0, _ContentfulEditorProvider.getContentfulEditorId)(sdk);
|
|
88
|
-
const { getByTestId
|
|
90
|
+
const { getByTestId } = (0, _react1.render)(_react.createElement(_platecommon.Plate, {
|
|
89
91
|
id: id
|
|
90
92
|
}, _react.createElement(_SdkProvider.SdkProvider, {
|
|
91
93
|
sdk: sdk
|
|
@@ -119,7 +121,7 @@ describe('Toolbar', ()=>{
|
|
|
119
121
|
_richtexttypes.MARKS.SUPERSCRIPT
|
|
120
122
|
]);
|
|
121
123
|
const id = (0, _ContentfulEditorProvider.getContentfulEditorId)(sdk);
|
|
122
|
-
const { queryByTestId
|
|
124
|
+
const { queryByTestId } = (0, _react1.render)(_react.createElement(_platecommon.Plate, {
|
|
123
125
|
id: id
|
|
124
126
|
}, _react.createElement(_SdkProvider.SdkProvider, {
|
|
125
127
|
sdk: sdk
|
|
@@ -137,7 +139,7 @@ describe('Toolbar', ()=>{
|
|
|
137
139
|
_richtexttypes.MARKS.CODE
|
|
138
140
|
]);
|
|
139
141
|
const id = (0, _ContentfulEditorProvider.getContentfulEditorId)(sdk);
|
|
140
|
-
const { queryByTestId
|
|
142
|
+
const { queryByTestId } = (0, _react1.render)(_react.createElement(_platecommon.Plate, {
|
|
141
143
|
id: id
|
|
142
144
|
}, _react.createElement(_SdkProvider.SdkProvider, {
|
|
143
145
|
sdk: sdk
|
|
@@ -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)) {
|
|
@@ -56,7 +58,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
56
58
|
}
|
|
57
59
|
return newObj;
|
|
58
60
|
}
|
|
59
|
-
const EmbedEntityWidget = ({ isDisabled
|
|
61
|
+
const EmbedEntityWidget = ({ isDisabled, canInsertBlocks })=>{
|
|
60
62
|
const sdk = (0, _SdkProvider.useSdkContext)();
|
|
61
63
|
const editor = (0, _ContentfulEditorProvider.useContentfulEditor)();
|
|
62
64
|
const [isEmbedDropdownOpen, setEmbedDropdownOpen] = (0, _react.useState)(false);
|
|
@@ -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,7 +52,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
50
52
|
}
|
|
51
53
|
return newObj;
|
|
52
54
|
}
|
|
53
|
-
function EmbeddedEntityDropdownButton({ children
|
|
55
|
+
function EmbeddedEntityDropdownButton({ children, isDisabled, isOpen, onClose, onToggle }) {
|
|
54
56
|
return _react.createElement(_f36components.Menu, {
|
|
55
57
|
placement: "bottom-end",
|
|
56
58
|
isOpen: isOpen,
|
|
@@ -23,7 +23,7 @@ const styles = {
|
|
|
23
23
|
z-index: 2;
|
|
24
24
|
`
|
|
25
25
|
};
|
|
26
|
-
const StickyToolbarWrapper = ({ isDisabled
|
|
26
|
+
const StickyToolbarWrapper = ({ isDisabled, children })=>_react.default.createElement("div", {
|
|
27
27
|
className: isDisabled ? '' : styles.nativeSticky
|
|
28
28
|
}, children);
|
|
29
29
|
const _default = StickyToolbarWrapper;
|
|
@@ -58,7 +58,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
58
58
|
if (cache && cache.has(obj)) {
|
|
59
59
|
return cache.get(obj);
|
|
60
60
|
}
|
|
61
|
-
var newObj = {
|
|
61
|
+
var newObj = {
|
|
62
|
+
__proto__: null
|
|
63
|
+
};
|
|
62
64
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
63
65
|
for(var key in obj){
|
|
64
66
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -121,7 +123,7 @@ const styles = {
|
|
|
121
123
|
marginRight: '20px'
|
|
122
124
|
})
|
|
123
125
|
};
|
|
124
|
-
const Dropdown = ({ sdk
|
|
126
|
+
const Dropdown = ({ sdk, isDisabled })=>{
|
|
125
127
|
const editor = (0, _ContentfulEditorProvider.useContentfulEditor)();
|
|
126
128
|
const isActive = editor && ((0, _queries.isMarkActive)(editor, _richtexttypes.MARKS.SUPERSCRIPT) || (0, _queries.isMarkActive)(editor, _richtexttypes.MARKS.SUBSCRIPT) || (0, _queries.isMarkActive)(editor, _richtexttypes.MARKS.CODE));
|
|
127
129
|
return _react.createElement(_f36components.Menu, null, _react.createElement(_f36components.Menu.Trigger, null, _react.createElement("span", null, _react.createElement(_f36components.IconButton, {
|
|
@@ -140,7 +142,7 @@ const Dropdown = ({ sdk , isDisabled })=>{
|
|
|
140
142
|
isDisabled: isDisabled
|
|
141
143
|
})));
|
|
142
144
|
};
|
|
143
|
-
const Toolbar = ({ isDisabled
|
|
145
|
+
const Toolbar = ({ isDisabled })=>{
|
|
144
146
|
const sdk = (0, _SdkProvider.useSdkContext)();
|
|
145
147
|
const editor = (0, _ContentfulEditorProvider.useContentfulEditor)();
|
|
146
148
|
const canInsertBlocks = !(0, _editor.isNodeTypeSelected)(editor, _richtexttypes.BLOCKS.TABLE);
|
|
@@ -59,7 +59,7 @@ function newReferenceEditorFakeSdk(props) {
|
|
|
59
59
|
locales,
|
|
60
60
|
cmaAdapter: (0, _fieldeditortestutils.createFakeCMAAdapter)({
|
|
61
61
|
Entry: {
|
|
62
|
-
get: async ({ entryId
|
|
62
|
+
get: async ({ entryId })=>{
|
|
63
63
|
if (props?.fetchDelay) {
|
|
64
64
|
await delay(props.fetchDelay);
|
|
65
65
|
}
|
|
@@ -76,7 +76,7 @@ function newReferenceEditorFakeSdk(props) {
|
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
78
|
Asset: {
|
|
79
|
-
get: async ({ assetId
|
|
79
|
+
get: async ({ assetId })=>{
|
|
80
80
|
if (props?.fetchDelay) {
|
|
81
81
|
await delay(props.fetchDelay);
|
|
82
82
|
}
|
|
@@ -101,7 +101,7 @@ function newReferenceEditorFakeSdk(props) {
|
|
|
101
101
|
}
|
|
102
102
|
},
|
|
103
103
|
ContentType: {
|
|
104
|
-
get: async ({ contentTypeId
|
|
104
|
+
get: async ({ contentTypeId })=>{
|
|
105
105
|
if (contentTypeId === _fixtures.contentTypes.published.sys.id) {
|
|
106
106
|
return _fixtures.contentTypes.published;
|
|
107
107
|
}
|
|
@@ -12,17 +12,17 @@ _export(exports, {
|
|
|
12
12
|
changed: function() {
|
|
13
13
|
return _changed_assetjson.default;
|
|
14
14
|
},
|
|
15
|
+
created: function() {
|
|
16
|
+
return _created_assetjson.default;
|
|
17
|
+
},
|
|
15
18
|
empty: function() {
|
|
16
19
|
return _empty_assetjson.default;
|
|
17
20
|
},
|
|
18
|
-
published: function() {
|
|
19
|
-
return _published_assetjson.default;
|
|
20
|
-
},
|
|
21
21
|
invalid: function() {
|
|
22
22
|
return _invalid_assetjson.default;
|
|
23
23
|
},
|
|
24
|
-
|
|
25
|
-
return
|
|
24
|
+
published: function() {
|
|
25
|
+
return _published_assetjson.default;
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
28
|
const _changed_assetjson = _interop_require_default(require("./changed_asset.json"));
|
|
@@ -15,11 +15,11 @@ _export(exports, {
|
|
|
15
15
|
empty: function() {
|
|
16
16
|
return _empty_entryjson.default;
|
|
17
17
|
},
|
|
18
|
-
published: function() {
|
|
19
|
-
return _published_entryjson.default;
|
|
20
|
-
},
|
|
21
18
|
invalid: function() {
|
|
22
19
|
return _invalid_entryjson.default;
|
|
20
|
+
},
|
|
21
|
+
published: function() {
|
|
22
|
+
return _published_entryjson.default;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
25
|
const _changed_entryjson = _interop_require_default(require("./changed_entry.json"));
|
|
@@ -51,7 +51,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
51
51
|
if (cache && cache.has(obj)) {
|
|
52
52
|
return cache.get(obj);
|
|
53
53
|
}
|
|
54
|
-
var newObj = {
|
|
54
|
+
var newObj = {
|
|
55
|
+
__proto__: null
|
|
56
|
+
};
|
|
55
57
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
56
58
|
for(var key in obj){
|
|
57
59
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -9,12 +9,12 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
LINK_TYPES: function() {
|
|
13
|
-
return LINK_TYPES;
|
|
14
|
-
},
|
|
15
12
|
HyperlinkDialog: function() {
|
|
16
13
|
return HyperlinkDialog;
|
|
17
14
|
},
|
|
15
|
+
LINK_TYPES: function() {
|
|
16
|
+
return LINK_TYPES;
|
|
17
|
+
},
|
|
18
18
|
openHyperlinkDialog: function() {
|
|
19
19
|
return openHyperlinkDialog;
|
|
20
20
|
}
|
|
@@ -66,7 +66,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
66
66
|
if (cache && cache.has(obj)) {
|
|
67
67
|
return cache.get(obj);
|
|
68
68
|
}
|
|
69
|
-
var newObj = {
|
|
69
|
+
var newObj = {
|
|
70
|
+
__proto__: null
|
|
71
|
+
};
|
|
70
72
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
71
73
|
for(var key in obj){
|
|
72
74
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -93,7 +95,7 @@ function isFeaturingEntitySelector(entitySelectorConfigs = {}) {
|
|
|
93
95
|
return !!entitySelectorConfigs.Entry || !!entitySelectorConfigs.Asset;
|
|
94
96
|
}
|
|
95
97
|
function entityToLink(entity) {
|
|
96
|
-
const { id
|
|
98
|
+
const { id, type } = entity.sys;
|
|
97
99
|
return {
|
|
98
100
|
sys: {
|
|
99
101
|
id,
|
|
@@ -113,7 +115,7 @@ class HyperlinkDialog extends (_React_Component = _react.Component) {
|
|
|
113
115
|
}));
|
|
114
116
|
}
|
|
115
117
|
getValue() {
|
|
116
|
-
const { text
|
|
118
|
+
const { text, type, uri } = this.state;
|
|
117
119
|
const value = {
|
|
118
120
|
type
|
|
119
121
|
};
|
|
@@ -128,7 +130,7 @@ class HyperlinkDialog extends (_React_Component = _react.Component) {
|
|
|
128
130
|
return value;
|
|
129
131
|
}
|
|
130
132
|
isLinkComplete() {
|
|
131
|
-
const { text
|
|
133
|
+
const { text, type, uri, target } = this.getValue();
|
|
132
134
|
const requiresText = !this.props.hideText;
|
|
133
135
|
if (requiresText && !text) {
|
|
134
136
|
return false;
|
|
@@ -136,7 +138,7 @@ class HyperlinkDialog extends (_React_Component = _react.Component) {
|
|
|
136
138
|
return type === LINK_TYPES.URI && uri || target;
|
|
137
139
|
}
|
|
138
140
|
render() {
|
|
139
|
-
const { labels
|
|
141
|
+
const { labels } = this.props;
|
|
140
142
|
return _react.createElement(_fieldeditorreference.EntityProvider, {
|
|
141
143
|
sdk: this.props.sdk
|
|
142
144
|
}, _react.createElement(_react.Fragment, null, _react.createElement(_f36components.ModalContent, null, this.renderFields()), _react.createElement(_f36components.ModalControls, null, _react.createElement(_f36components.Button, {
|
|
@@ -155,8 +157,8 @@ class HyperlinkDialog extends (_React_Component = _react.Component) {
|
|
|
155
157
|
}, labels.confirm))));
|
|
156
158
|
}
|
|
157
159
|
renderFields() {
|
|
158
|
-
const { hideText
|
|
159
|
-
const { uri
|
|
160
|
+
const { hideText, allowedHyperlinkTypes, entitySelectorConfigs } = this.props;
|
|
161
|
+
const { uri, text, type } = this.state;
|
|
160
162
|
const isUriInputAutoFocused = type === LINK_TYPES.URI && (hideText || !!text);
|
|
161
163
|
return _react.createElement(_f36components.Form, null, hideText ? null : _react.createElement(_f36components.FormControl, {
|
|
162
164
|
id: "link-text",
|
|
@@ -199,7 +201,7 @@ class HyperlinkDialog extends (_React_Component = _react.Component) {
|
|
|
199
201
|
}), _react.createElement(_f36components.FormControl.HelpText, null, "A protocol may be required, e.g. https://")) : this.renderEntityField());
|
|
200
202
|
}
|
|
201
203
|
renderEntityField() {
|
|
202
|
-
const { type
|
|
204
|
+
const { type, entityLinks } = this.state;
|
|
203
205
|
const resetEntity = ()=>this.setTargetEntity(type, null);
|
|
204
206
|
const entityLink = entityLinks[type];
|
|
205
207
|
const isEntitySelectorVisible = !entityLink;
|
|
@@ -246,7 +248,7 @@ class HyperlinkDialog extends (_React_Component = _react.Component) {
|
|
|
246
248
|
this.props.onClose(this.getValue());
|
|
247
249
|
});
|
|
248
250
|
_define_property(this, "selectEntry", async ()=>{
|
|
249
|
-
const { locale
|
|
251
|
+
const { locale, contentTypes } = this.props.entitySelectorConfigs.Entry;
|
|
250
252
|
const entry = await this.props.sdk.dialogs.selectSingleEntry({
|
|
251
253
|
locale,
|
|
252
254
|
contentTypes
|
|
@@ -254,13 +256,13 @@ class HyperlinkDialog extends (_React_Component = _react.Component) {
|
|
|
254
256
|
this.setTargetEntity(LINK_TYPES.ENTRY, entry);
|
|
255
257
|
});
|
|
256
258
|
_define_property(this, "selectAsset", async ()=>{
|
|
257
|
-
const { locale
|
|
259
|
+
const { locale } = this.props.entitySelectorConfigs.Asset;
|
|
258
260
|
const asset = await this.props.sdk.dialogs.selectSingleAsset({
|
|
259
261
|
locale
|
|
260
262
|
});
|
|
261
263
|
this.setTargetEntity(LINK_TYPES.ASSET, asset);
|
|
262
264
|
});
|
|
263
|
-
const { text
|
|
265
|
+
const { text, type, uri, target } = props.value;
|
|
264
266
|
const isEntityLink = Boolean(target);
|
|
265
267
|
const entityLinks = {
|
|
266
268
|
[LINK_TYPES.ENTRY]: null,
|
|
@@ -322,7 +324,7 @@ _define_property(HyperlinkDialog, "defaultProps", {
|
|
|
322
324
|
LINK_TYPES.URI
|
|
323
325
|
]
|
|
324
326
|
});
|
|
325
|
-
const openHyperlinkDialog = (dialogs, { value
|
|
327
|
+
const openHyperlinkDialog = (dialogs, { value, showTextInput, allowedHyperlinkTypes, entitySelectorConfigs })=>{
|
|
326
328
|
const isNew = !(value.uri || value.target);
|
|
327
329
|
const props = {
|
|
328
330
|
labels: {
|
|
@@ -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)) {
|
|
@@ -52,7 +54,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
52
54
|
}
|
|
53
55
|
const openRichTextDialog = (sdk)=>(options)=>{
|
|
54
56
|
if (options.parameters?.type === 'rich-text-hyperlink-dialog') {
|
|
55
|
-
return _fieldeditorshared.ModalDialogLauncher.openDialog(options, ({ onClose
|
|
57
|
+
return _fieldeditorshared.ModalDialogLauncher.openDialog(options, ({ onClose })=>{
|
|
56
58
|
return _react.createElement(_HyperlinkDialog.HyperlinkDialog, {
|
|
57
59
|
...options.parameters,
|
|
58
60
|
onClose: onClose,
|
|
@@ -31,7 +31,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
31
31
|
if (cache && cache.has(obj)) {
|
|
32
32
|
return cache.get(obj);
|
|
33
33
|
}
|
|
34
|
-
var newObj = {
|
|
34
|
+
var newObj = {
|
|
35
|
+
__proto__: null
|
|
36
|
+
};
|
|
35
37
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
36
38
|
for(var key in obj){
|
|
37
39
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -59,7 +59,7 @@ describe('internal mark', ()=>{
|
|
|
59
59
|
})
|
|
60
60
|
}
|
|
61
61
|
];
|
|
62
|
-
for (const { input
|
|
62
|
+
for (const { input, expected, title } of data){
|
|
63
63
|
it(`${title}`, ()=>{
|
|
64
64
|
expect((0, _removeInternalMarks.removeInternalMarks)(input)).toEqual(expected);
|
|
65
65
|
});
|
|
@@ -9,71 +9,71 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
+
INLINE_TYPES: function() {
|
|
13
|
+
return INLINE_TYPES;
|
|
14
|
+
},
|
|
12
15
|
LINK_TYPES: function() {
|
|
13
16
|
return LINK_TYPES;
|
|
14
17
|
},
|
|
15
|
-
|
|
16
|
-
return
|
|
17
|
-
},
|
|
18
|
-
isRootLevel: function() {
|
|
19
|
-
return isRootLevel;
|
|
20
|
-
},
|
|
21
|
-
getNodeEntryFromSelection: function() {
|
|
22
|
-
return getNodeEntryFromSelection;
|
|
23
|
-
},
|
|
24
|
-
isNodeTypeSelected: function() {
|
|
25
|
-
return isNodeTypeSelected;
|
|
26
|
-
},
|
|
27
|
-
moveToTheNextLine: function() {
|
|
28
|
-
return moveToTheNextLine;
|
|
29
|
-
},
|
|
30
|
-
moveToTheNextChar: function() {
|
|
31
|
-
return moveToTheNextChar;
|
|
18
|
+
focus: function() {
|
|
19
|
+
return focus;
|
|
32
20
|
},
|
|
33
|
-
|
|
34
|
-
return
|
|
21
|
+
getAncestorPathFromSelection: function() {
|
|
22
|
+
return getAncestorPathFromSelection;
|
|
35
23
|
},
|
|
36
24
|
getElementFromCurrentSelection: function() {
|
|
37
25
|
return getElementFromCurrentSelection;
|
|
38
26
|
},
|
|
39
|
-
|
|
40
|
-
return
|
|
27
|
+
getNextNode: function() {
|
|
28
|
+
return getNextNode;
|
|
29
|
+
},
|
|
30
|
+
getNodeEntryFromSelection: function() {
|
|
31
|
+
return getNodeEntryFromSelection;
|
|
41
32
|
},
|
|
42
33
|
getTableSize: function() {
|
|
43
34
|
return getTableSize;
|
|
44
35
|
},
|
|
36
|
+
insertEmptyParagraph: function() {
|
|
37
|
+
return insertEmptyParagraph;
|
|
38
|
+
},
|
|
45
39
|
insertLink: function() {
|
|
46
40
|
return insertLink;
|
|
47
41
|
},
|
|
48
|
-
|
|
49
|
-
return
|
|
42
|
+
isAtEndOfTextSelection: function() {
|
|
43
|
+
return isAtEndOfTextSelection;
|
|
50
44
|
},
|
|
51
|
-
|
|
52
|
-
return
|
|
45
|
+
isBlockSelected: function() {
|
|
46
|
+
return isBlockSelected;
|
|
53
47
|
},
|
|
54
|
-
|
|
55
|
-
return
|
|
48
|
+
isInlineOrText: function() {
|
|
49
|
+
return isInlineOrText;
|
|
56
50
|
},
|
|
57
|
-
|
|
58
|
-
return
|
|
51
|
+
isLinkActive: function() {
|
|
52
|
+
return isLinkActive;
|
|
59
53
|
},
|
|
60
|
-
|
|
61
|
-
return
|
|
54
|
+
isList: function() {
|
|
55
|
+
return isList;
|
|
62
56
|
},
|
|
63
|
-
|
|
64
|
-
return
|
|
57
|
+
isNodeTypeSelected: function() {
|
|
58
|
+
return isNodeTypeSelected;
|
|
65
59
|
},
|
|
66
|
-
|
|
67
|
-
return
|
|
60
|
+
isRootLevel: function() {
|
|
61
|
+
return isRootLevel;
|
|
68
62
|
},
|
|
69
|
-
|
|
70
|
-
return
|
|
63
|
+
moveToTheNextChar: function() {
|
|
64
|
+
return moveToTheNextChar;
|
|
71
65
|
},
|
|
72
|
-
|
|
73
|
-
return
|
|
66
|
+
moveToTheNextLine: function() {
|
|
67
|
+
return moveToTheNextLine;
|
|
74
68
|
},
|
|
75
69
|
toggleElement: function() {
|
|
76
70
|
return toggleElement;
|
|
71
|
+
},
|
|
72
|
+
unwrapLink: function() {
|
|
73
|
+
return unwrapLink;
|
|
74
|
+
},
|
|
75
|
+
wrapLink: function() {
|
|
76
|
+
return wrapLink;
|
|
77
77
|
}
|
|
78
78
|
});
|
|
79
79
|
const _richtexttypes = require("@contentful/rich-text-types");
|
|
@@ -185,11 +185,11 @@ function unwrapLink(editor) {
|
|
|
185
185
|
match: (node)=>!(0, _queries.isEditor)(node) && (0, _queries.isElement)(node) && LINK_TYPES.includes(node.type)
|
|
186
186
|
});
|
|
187
187
|
}
|
|
188
|
-
function wrapLink(editor, { text
|
|
188
|
+
function wrapLink(editor, { text, url, target, type, path }) {
|
|
189
189
|
if (isLinkActive(editor) && !path) {
|
|
190
190
|
unwrapLink(editor);
|
|
191
191
|
}
|
|
192
|
-
const { selection
|
|
192
|
+
const { selection } = editor;
|
|
193
193
|
const isCollapsed = selection && (0, _queries.isRangeCollapsed)(selection);
|
|
194
194
|
const link = {
|
|
195
195
|
type,
|
|
@@ -244,7 +244,7 @@ function getNextNode(editor) {
|
|
|
244
244
|
from: editor.selection.focus.path
|
|
245
245
|
});
|
|
246
246
|
while(true){
|
|
247
|
-
const { done
|
|
247
|
+
const { done, value } = descendants.next();
|
|
248
248
|
if (done) {
|
|
249
249
|
return null;
|
|
250
250
|
}
|
|
@@ -9,11 +9,11 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
IS_SAFARI: function() {
|
|
13
|
-
return IS_SAFARI;
|
|
14
|
-
},
|
|
15
12
|
IS_CHROME: function() {
|
|
16
13
|
return IS_CHROME;
|
|
14
|
+
},
|
|
15
|
+
IS_SAFARI: function() {
|
|
16
|
+
return IS_SAFARI;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
const IS_SAFARI = typeof navigator !== 'undefined' && /Version\/[\d.]+.*Safari/.test(navigator.userAgent);
|
|
@@ -12,11 +12,11 @@ _export(exports, {
|
|
|
12
12
|
formatDate: function() {
|
|
13
13
|
return formatDate;
|
|
14
14
|
},
|
|
15
|
-
formatTime: function() {
|
|
16
|
-
return formatTime;
|
|
17
|
-
},
|
|
18
15
|
formatDateAndTime: function() {
|
|
19
16
|
return formatDateAndTime;
|
|
17
|
+
},
|
|
18
|
+
formatTime: function() {
|
|
19
|
+
return formatTime;
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
const _moment = _interop_require_default(require("moment"));
|
|
@@ -9,20 +9,20 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
document: function() {
|
|
13
|
-
return document;
|
|
14
|
-
},
|
|
15
12
|
block: function() {
|
|
16
13
|
return block;
|
|
17
14
|
},
|
|
15
|
+
document: function() {
|
|
16
|
+
return document;
|
|
17
|
+
},
|
|
18
18
|
inline: function() {
|
|
19
19
|
return inline;
|
|
20
20
|
},
|
|
21
|
-
text: function() {
|
|
22
|
-
return text;
|
|
23
|
-
},
|
|
24
21
|
mark: function() {
|
|
25
22
|
return mark;
|
|
23
|
+
},
|
|
24
|
+
text: function() {
|
|
25
|
+
return text;
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
28
|
const document = (...content)=>({
|