@bigbinary/neeto-editor 1.39.6 → 1.39.8

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.
@@ -139,7 +139,6 @@ var CharacterCountWrapper = function CharacterCountWrapper(_ref) {
139
139
  "data-cy": "neeto-editor-character-count"
140
140
  }, editor.storage.characterCount.characters(), " characters"));
141
141
  };
142
- var CharacterCountWrapper$1 = /*#__PURE__*/React.memo(CharacterCountWrapper);
143
142
 
144
143
  /**
145
144
  * This extension allows you to count the characters and words of your document.
@@ -7904,16 +7903,51 @@ var KeyboardShortcuts = function KeyboardShortcuts(_ref) {
7904
7903
  return true;
7905
7904
  }
7906
7905
  return false;
7906
+ },
7907
+ // To fix the issue with backspace on the empty list item moving the focus to the block on top.
7908
+ // https://github.com/ueberdosis/tiptap/issues/2829#issuecomment-1511064298
7909
+ Backspace: function Backspace() {
7910
+ return _this.editor.commands.command(function (_ref2) {
7911
+ var tr = _ref2.tr;
7912
+ var selection = tr.selection,
7913
+ doc = tr.doc;
7914
+ var $cursor = selection.$cursor;
7915
+ var depth = $cursor === null || $cursor === void 0 ? void 0 : $cursor.depth;
7916
+ if ($cursor && depth >= 3 &&
7917
+ // At least the structure is doc -> orderedList/bulletList -> listItem -> paragraph
7918
+ $cursor.parent.type.name === "paragraph" &&
7919
+ // The cursor is inside a paragraph.
7920
+ $cursor.parentOffset === 0 &&
7921
+ // The cursor is at the beginning of the paragraph.
7922
+ $cursor.node(depth - 1).type.name === "listItem" &&
7923
+ // The paragraph is inside a listItem.
7924
+ $cursor.index(depth - 1) === 0 &&
7925
+ // The paragraph is at the beginning of the listItem.
7926
+ $cursor.index(depth - 2) === 0 // The listItem is at the beginning of the list.
7927
+ ) {
7928
+ var listItemNode = $cursor.node(depth - 1);
7929
+ var listItemPos = $cursor.before(depth - 1);
7930
+ var $contentBegin = doc.resolve(listItemPos + 1);
7931
+ var $contentEnd = doc.resolve(listItemPos + listItemNode.nodeSize - 1);
7932
+ var range = $contentBegin.blockRange($contentEnd);
7933
+ var target = utils.liftTarget(range);
7934
+ if (target !== null) {
7935
+ tr.lift(range, target);
7936
+ return true;
7937
+ }
7938
+ }
7939
+ return false;
7940
+ });
7907
7941
  }
7908
7942
  }, shortcuts);
7909
7943
  }
7910
7944
  });
7911
7945
  };
7912
7946
  var KeyboardShortcuts$1 = {
7913
- configure: function configure(_ref2) {
7914
- var onSubmit = _ref2.onSubmit,
7915
- shortcuts = _ref2.shortcuts,
7916
- isBlockQuoteActive = _ref2.isBlockQuoteActive;
7947
+ configure: function configure(_ref3) {
7948
+ var onSubmit = _ref3.onSubmit,
7949
+ shortcuts = _ref3.shortcuts,
7950
+ isBlockQuoteActive = _ref3.isBlockQuoteActive;
7917
7951
  return KeyboardShortcuts({
7918
7952
  onSubmit: onSubmit,
7919
7953
  shortcuts: shortcuts,
@@ -14880,7 +14914,7 @@ var Editor = function Editor(_ref, ref) {
14880
14914
  }), /*#__PURE__*/React__default["default"].createElement(TableActionMenu, {
14881
14915
  editor: editor,
14882
14916
  appendTo: wrapperRef
14883
- }), /*#__PURE__*/React__default["default"].createElement(CharacterCountWrapper$1, {
14917
+ }), /*#__PURE__*/React__default["default"].createElement(CharacterCountWrapper, {
14884
14918
  editor: editor,
14885
14919
  isActive: isCharacterCountActive
14886
14920
  }))));