@contentful/field-editor-rich-text 3.4.20 → 3.4.22
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/field-editor-rich-text.cjs.development.js +4 -77
- package/dist/field-editor-rich-text.cjs.development.js.map +1 -1
- package/dist/field-editor-rich-text.cjs.production.min.js +38 -38
- package/dist/field-editor-rich-text.cjs.production.min.js.map +1 -1
- package/dist/field-editor-rich-text.esm.js +8 -81
- package/dist/field-editor-rich-text.esm.js.map +1 -1
- package/package.json +2 -2
- package/CHANGELOG.md +0 -942
- package/dist/plugins/List/transforms/deleteBackwardList.d.ts +0 -2
|
@@ -103,10 +103,6 @@ const fromDOMPoint = (editor, domPoint, opts = {
|
|
|
103
103
|
}) => {
|
|
104
104
|
return p.toSlatePoint(editor, domPoint, opts);
|
|
105
105
|
};
|
|
106
|
-
const mockPlugin = plugin => {
|
|
107
|
-
return p.mockPlugin( // TODO check if there is a way around this ugly casting
|
|
108
|
-
plugin);
|
|
109
|
-
};
|
|
110
106
|
const getPlateSelectors = id => {
|
|
111
107
|
return p.getPlateSelectors(id);
|
|
112
108
|
};
|
|
@@ -335,9 +331,6 @@ const getChildren = entry => {
|
|
|
335
331
|
|
|
336
332
|
return p.getChildren(entry);
|
|
337
333
|
};
|
|
338
|
-
const isFirstChild = path => {
|
|
339
|
-
return p.isFirstChild(path);
|
|
340
|
-
};
|
|
341
334
|
const getDescendantNodeByPath = (root, path) => {
|
|
342
335
|
// @ts-expect-error
|
|
343
336
|
return s.Node.get(root, path);
|
|
@@ -537,9 +530,6 @@ const removeNodes = (editor, opts) => {
|
|
|
537
530
|
const moveNodes = (editor, opts) => {
|
|
538
531
|
p.moveNodes(editor, opts);
|
|
539
532
|
};
|
|
540
|
-
const deleteFragment = (editor, options) => {
|
|
541
|
-
return p.deleteFragment(editor, options);
|
|
542
|
-
};
|
|
543
533
|
|
|
544
534
|
const IS_SAFARI = typeof navigator !== 'undefined' && /*#__PURE__*/ /Version\/[\d.]+.*Safari/.test(navigator.userAgent);
|
|
545
535
|
const IS_CHROME = /*#__PURE__*/ /(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9.]+)(:?\s|$)/.test(navigator.userAgent);
|
|
@@ -1783,6 +1773,8 @@ async function selectEntityAndInsert(nodeType, sdk, editor, logAction) {
|
|
|
1783
1773
|
nodeType
|
|
1784
1774
|
});
|
|
1785
1775
|
} else {
|
|
1776
|
+
// Selection prevents incorrect position of inserted ref when RTE doesn't have focus
|
|
1777
|
+
// (i.e. when using hotkeys and slide-in)
|
|
1786
1778
|
select(editor, selection);
|
|
1787
1779
|
insertBlock$1(editor, nodeType, entity);
|
|
1788
1780
|
ensureFollowingParagraph(editor);
|
|
@@ -2178,6 +2170,8 @@ async function selectEntityAndInsert$1(editor, sdk, logAction) {
|
|
|
2178
2170
|
nodeType: Contentful.INLINES.EMBEDDED_ENTRY
|
|
2179
2171
|
});
|
|
2180
2172
|
} else {
|
|
2173
|
+
// Selection prevents incorrect position of inserted ref when RTE doesn't have focus
|
|
2174
|
+
// (i.e. when using hotkeys and slide-in)
|
|
2181
2175
|
select(editor, selection);
|
|
2182
2176
|
insertNodes(editor, createInlineEntryNode$1(entry.sys.id));
|
|
2183
2177
|
logAction('insert', {
|
|
@@ -4074,67 +4068,6 @@ const insertListFragment = editor => {
|
|
|
4074
4068
|
};
|
|
4075
4069
|
};
|
|
4076
4070
|
|
|
4077
|
-
/**
|
|
4078
|
-
* Credit: Modified version of Plate's list plugin
|
|
4079
|
-
* See: https://github.com/udecode/plate/blob/main/packages/nodes/list
|
|
4080
|
-
*/
|
|
4081
|
-
const deleteBackwardList = (editor, unit) => {
|
|
4082
|
-
const res = plateList.getListItemEntry(editor, {});
|
|
4083
|
-
let moved = false;
|
|
4084
|
-
|
|
4085
|
-
if (res) {
|
|
4086
|
-
const {
|
|
4087
|
-
list,
|
|
4088
|
-
listItem
|
|
4089
|
-
} = res;
|
|
4090
|
-
|
|
4091
|
-
if (isSelectionAtBlockStart(editor, {
|
|
4092
|
-
match: node => node.type === Contentful.BLOCKS.LIST_ITEM
|
|
4093
|
-
})) {
|
|
4094
|
-
withoutNormalizing(editor, () => {
|
|
4095
|
-
moved = plateList.removeFirstListItem(editor, {
|
|
4096
|
-
list,
|
|
4097
|
-
listItem
|
|
4098
|
-
});
|
|
4099
|
-
if (moved) return;
|
|
4100
|
-
moved = plateList.removeListItem(editor, {
|
|
4101
|
-
list,
|
|
4102
|
-
listItem
|
|
4103
|
-
});
|
|
4104
|
-
if (moved) return;
|
|
4105
|
-
|
|
4106
|
-
if (isFirstChild(listItem[1]) && !plateList.isListNested(editor, list[1])) {
|
|
4107
|
-
plateResetNode.onKeyDownResetNode(editor, // TODO look into this
|
|
4108
|
-
// @ts-expect-error
|
|
4109
|
-
mockPlugin({
|
|
4110
|
-
options: {
|
|
4111
|
-
rules: [{
|
|
4112
|
-
types: [Contentful.BLOCKS.LIST_ITEM],
|
|
4113
|
-
defaultType: Contentful.BLOCKS.PARAGRAPH,
|
|
4114
|
-
hotkey: 'backspace',
|
|
4115
|
-
predicate: () => isSelectionAtBlockStart(editor),
|
|
4116
|
-
onReset: e => unwrapList(e)
|
|
4117
|
-
}]
|
|
4118
|
-
}
|
|
4119
|
-
}))(plateResetNode.SIMULATE_BACKSPACE);
|
|
4120
|
-
moved = true;
|
|
4121
|
-
return;
|
|
4122
|
-
}
|
|
4123
|
-
|
|
4124
|
-
deleteFragment(editor, {
|
|
4125
|
-
// FIXME: see if we can remove unit
|
|
4126
|
-
// @ts-expect-error
|
|
4127
|
-
unit: unit,
|
|
4128
|
-
reverse: true
|
|
4129
|
-
});
|
|
4130
|
-
moved = true;
|
|
4131
|
-
});
|
|
4132
|
-
}
|
|
4133
|
-
}
|
|
4134
|
-
|
|
4135
|
-
return moved;
|
|
4136
|
-
};
|
|
4137
|
-
|
|
4138
4071
|
/**
|
|
4139
4072
|
* Credit: Modified version of Plate's list plugin
|
|
4140
4073
|
* See: https://github.com/udecode/plate/blob/main/packages/nodes/list
|
|
@@ -4142,16 +4075,10 @@ const deleteBackwardList = (editor, unit) => {
|
|
|
4142
4075
|
const validLiChildrenTypes = Contentful.LIST_ITEM_BLOCKS;
|
|
4143
4076
|
const withList = editor => {
|
|
4144
4077
|
const {
|
|
4145
|
-
deleteBackward,
|
|
4146
4078
|
deleteForward,
|
|
4147
4079
|
deleteFragment
|
|
4148
4080
|
} = editor;
|
|
4149
4081
|
|
|
4150
|
-
editor.deleteBackward = unit => {
|
|
4151
|
-
if (deleteBackwardList(editor, unit)) return;
|
|
4152
|
-
deleteBackward(unit);
|
|
4153
|
-
};
|
|
4154
|
-
|
|
4155
4082
|
editor.deleteForward = unit => {
|
|
4156
4083
|
if (plateList.deleteForwardList(editor)) return;
|
|
4157
4084
|
deleteForward(unit);
|