@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.
package/dist/Editor.js CHANGED
@@ -4,7 +4,7 @@ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
4
4
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
5
5
  import * as React from 'react';
6
6
  import React__default, { memo, useEffect, useState, useRef, forwardRef, useCallback, useImperativeHandle } from 'react';
7
- import { E as Extension, a as Mark, m as mergeAttributes, b as markInputRule, c as markPasteRule, g as getMarkAttributes, N as Node, D as DecorationSet, d as Decoration, w as wrappingInputRule, t as textblockTypeInputRule, k as keydownHandler, e as callOrReturn, f as getExtensionField, n as nodeInputRule, h as findChildren, i as NodeViewWrapper, j as NodeViewContent, R as ReactNodeViewRenderer, P as PasteRule, v as validateUrl, l as escapeForRegEx, o as ReactRenderer, p as EmojiPickerMenu, q as emojiPickerApi, r as combineTransactionSteps, s as getChangedRanges, u as findChildrenInRange, x as getMarksBetween, y as getAttributes, I as InputRule, z as highlightFocussedNode, A as resetFocussedNode, B as findParentNodeClosestToPos, C as BubbleMenu, F as getLinkPopoverPosition, G as getMarkType, H as getMarkRange, J as useEditor, M as Menu$3, K as EditorContent, L as MediaUploader, O as EmbedOption, Q as EditorView } from './chunk-7fc1f9b9.js';
7
+ import { E as Extension, a as Mark, m as mergeAttributes, b as markInputRule, c as markPasteRule, g as getMarkAttributes, N as Node, D as DecorationSet, d as Decoration, w as wrappingInputRule, t as textblockTypeInputRule, k as keydownHandler, e as callOrReturn, f as getExtensionField, n as nodeInputRule, h as findChildren, i as NodeViewWrapper, j as NodeViewContent, R as ReactNodeViewRenderer, P as PasteRule, v as validateUrl, l as escapeForRegEx, o as ReactRenderer, p as EmojiPickerMenu, q as emojiPickerApi, r as combineTransactionSteps, s as getChangedRanges, u as findChildrenInRange, x as getMarksBetween, y as getAttributes, I as InputRule, z as highlightFocussedNode, A as resetFocussedNode, B as findParentNodeClosestToPos, C as BubbleMenu, F as getLinkPopoverPosition, G as getMarkType, H as getMarkRange, J as useEditor, M as Menu$3, K as EditorContent, L as MediaUploader, O as EmbedOption, Q as EditorView } from './chunk-6e497ab8.js';
8
8
  import classnames from 'classnames';
9
9
  import { C as COMBINED_REGEX, D as DIRECT_UPLOAD_ENDPOINT, E as EDITOR_OPTIONS } from './chunk-edd8b9fe.js';
10
10
  import { isNotPresent, isNotEmpty, isPresent, noop as noop$1, slugify } from '@bigbinary/neeto-cist';
@@ -12,7 +12,7 @@ import { useOnClickOutside, useFuncDebounce } from '@bigbinary/neeto-commons-fro
12
12
  import { Dropdown, Input, Button, Spinner, Modal, Toastr, Avatar, Typography, Checkbox, Label } from '@bigbinary/neetoui';
13
13
  import { is, isNil, mergeRight, isEmpty as isEmpty$1, assoc, equals } from 'ramda';
14
14
  import { n } from './chunk-15c449f1.js';
15
- import { P as Plugin, b as PluginKey, T as TextSelection, d as dropPoint, S as Selection, N as NodeSelection, F as Fragment, c as Slice, M as Mapping, e as SelectionRange, f as Transform, L as LINK_VALIDATION_SCHEMA, v as validateAndFormatUrl, g as getEditorStyles, h as clipboardTextParser, s as setInitialPosition, D as DEFAULT_EDITOR_OPTIONS } from './chunk-e876ad10.js';
15
+ import { P as Plugin, b as PluginKey, T as TextSelection, d as dropPoint, S as Selection, N as NodeSelection, F as Fragment, c as Slice, M as Mapping, l as liftTarget, e as SelectionRange, f as Transform, L as LINK_VALIDATION_SCHEMA, v as validateAndFormatUrl, g as getEditorStyles, h as clipboardTextParser, s as setInitialPosition, D as DEFAULT_EDITOR_OPTIONS } from './chunk-d17f73d0.js';
16
16
  import { Down, MenuHorizontal, Close, Paragraph as Paragraph$1, TextH1, TextH2, Text as Text$2, ListNumber, ListDot, ImageUpload, Video, Blockquote as Blockquote$1, CodeBlock as CodeBlock$2, Smiley, Minus, MediaVideo, Notes, Column, InsertRow, InsertColumn, DeleteRow, DeleteColumn, MergeSplit, ToggleHeaderRow, DeleteTable } from '@bigbinary/neeto-icons';
