@contentful/field-editor-rich-text 3.4.21 → 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.
@@ -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);
@@ -4078,67 +4068,6 @@ const insertListFragment = editor => {
4078
4068
  };
4079
4069
  };
4080
4070
 
4081
- /**
4082
- * Credit: Modified version of Plate's list plugin
4083
- * See: https://github.com/udecode/plate/blob/main/packages/nodes/list
4084
- */
4085
- const deleteBackwardList = (editor, unit) => {
4086
- const res = plateList.getListItemEntry(editor, {});
4087
- let moved = false;
4088
-
4089
- if (res) {
4090
- const {
4091
- list,
4092
- listItem
4093
- } = res;
4094
-
4095
- if (isSelectionAtBlockStart(editor, {
4096
- match: node => node.type === Contentful.BLOCKS.LIST_ITEM
4097
- })) {
4098
- withoutNormalizing(editor, () => {
4099
- moved = plateList.removeFirstListItem(editor, {
4100
- list,
4101
- listItem
4102
- });
4103
- if (moved) return;
4104
- moved = plateList.removeListItem(editor, {
4105
- list,
4106
- listItem
4107
- });
4108
- if (moved) return;
4109
-
4110
- if (isFirstChild(listItem[1]) && !plateList.isListNested(editor, list[1])) {
4111
- plateResetNode.onKeyDownResetNode(editor, // TODO look into this
4112
- // @ts-expect-error
4113
- mockPlugin({
4114
- options: {
4115
- rules: [{
4116
- types: [Contentful.BLOCKS.LIST_ITEM],
4117
- defaultType: Contentful.BLOCKS.PARAGRAPH,
4118
- hotkey: 'backspace',
4119
- predicate: () => isSelectionAtBlockStart(editor),
4120
- onReset: e => unwrapList(e)
4121
- }]
4122
- }
4123
- }))(plateResetNode.SIMULATE_BACKSPACE);
4124
- moved = true;
4125
- return;
4126
- }
4127
-
4128
- deleteFragment(editor, {
4129
- // FIXME: see if we can remove unit
4130
- // @ts-expect-error
4131
- unit: unit,
4132
- reverse: true
4133
- });
4134
- moved = true;
4135
- });
4136
- }
4137
- }
4138
-
4139
- return moved;
4140
- };
4141
-
4142
4071
  /**
4143
4072
  * Credit: Modified version of Plate's list plugin
4144
4073
  * See: https://github.com/udecode/plate/blob/main/packages/nodes/list
@@ -4146,16 +4075,10 @@ const deleteBackwardList = (editor, unit) => {
4146
4075
  const validLiChildrenTypes = Contentful.LIST_ITEM_BLOCKS;
4147
4076
  const withList = editor => {
4148
4077
  const {
4149
- deleteBackward,
4150
4078
  deleteForward,
4151
4079
  deleteFragment
4152
4080
  } = editor;
4153
4081
 
4154
- editor.deleteBackward = unit => {
4155
- if (deleteBackwardList(editor, unit)) return;
4156
- deleteBackward(unit);
4157
- };
4158
-
4159
4082
  editor.deleteForward = unit => {
4160
4083
  if (plateList.deleteForwardList(editor)) return;
4161
4084
  deleteForward(unit);