@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.
@@ -5,7 +5,7 @@ var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
5
5
  var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
6
6
  var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
7
7
  var React = require('react');
8
- var Menu$4 = require('./chunk-BMbsEMhq.cjs.js');
8
+ var Menu$4 = require('./chunk-ZuuEdW21.cjs.js');
9
9
  var classnames = require('classnames');
10
10
  var constants = require('./chunk-2HrSPdAV.cjs.js');
11
11
  var neetoCist = require('@bigbinary/neeto-cist');
@@ -11323,7 +11323,7 @@ var ImageComponent = function ImageComponent(_ref) {
11323
11323
  }), src ? /*#__PURE__*/jsxRuntime.jsx(Resizable, {
11324
11324
  lockAspectRatio: true,
11325
11325
  className: "neeto-editor__image",
11326
- minWidth: "100px",
11326
+ minWidth: "50px",
11327
11327
  size: {
11328
11328
  height: height,
11329
11329
  width: width
@@ -11393,6 +11393,16 @@ var upload = /*#__PURE__*/function () {
11393
11393
  return _ref.apply(this, arguments);
11394
11394
  };
11395
11395
  }();
11396
+ var findNextTextPos = function findNextTextPos(editor, pos) {
11397
+ var doc = editor.state.doc;
11398
+ var foundPos = -1;
11399
+ doc.nodesBetween(pos, doc.content.size, function (node, nodePos) {
11400
+ if (foundPos >= pos) return false;else if (!node.type.isTextblock) return true;
11401
+ foundPos = nodePos;
11402
+ return false;
11403
+ });
11404
+ return foundPos;
11405
+ };
11396
11406
  var ImageExtension = Menu$4.Node.create({
11397
11407
  name: "image",
11398
11408
  addOptions: function addOptions() {
@@ -11524,16 +11534,20 @@ var ImageExtension = Menu$4.Node.create({
11524
11534
  return {
11525
11535
  Enter: function Enter() {
11526
11536
  var head = _this2.editor.state.selection.$head;
11527
- if (head.node().type.name === "image") {
11528
- _this2.editor.chain().insertContentAt(head.after(), {
11537
+ if (head.node().type.name !== "image") return false;
11538
+ var chain = _this2.editor.chain();
11539
+ var tail = head.after();
11540
+ var nextTextPos = findNextTextPos(_this2.editor, tail);
11541
+ if (nextTextPos < 0) {
11542
+ chain.insertContentAt(tail, {
11529
11543
  type: "paragraph",
11530
11544
  content: ""
11531
- }).focus().run();
11532
- return true;
11545
+ });
11546
+ nextTextPos = tail;
11533
11547
  }
11534
-
11535
- // Fallback to TipTap's default behavior
11536
- return false;
11548
+ chain.setTextSelection(nextTextPos + 1) // Node boundary + 1
11549
+ .focus().run();
11550
+ return true;
11537
11551
  }
11538
11552
  };
11539
11553
  },
@@ -15162,9 +15176,7 @@ var SlashCommands = {
15162
15176
  },
15163
15177
  items: function items(_ref3) {
15164
15178
  var query = _ref3.query;
15165
- if (!query) {
15166
- return commandItems.slice(0, 10);
15167
- }
15179
+ if (!query) return commandItems;
15168
15180
  var filteredItems = fuzzySearch(commandItems, query);
15169
15181
  return ramda.isEmpty(filteredItems) ? [NO_RESULT_MENU_ITEM] : filteredItems;
15170
15182
  },