@bigbinary/neeto-editor 1.45.27 → 1.45.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.
- package/dist/Editor.js +268 -41
- package/dist/Editor.js.map +1 -1
- package/dist/FormikEditor.js +1 -1
- package/dist/Menu.js +1 -1
- package/dist/{chunk-B_ypvaUL.js → chunk-C0xZGEez.js} +53 -2
- package/dist/{chunk-B_ypvaUL.js.map → chunk-C0xZGEez.js.map} +1 -1
- package/dist/cjs/Editor.cjs.js +268 -41
- package/dist/cjs/Editor.cjs.js.map +1 -1
- package/dist/cjs/FormikEditor.cjs.js +1 -1
- package/dist/cjs/Menu.cjs.js +1 -1
- package/dist/cjs/{chunk-DZ7EK7nf.cjs.js → chunk-C-KwpuWA.cjs.js} +57 -2
- package/dist/cjs/{chunk-DZ7EK7nf.cjs.js.map → chunk-C-KwpuWA.cjs.js.map} +1 -1
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/editor-stats.html +19 -1
- package/dist/index.js +1 -1
- package/package.json +2 -1
|
@@ -10,7 +10,7 @@ var Editor = require('./Editor.cjs.js');
|
|
|
10
10
|
var jsxRuntime = require('react/jsx-runtime');
|
|
11
11
|
require('@babel/runtime/helpers/toConsumableArray');
|
|
12
12
|
require('@babel/runtime/helpers/slicedToArray');
|
|
13
|
-
require('./chunk-
|
|
13
|
+
require('./chunk-C-KwpuWA.cjs.js');
|
|
14
14
|
require('./chunk-vQvjPR2x.cjs.js');
|
|
15
15
|
require('i18next');
|
|
16
16
|
require('./chunk-Cf2e86Di.cjs.js');
|
package/dist/cjs/Menu.cjs.js
CHANGED
|
@@ -5,7 +5,7 @@ require('@babel/runtime/helpers/toConsumableArray');
|
|
|
5
5
|
require('@babel/runtime/helpers/slicedToArray');
|
|
6
6
|
require('react');
|
|
7
7
|
require('ramda');
|
|
8
|
-
var Menu = require('./chunk-
|
|
8
|
+
var Menu = require('./chunk-C-KwpuWA.cjs.js');
|
|
9
9
|
require('./chunk-D_e3pQI3.cjs.js');
|
|
10
10
|
require('react/jsx-runtime');
|
|
11
11
|
require('./chunk-vQvjPR2x.cjs.js');
|
|
@@ -12272,6 +12272,30 @@ function getMarksBetween(from, to, doc) {
|
|
|
12272
12272
|
return marks;
|
|
12273
12273
|
}
|
|
12274
12274
|
|
|
12275
|
+
/**
|
|
12276
|
+
* Finds the first node of a given type or name in the current selection.
|
|
12277
|
+
* @param state The editor state.
|
|
12278
|
+
* @param typeOrName The node type or name.
|
|
12279
|
+
* @param pos The position to start searching from.
|
|
12280
|
+
* @param maxDepth The maximum depth to search.
|
|
12281
|
+
* @returns The node and the depth as an array.
|
|
12282
|
+
*/
|
|
12283
|
+
const getNodeAtPosition = (state, typeOrName, pos, maxDepth = 20) => {
|
|
12284
|
+
const $pos = state.doc.resolve(pos);
|
|
12285
|
+
let currentDepth = maxDepth;
|
|
12286
|
+
let node = null;
|
|
12287
|
+
while (currentDepth > 0 && node === null) {
|
|
12288
|
+
const currentNode = $pos.node(currentDepth);
|
|
12289
|
+
if ((currentNode === null || currentNode === void 0 ? void 0 : currentNode.type.name) === typeOrName) {
|
|
12290
|
+
node = currentNode;
|
|
12291
|
+
}
|
|
12292
|
+
else {
|
|
12293
|
+
currentDepth -= 1;
|
|
12294
|
+
}
|
|
12295
|
+
}
|
|
12296
|
+
return [node, currentDepth];
|
|
12297
|
+
};
|
|
12298
|
+
|
|
12275
12299
|
/**
|
|
12276
12300
|
* Return attributes of an extension that should be splitted by keepOnSplit flag
|
|
12277
12301
|
* @param extensionAttributes Array of extension attributes
|
|
@@ -12369,6 +12393,33 @@ function isActive(state, name, attributes = {}) {
|
|
|
12369
12393
|
return false;
|
|
12370
12394
|
}
|
|
12371
12395
|
|
|
12396
|
+
const isAtEndOfNode = (state, nodeType) => {
|
|
12397
|
+
const { $from, $to, $anchor } = state.selection;
|
|
12398
|
+
if (nodeType) {
|
|
12399
|
+
const parentNode = findParentNode(node => node.type.name === nodeType)(state.selection);
|
|
12400
|
+
if (!parentNode) {
|
|
12401
|
+
return false;
|
|
12402
|
+
}
|
|
12403
|
+
const $parentPos = state.doc.resolve(parentNode.pos + 1);
|
|
12404
|
+
if ($anchor.pos + 1 === $parentPos.end()) {
|
|
12405
|
+
return true;
|
|
12406
|
+
}
|
|
12407
|
+
return false;
|
|
12408
|
+
}
|
|
12409
|
+
if ($to.parentOffset < $to.parent.nodeSize - 2 || $from.pos !== $to.pos) {
|
|
12410
|
+
return false;
|
|
12411
|
+
}
|
|
12412
|
+
return true;
|
|
12413
|
+
};
|
|
12414
|
+
|
|
12415
|
+
const isAtStartOfNode = (state) => {
|
|
12416
|
+
const { $from, $to } = state.selection;
|
|
12417
|
+
if ($from.parentOffset > 0 || $from.pos !== $to.pos) {
|
|
12418
|
+
return false;
|
|
12419
|
+
}
|
|
12420
|
+
return true;
|
|
12421
|
+
};
|
|
12422
|
+
|
|
12372
12423
|
function isList(name, extensions) {
|
|
12373
12424
|
const { nodeExtensions } = splitExtensions(extensions);
|
|
12374
12425
|
const extension = nodeExtensions.find(item => item.name === name);
|
|
@@ -19440,10 +19491,14 @@ exports.getMarkAttributes = getMarkAttributes;
|
|
|
19440
19491
|
exports.getMarkRange = getMarkRange;
|
|
19441
19492
|
exports.getMarkType = getMarkType;
|
|
19442
19493
|
exports.getMarksBetween = getMarksBetween;
|
|
19494
|
+
exports.getNodeAtPosition = getNodeAtPosition;
|
|
19495
|
+
exports.getNodeType = getNodeType$1;
|
|
19443
19496
|
exports.highlightFocussedNode = highlightFocussedNode;
|
|
19497
|
+
exports.isAtEndOfNode = isAtEndOfNode;
|
|
19498
|
+
exports.isAtStartOfNode = isAtStartOfNode;
|
|
19499
|
+
exports.isNodeActive = isNodeActive;
|
|
19444
19500
|
exports.isNodeSelection = isNodeSelection;
|
|
19445
19501
|
exports.keydownHandler = keydownHandler;
|
|
19446
|
-
exports.liftTarget = liftTarget$1;
|
|
19447
19502
|
exports.markInputRule = markInputRule;
|
|
19448
19503
|
exports.markPasteRule = markPasteRule;
|
|
19449
19504
|
exports.mergeAttributes = mergeAttributes;
|
|
@@ -19454,4 +19509,4 @@ exports.useEditor = useEditor;
|
|
|
19454
19509
|
exports.useEditorState = useEditorState$1;
|
|
19455
19510
|
exports.validateUrl = validateUrl;
|
|
19456
19511
|
exports.wrappingInputRule = wrappingInputRule;
|
|
19457
|
-
//# sourceMappingURL=chunk-
|
|
19512
|
+
//# sourceMappingURL=chunk-C-KwpuWA.cjs.js.map
|