@bigbinary/neeto-editor 1.47.72 → 1.47.75

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, useState, useEffect, useRef, useCallback, createElement, forwardRef, useImperativeHandle } from 'react';
7
- import { E as Extension, a as Mark, m as mergeAttributes, b as markInputRule, c as markPasteRule, D as DecorationSet, d as Decoration, g as getMarkAttributes, N as Node, w as wrappingInputRule, t as textblockTypeInputRule, k as keydownHandler, e as callOrReturn, f as getExtensionField, i as isNodeSelection, n as nodeInputRule, h as getNodeType, j as getNodeAtPosition, l as isNodeActive, o as isAtStartOfNode, p as isAtEndOfNode, C as CALLOUT_TYPES, q as NodeViewWrapper, r as NodeViewContent, R as ReactNodeViewRenderer, s as findChildren, u as escapeForRegEx, v as ReactRenderer, x as EmojiPickerMenu, y as emojiPickerApi, z as combineTransactionSteps, A as getChangedRanges, B as findChildrenInRange, F as getMarksBetween, G as getAttributes, I as InputRule, H as highlightFocussedNode, J as resetFocussedNode, K as findParentNodeClosestToPos, P as PasteRule, L as BubbleMenu, O as getLinkPopoverPosition, Q as getMarkType, S as getMarkRange, T as useEditor, U as useEditorState, M as Menu$4, V as MenuDynamicVariables, W as EditorContent, X as MediaUploader, Y as LinkAddPopOver, Z as EditorView } from './chunk-BNBYmEN2.js';
7
+ import { E as Extension, a as Mark, m as mergeAttributes, b as markInputRule, c as markPasteRule, D as DecorationSet, d as Decoration, g as getMarkAttributes, N as Node, w as wrappingInputRule, t as textblockTypeInputRule, k as keydownHandler, e as callOrReturn, f as getExtensionField, i as isNodeSelection, n as nodeInputRule, h as getNodeType, j as getNodeAtPosition, l as isNodeActive, o as isAtStartOfNode, p as isAtEndOfNode, C as CALLOUT_TYPES, q as NodeViewWrapper, r as NodeViewContent, R as ReactNodeViewRenderer, s as findChildren, u as escapeForRegEx, v as ReactRenderer, x as EmojiPickerMenu, y as emojiPickerApi, z as combineTransactionSteps, A as getChangedRanges, B as findChildrenInRange, F as getMarksBetween, G as getAttributes, I as InputRule, H as highlightFocussedNode, J as resetFocussedNode, K as findParentNodeClosestToPos, P as PasteRule, L as BubbleMenu, O as getLinkPopoverPosition, Q as getMarkType, S as getMarkRange, T as useEditor, U as useEditorState, M as Menu$4, V as MenuDynamicVariables, W as EditorContent, X as MediaUploader, Y as LinkAddPopOver, Z as EditorView } from './chunk-FDPx0wrE.js';
8
8
  import classnames from 'classnames';
9
9
  import { D as DIRECT_UPLOAD_ENDPOINT, E as EDITOR_OPTIONS, C as COMBINED_REGEX, a as EDITOR_SIZES } from './chunk-DDwycKmK.js';
10
10
  import { isNotPresent, findBy, isNotEmpty, isPresent, noop as noop$1, slugify } from '@bigbinary/neeto-cist';
@@ -11303,7 +11303,7 @@ var ImageComponent = function ImageComponent(_ref) {
11303
11303
  }), src ? /*#__PURE__*/jsx(Resizable, {
11304
11304
  lockAspectRatio: true,
11305
11305
  className: "neeto-editor__image",
11306
- minWidth: "100px",
11306
+ minWidth: "50px",
11307
11307
  size: {
11308
11308
  height: height,
11309
11309
  width: width
@@ -11373,6 +11373,16 @@ var upload = /*#__PURE__*/function () {
11373
11373
  return _ref.apply(this, arguments);
11374
11374
  };
11375
11375
  }();
11376
+ var findNextTextPos = function findNextTextPos(editor, pos) {
11377
+ var doc = editor.state.doc;
11378
+ var foundPos = -1;
11379
+ doc.nodesBetween(pos, doc.content.size, function (node, nodePos) {
11380
+ if (foundPos >= pos) return false;else if (!node.type.isTextblock) return true;
11381
+ foundPos = nodePos;
11382
+ return false;
11383
+ });
11384
+ return foundPos;
11385
+ };
11376
11386
  var ImageExtension = Node.create({
11377
11387
  name: "image",
11378
11388
  addOptions: function addOptions() {
@@ -11504,16 +11514,20 @@ var ImageExtension = Node.create({
11504
11514
  return {
11505
11515
  Enter: function Enter() {
11506
11516
  var head = _this2.editor.state.selection.$head;
11507
- if (head.node().type.name === "image") {
11508
- _this2.editor.chain().insertContentAt(head.after(), {
11517
+ if (head.node().type.name !== "image") return false;
11518
+ var chain = _this2.editor.chain();
11519
+ var tail = head.after();
11520
+ var nextTextPos = findNextTextPos(_this2.editor, tail);
11521
+ if (nextTextPos < 0) {
11522
+ chain.insertContentAt(tail, {
11509
11523
  type: "paragraph",
11510
11524
  content: ""
11511
- }).focus().run();
11512
- return true;
11525
+ });
11526
+ nextTextPos = tail;
11513
11527
  }
11514
-
11515
- // Fallback to TipTap's default behavior
11516
- return false;
11528
+ chain.setTextSelection(nextTextPos + 1) // Node boundary + 1
11529
+ .focus().run();
11530
+ return true;
11517
11531
  }
11518
11532
  };
11519
11533
  },
@@ -15142,9 +15156,7 @@ var SlashCommands = {
15142
15156
  },
15143
15157
  items: function items(_ref3) {
15144
15158
  var query = _ref3.query;
15145
- if (!query) {
15146
- return commandItems.slice(0, 10);
15147
- }
15159
+ if (!query) return commandItems;
15148
15160
  var filteredItems = fuzzySearch(commandItems, query);
15149
15161
  return isEmpty$1(filteredItems) ? [NO_RESULT_MENU_ITEM] : filteredItems;
15150
15162
  },