17
17
  import CopyToClipboardButton from '@bigbinary/neeto-molecules/CopyToClipboardButton';
18
18
  import { useTranslation } from 'react-i18next';
@@ -99,7 +99,6 @@ var CharacterCountWrapper = function CharacterCountWrapper(_ref) {
99
99
  "data-cy": "neeto-editor-character-count"
100
100
  }, editor.storage.characterCount.characters(), " characters"));
101
101
  };
102
- var CharacterCountWrapper$1 = /*#__PURE__*/memo(CharacterCountWrapper);
103
102
 
104
103
  /**
105
104
  * This extension allows you to count the characters and words of your document.
@@ -7864,16 +7863,51 @@ var KeyboardShortcuts = function KeyboardShortcuts(_ref) {
7864
7863
  return true;
7865
7864
  }
7866
7865
  return false;
7866
+ },
7867
+ // To fix the issue with backspace on the empty list item moving the focus to the block on top.
7868
+ // https://github.com/ueberdosis/tiptap/issues/2829#issuecomment-1511064298
7869
+ Backspace: function Backspace() {
7870
+ return _this.editor.commands.command(function (_ref2) {
7871
+ var tr = _ref2.tr;
7872
+ var selection = tr.selection,
7873
+ doc = tr.doc;
7874
+ var $cursor = selection.$cursor;
7875
+ var depth = $cursor === null || $cursor === void 0 ? void 0 : $cursor.depth;
7876
+ if ($cursor && depth >= 3 &&
7877
+ // At least the structure is doc -> orderedList/bulletList -> listItem -> paragraph
7878
+ $cursor.parent.type.name === "paragraph" &&
7879
+ // The cursor is inside a paragraph.
7880
+ $cursor.parentOffset === 0 &&
7881
+ // The cursor is at the beginning of the paragraph.
7882
+ $cursor.node(depth - 1).type.name === "listItem" &&
7883
+ // The paragraph is inside a listItem.
7884
+ $cursor.index(depth - 1) === 0 &&
7885
+ // The paragraph is at the beginning of the listItem.
7886
+ $cursor.index(depth - 2) === 0 // The listItem is at the beginning of the list.
7887
+ ) {
7888
+ var listItemNode = $cursor.node(depth - 1);
7889
+ var listItemPos = $cursor.before(depth - 1);
7890
+ var $contentBegin = doc.resolve(listItemPos + 1);
7891
+ var $contentEnd = doc.resolve(listItemPos + listItemNode.nodeSize - 1);
7892
+ var range = $contentBegin.blockRange($contentEnd);
7893
+ var target = liftTarget(range);
7894
+ if (target !== null) {
7895
+ tr.lift(range, target);
7896
+ return true;
7897
+ }
7898
+ }
7899
+ return false;
7900
+ });
7867
7901
  }
7868
7902
  }, shortcuts);
7869
7903
  }
7870
7904
  });
7871
7905
  };
7872
7906
  var KeyboardShortcuts$1 = {
7873
- configure: function configure(_ref2) {
7874
- var onSubmit = _ref2.onSubmit,
7875
- shortcuts = _ref2.shortcuts,
7876
- isBlockQuoteActive = _ref2.isBlockQuoteActive;
7907
+ configure: function configure(_ref3) {
7908
+ var onSubmit = _ref3.onSubmit,
7909
+ shortcuts = _ref3.shortcuts,
7910
+ isBlockQuoteActive = _ref3.isBlockQuoteActive;
7877
7911
  return KeyboardShortcuts({
7878
7912
  onSubmit: onSubmit,
7879
7913
  shortcuts: shortcuts,
@@ -14840,7 +14874,7 @@ var Editor = function Editor(_ref, ref) {
14840
14874
  }), /*#__PURE__*/React__default.createElement(TableActionMenu, {
14841
14875
  editor: editor,
14842
14876
  appendTo: wrapperRef
14843
- }), /*#__PURE__*/React__default.createElement(CharacterCountWrapper$1, {
14877
+ }), /*#__PURE__*/React__default.createElement(CharacterCountWrapper, {
14844
14878
  editor: editor,
14845
14879
  isActive: isCharacterCountActive
14846
14880
  }))));