@contentful/field-editor-rich-text 2.0.0-next.27 → 2.0.0-next.28

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.
@@ -590,58 +590,6 @@ function getAncestorPathFromSelection(editor) {
590
590
  return level.length === 1;
591
591
  });
592
592
  }
593
- var isAtEndOfTextSelection = function isAtEndOfTextSelection(editor) {
594
- var _editor$selection2, _editor$selection3;
595
-
596
- return ((_editor$selection2 = editor.selection) == null ? void 0 : _editor$selection2.focus.offset) === plateCore.getText(editor, (_editor$selection3 = editor.selection) == null ? void 0 : _editor$selection3.focus.path).length;
597
- };
598
- function currentSelectionStartsTableCell(editor) {
599
- var _editor$selection4;
600
-
601
- var _getNodeEntryFromSele2 = getNodeEntryFromSelection(editor, [Contentful.BLOCKS.TABLE_CELL, Contentful.BLOCKS.TABLE_HEADER_CELL]),
602
- tableCellNode = _getNodeEntryFromSele2[0],
603
- path = _getNodeEntryFromSele2[1];
604
-
605
- return !!tableCellNode && (!plateCore.getText(editor, path) || ((_editor$selection4 = editor.selection) == null ? void 0 : _editor$selection4.focus.offset) === 0);
606
- }
607
- /**
608
- * This traversal strategy is unfortunately necessary because Slate doesn't
609
- * expose something like Node.next(editor).
610
- */
611
-
612
- function getNextNode(editor) {
613
- if (!editor.selection) {
614
- return null;
615
- }
616
-
617
- var descendants = slate.Node.descendants(editor, {
618
- from: editor.selection.focus.path
619
- }); // eslint-disable-next-line no-constant-condition
620
-
621
- while (true) {
622
- var _descendants$next = descendants.next(),
623
- done = _descendants$next.done,
624
- value = _descendants$next.value;
625
-
626
- if (done) {
627
- return null;
628
- }
629
-
630
- var node = value[0],
631
- path = value[1];
632
-
633
- if (slate.Path.isCommon(path, editor.selection.focus.path)) {
634
- continue;
635
- }
636
-
637
- return node;
638
- }
639
- } // TODO: move to table plugin
640
-
641
- function currentSelectionPrecedesTableCell(editor) {
642
- var nextNode = getNextNode(editor);
643
- return !!nextNode && Contentful.TABLE_BLOCKS.includes(nextNode.type) && isAtEndOfTextSelection(editor);
644
- }
645
593
  var INLINE_TYPES = /*#__PURE__*/Object.values(Contentful.INLINES);
646
594
  var isInlineOrText = function isInlineOrText(node) {
647
595
  // either text or inline elements
@@ -5933,16 +5881,7 @@ var Table = function Table(props) {
5933
5881
  var createTableOnKeyDown = function createTableOnKeyDown(editor, plugin) {
5934
5882
  var defaultHandler = plateTable.onKeyDownTable(editor, plugin);
5935
5883
  return function (event) {
5936
- if (event.key === 'Backspace' && currentSelectionStartsTableCell(editor) || event.key === 'Delete' && currentSelectionPrecedesTableCell(editor)) {
5937
- // The default behavior here would be to delete the preceding or forthcoming
5938
- // leaf node, in this case a cell or header cell. But we don't want to do that,
5939
- // because it would leave us with a non-standard number of table cells.
5940
- event.preventDefault();
5941
- event.stopPropagation();
5942
- return;
5943
- } // This fixes `Cannot resolve a Slate point from DOM point: [object HTMLDivElement]` when typing while the cursor is before table
5944
-
5945
-
5884
+ // This fixes `Cannot resolve a Slate point from DOM point: [object HTMLDivElement]` when typing while the cursor is before table
5946
5885
  var windowSelection = window.getSelection();
5947
5886
 
5948
5887
  if (windowSelection) {