@contentful/field-editor-rich-text 3.4.1 → 3.4.3
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 +8 -0
- package/dist/field-editor-rich-text.cjs.development.js +17 -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 +13 -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 +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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.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)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @contentful/field-editor-rich-text
|
|
9
|
+
|
|
10
|
+
## [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)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @contentful/field-editor-rich-text
|
|
13
|
+
|
|
6
14
|
## [3.4.1](https://github.com/contentful/field-editors/compare/@contentful/field-editor-rich-text@3.4.0...@contentful/field-editor-rich-text@3.4.1) (2023-01-20)
|
|
7
15
|
|
|
8
16
|
### Bug Fixes
|
|
@@ -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
|
|
|
@@ -4837,14 +4841,14 @@ var isList = function isList(node) {
|
|
|
4837
4841
|
var hasListAsDirectParent = function hasListAsDirectParent(editor, _ref) {
|
|
4838
4842
|
var path = _ref[1];
|
|
4839
4843
|
|
|
4840
|
-
var _ref2 =
|
|
4844
|
+
var _ref2 = getParentNode(editor, path) || [],
|
|
4841
4845
|
parentNode = _ref2[0];
|
|
4842
4846
|
|
|
4843
4847
|
return isList(parentNode);
|
|
4844
4848
|
};
|
|
4845
4849
|
|
|
4846
4850
|
var getNearestListAncestor = function getNearestListAncestor(editor, path) {
|
|
4847
|
-
return
|
|
4851
|
+
return getAboveNode(editor, {
|
|
4848
4852
|
at: path,
|
|
4849
4853
|
mode: 'lowest',
|
|
4850
4854
|
match: isList
|
|
@@ -4928,7 +4932,7 @@ var isListTypeActive = function isListTypeActive(editor, type) {
|
|
|
4928
4932
|
} // Lists can be nested. Here, we take the list type at the lowest level
|
|
4929
4933
|
|
|
4930
4934
|
|
|
4931
|
-
var listNode =
|
|
4935
|
+
var listNode = getBlockAbove(editor, {
|
|
4932
4936
|
match: {
|
|
4933
4937
|
type: [Contentful.BLOCKS.OL_LIST, Contentful.BLOCKS.UL_LIST]
|
|
4934
4938
|
},
|
|
@@ -5803,8 +5807,8 @@ var withNormalizer = function withNormalizer(editor) {
|
|
|
5803
5807
|
var rules = baseRules; // Derive normalization rules from other plugin's configurations
|
|
5804
5808
|
|
|
5805
5809
|
for (var _iterator = _createForOfIteratorHelperLoose(editor.plugins), _step; !(_step = _iterator()).done;) {
|
|
5806
|
-
var p
|
|
5807
|
-
var _rules = p
|
|
5810
|
+
var p = _step.value;
|
|
5811
|
+
var _rules = p.normalizer;
|
|
5808
5812
|
|
|
5809
5813
|
if (!_rules) {
|
|
5810
5814
|
continue;
|
|
@@ -5816,14 +5820,14 @@ var withNormalizer = function withNormalizer(editor) {
|
|
|
5816
5820
|
// Clone to avoid mutation bugs
|
|
5817
5821
|
var rule = _extends({}, _rule);
|
|
5818
5822
|
|
|
5819
|
-
if (!rule.match && !p
|
|
5823
|
+
if (!rule.match && !p.isElement) {
|
|
5820
5824
|
throw new NormalizerError('rule.match MUST be defined in a non-element plugin');
|
|
5821
5825
|
} // By default we filter elements with given plugin type
|
|
5822
5826
|
|
|
5823
5827
|
|
|
5824
5828
|
if (!rule.match) {
|
|
5825
5829
|
rule.match = {
|
|
5826
|
-
type:
|
|
5830
|
+
type: getPluginType(editor, p.key)
|
|
5827
5831
|
};
|
|
5828
5832
|
} // Conditional transformation e.g.
|
|
5829
5833
|
// {
|
|
@@ -6340,8 +6344,6 @@ var createSelectOnBackspacePlugin = function createSelectOnBackspacePlugin() {
|
|
|
6340
6344
|
});
|
|
6341
6345
|
};
|
|
6342
6346
|
|
|
6343
|
-
var useReadOnly = Slate.useReadOnly;
|
|
6344
|
-
|
|
6345
6347
|
var addRow = function addRow(editor, getNextRowPath) {
|
|
6346
6348
|
if (someNode(editor, {
|
|
6347
6349
|
match: {
|
|
@@ -7560,7 +7562,7 @@ function sanitizeIncomingSlateDoc(nodes) {
|
|
|
7560
7562
|
}
|
|
7561
7563
|
|
|
7562
7564
|
return _extends({}, node, {
|
|
7563
|
-
children: sanitizeIncomingSlateDoc(node.children)
|
|
7565
|
+
children: sanitizeIncomingSlateDoc(node == null ? void 0 : node.children)
|
|
7564
7566
|
});
|
|
7565
7567
|
});
|
|
7566
7568
|
}
|
|
@@ -7738,7 +7740,7 @@ var EmbedEntityWidget = function EmbedEntityWidget(_ref) {
|
|
|
7738
7740
|
nodeType: Contentful.BLOCKS.EMBEDDED_ENTRY,
|
|
7739
7741
|
onClose: onCloseEntityDropdown
|
|
7740
7742
|
}), inlineEntryEmbedEnabled && /*#__PURE__*/React__default.createElement(ToolbarEmbeddedEntityInlineButton, {
|
|
7741
|
-
isDisabled: !!isDisabled ||
|
|
7743
|
+
isDisabled: !!isDisabled || isLinkActive(editor),
|
|
7742
7744
|
onClose: onCloseEntityDropdown
|
|
7743
7745
|
}), blockAssetEmbedEnabled && /*#__PURE__*/React__default.createElement(EmbeddedEntityBlockToolbarIcon, {
|
|
7744
7746
|
isDisabled: !!isDisabled,
|
|
@@ -8023,9 +8025,7 @@ var ConnectedRichTextEditor = function ConnectedRichTextEditor(props) {
|
|
|
8023
8025
|
return;
|
|
8024
8026
|
}
|
|
8025
8027
|
|
|
8026
|
-
p.getPlateActions(id).value(
|
|
8027
|
-
// @ts-expect-error
|
|
8028
|
-
normalizeEditorValue(documentToEditorValue(props.value), {
|
|
8028
|
+
p.getPlateActions(id).value(normalizeEditorValue(documentToEditorValue(props.value), {
|
|
8029
8029
|
plugins: plugins,
|
|
8030
8030
|
disableCorePlugins: disableCorePlugins
|
|
8031
8031
|
}));
|