@contentful/field-editor-rich-text 3.4.2 → 3.4.4
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/CHANGELOG.md +10 -0
- package/dist/field-editor-rich-text.cjs.development.js +19 -17
- package/dist/field-editor-rich-text.cjs.development.js.map +1 -1
- package/dist/field-editor-rich-text.cjs.production.min.js +1 -1
- package/dist/field-editor-rich-text.cjs.production.min.js.map +1 -1
- package/dist/field-editor-rich-text.esm.js +15 -13
- package/dist/field-editor-rich-text.esm.js.map +1 -1
- package/dist/helpers/editor.d.ts +4 -4
- package/dist/helpers/sanitizeIncomingSlateDoc.d.ts +2 -2
- package/dist/internal/hooks.d.ts +3 -0
- package/dist/internal/misc.d.ts +3 -1
- package/dist/internal/types/editor.d.ts +0 -19
- package/dist/plugins/EmbeddedEntityBlock/LinkedEntityBlock.d.ts +13 -8
- package/dist/plugins/Hyperlink/components/EntityHyperlink.d.ts +18 -7
- package/dist/plugins/Hyperlink/components/UrlHyperlink.d.ts +16 -4
- package/dist/plugins/List/transforms/moveListItems.d.ts +2 -2
- package/dist/plugins/links-tracking.d.ts +2 -5
- package/dist/prepareDocument.d.ts +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [3.4.4](https://github.com/contentful/field-editors/compare/@contentful/field-editor-rich-text@3.4.3...@contentful/field-editor-rich-text@3.4.4) (2023-02-02)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- remove command mark after space [TOL-945] ([#1335](https://github.com/contentful/field-editors/issues/1335)) ([08efe51](https://github.com/contentful/field-editors/commit/08efe51edf7a2f46fedc4c87a05f17b467d1c91a))
|
|
11
|
+
|
|
12
|
+
## [3.4.3](https://github.com/contentful/field-editors/compare/@contentful/field-editor-rich-text@3.4.2...@contentful/field-editor-rich-text@3.4.3) (2023-01-24)
|
|
13
|
+
|
|
14
|
+
**Note:** Version bump only for package @contentful/field-editor-rich-text
|
|
15
|
+
|
|
6
16
|
## [3.4.2](https://github.com/contentful/field-editors/compare/@contentful/field-editor-rich-text@3.4.1...@contentful/field-editor-rich-text@3.4.2) (2023-01-20)
|
|
7
17
|
|
|
8
18
|
**Note:** Version bump only for package @contentful/field-editor-rich-text
|
|
@@ -13,6 +13,7 @@ var p = require('@udecode/plate-core');
|
|
|
13
13
|
var emotion = require('emotion');
|
|
14
14
|
var areEqual = _interopDefault(require('fast-deep-equal'));
|
|
15
15
|
var noop = _interopDefault(require('lodash/noop'));
|
|
16
|
+
var Slate = require('slate-react');
|
|
16
17
|
var plateSerializerDocx = require('@udecode/plate-serializer-docx');
|
|
17
18
|
var plateBreak = require('@udecode/plate-break');
|
|
18
19
|
var plateResetNode = require('@udecode/plate-reset-node');
|
|
@@ -26,7 +27,6 @@ var find = _interopDefault(require('lodash/find'));
|
|
|
26
27
|
var flow = _interopDefault(require('lodash/flow'));
|
|
27
28
|
var get = _interopDefault(require('lodash/get'));
|
|
28
29
|
var tokens = _interopDefault(require('@contentful/f36-tokens'));
|
|
29
|
-
var Slate = require('slate-react');
|
|
30
30
|
var f36Icons = require('@contentful/f36-icons');
|
|
31
31
|
var plateList = require('@udecode/plate-list');
|
|
32
32
|
var castArray = _interopDefault(require('lodash/castArray'));
|
|
@@ -248,6 +248,10 @@ function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
|
248
248
|
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
+
var useReadOnly = Slate.useReadOnly;
|
|
252
|
+
var usePlateEditorRef = p.usePlateEditorRef;
|
|
253
|
+
var usePlateEditorState = p.usePlateEditorState;
|
|
254
|
+
|
|
251
255
|
function getContentfulEditorId(sdk) {
|
|
252
256
|
var entry = sdk.entry,
|
|
253
257
|
field = sdk.field;
|
|
@@ -273,13 +277,13 @@ function useContentfulEditorId(id) {
|
|
|
273
277
|
|
|
274
278
|
function useContentfulEditor(id) {
|
|
275
279
|
var editorId = useContentfulEditorId(id);
|
|
276
|
-
var editor =
|
|
280
|
+
var editor = usePlateEditorState(editorId);
|
|
277
281
|
return editor;
|
|
278
282
|
} // This doesn't re-render when the value changes
|
|
279
283
|
|
|
280
284
|
function useContentfulEditorRef(id) {
|
|
281
285
|
var editorId = useContentfulEditorId(id);
|
|
282
|
-
var editor =
|
|
286
|
+
var editor = usePlateEditorRef(editorId);
|
|
283
287
|
return editor;
|
|
284
288
|
}
|
|
285
289
|
|
|
@@ -2352,8 +2356,10 @@ var createOnKeyDown = function createOnKeyDown() {
|
|
|
2352
2356
|
}
|
|
2353
2357
|
|
|
2354
2358
|
if (isHotkey('escape', event)) {
|
|
2359
|
+
event.stopPropagation();
|
|
2355
2360
|
removeMark(editor, COMMAND_PROMPT, range);
|
|
2356
2361
|
editor.tracking.onCommandPaletteAction('cancelRichTextCommandPalette');
|
|
2362
|
+
focusEditor(editor);
|
|
2357
2363
|
}
|
|
2358
2364
|
};
|
|
2359
2365
|
};
|
|
@@ -4837,14 +4843,14 @@ var isList = function isList(node) {
|
|
|
4837
4843
|
var hasListAsDirectParent = function hasListAsDirectParent(editor, _ref) {
|
|
4838
4844
|
var path = _ref[1];
|
|
4839
4845
|
|
|
4840
|
-
var _ref2 =
|
|
4846
|
+
var _ref2 = getParentNode(editor, path) || [],
|
|
4841
4847
|
parentNode = _ref2[0];
|
|
4842
4848
|
|
|
4843
4849
|
return isList(parentNode);
|
|
4844
4850
|
};
|
|
4845
4851
|
|
|
4846
4852
|
var getNearestListAncestor = function getNearestListAncestor(editor, path) {
|
|
4847
|
-
return
|
|
4853
|
+
return getAboveNode(editor, {
|
|
4848
4854
|
at: path,
|
|
4849
4855
|
mode: 'lowest',
|
|
4850
4856
|
match: isList
|
|
@@ -4928,7 +4934,7 @@ var isListTypeActive = function isListTypeActive(editor, type) {
|
|
|
4928
4934
|
} // Lists can be nested. Here, we take the list type at the lowest level
|
|
4929
4935
|
|
|
4930
4936
|
|
|
4931
|
-
var listNode =
|
|
4937
|
+
var listNode = getBlockAbove(editor, {
|
|
4932
4938
|
match: {
|
|
4933
4939
|
type: [Contentful.BLOCKS.OL_LIST, Contentful.BLOCKS.UL_LIST]
|
|
4934
4940
|
},
|
|
@@ -5803,8 +5809,8 @@ var withNormalizer = function withNormalizer(editor) {
|
|
|
5803
5809
|
var rules = baseRules; // Derive normalization rules from other plugin's configurations
|
|
5804
5810
|
|
|
5805
5811
|
for (var _iterator = _createForOfIteratorHelperLoose(editor.plugins), _step; !(_step = _iterator()).done;) {
|
|
5806
|
-
var p
|
|
5807
|
-
var _rules = p
|
|
5812
|
+
var p = _step.value;
|
|
5813
|
+
var _rules = p.normalizer;
|
|
5808
5814
|
|
|
5809
5815
|
if (!_rules) {
|
|
5810
5816
|
continue;
|
|
@@ -5816,14 +5822,14 @@ var withNormalizer = function withNormalizer(editor) {
|
|
|
5816
5822
|
// Clone to avoid mutation bugs
|
|
5817
5823
|
var rule = _extends({}, _rule);
|
|
5818
5824
|
|
|
5819
|
-
if (!rule.match && !p
|
|
5825
|
+
if (!rule.match && !p.isElement) {
|
|
5820
5826
|
throw new NormalizerError('rule.match MUST be defined in a non-element plugin');
|
|
5821
5827
|
} // By default we filter elements with given plugin type
|
|
5822
5828
|
|
|
5823
5829
|
|
|
5824
5830
|
if (!rule.match) {
|
|
5825
5831
|
rule.match = {
|
|
5826
|
-
type:
|
|
5832
|
+
type: getPluginType(editor, p.key)
|
|
5827
5833
|
};
|
|
5828
5834
|
} // Conditional transformation e.g.
|
|
5829
5835
|
// {
|
|
@@ -6340,8 +6346,6 @@ var createSelectOnBackspacePlugin = function createSelectOnBackspacePlugin() {
|
|
|
6340
6346
|
});
|
|
6341
6347
|
};
|
|
6342
6348
|
|
|
6343
|
-
var useReadOnly = Slate.useReadOnly;
|
|
6344
|
-
|
|
6345
6349
|
var addRow = function addRow(editor, getNextRowPath) {
|
|
6346
6350
|
if (someNode(editor, {
|
|
6347
6351
|
match: {
|
|
@@ -7560,7 +7564,7 @@ function sanitizeIncomingSlateDoc(nodes) {
|
|
|
7560
7564
|
}
|
|
7561
7565
|
|
|
7562
7566
|
return _extends({}, node, {
|
|
7563
|
-
children: sanitizeIncomingSlateDoc(node.children)
|
|
7567
|
+
children: sanitizeIncomingSlateDoc(node == null ? void 0 : node.children)
|
|
7564
7568
|
});
|
|
7565
7569
|
});
|
|
7566
7570
|
}
|
|
@@ -7738,7 +7742,7 @@ var EmbedEntityWidget = function EmbedEntityWidget(_ref) {
|
|
|
7738
7742
|
nodeType: Contentful.BLOCKS.EMBEDDED_ENTRY,
|
|
7739
7743
|
onClose: onCloseEntityDropdown
|
|
7740
7744
|
}), inlineEntryEmbedEnabled && /*#__PURE__*/React__default.createElement(ToolbarEmbeddedEntityInlineButton, {
|
|
7741
|
-
isDisabled: !!isDisabled ||
|
|
7745
|
+
isDisabled: !!isDisabled || isLinkActive(editor),
|
|
7742
7746
|
onClose: onCloseEntityDropdown
|
|
7743
7747
|
}), blockAssetEmbedEnabled && /*#__PURE__*/React__default.createElement(EmbeddedEntityBlockToolbarIcon, {
|
|
7744
7748
|
isDisabled: !!isDisabled,
|
|
@@ -8023,9 +8027,7 @@ var ConnectedRichTextEditor = function ConnectedRichTextEditor(props) {
|
|
|
8023
8027
|
return;
|
|
8024
8028
|
}
|
|
8025
8029
|
|
|
8026
|
-
p.getPlateActions(id).value(
|
|
8027
|
-
// @ts-expect-error
|
|
8028
|
-
normalizeEditorValue(documentToEditorValue(props.value), {
|
|
8030
|
+
p.getPlateActions(id).value(normalizeEditorValue(documentToEditorValue(props.value), {
|
|
8029
8031
|
plugins: plugins,
|
|
8030
8032
|
disableCorePlugins: disableCorePlugins
|
|
8031
8033
|
}));
|