@bigbinary/neeto-editor 1.47.49 → 1.47.51
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 +96 -9
- package/dist/Editor.js.map +1 -1
- package/dist/EditorContent.js +2 -2
- package/dist/FormikEditor.js +2 -2
- package/dist/Menu.js +1 -1
- package/dist/{chunk-C-0Q1FN5.js → chunk-BuwZ56CV.js} +2 -2
- package/dist/{chunk-C-0Q1FN5.js.map → chunk-BuwZ56CV.js.map} +1 -1
- package/dist/{chunk-BCoBS5ED.js → chunk-CeRlskgG.js} +13 -2
- package/dist/{chunk-BCoBS5ED.js.map → chunk-CeRlskgG.js.map} +1 -1
- package/dist/{chunk-CBY2h1zh.js → chunk-jiJmCFSR.js} +2 -2
- package/dist/{chunk-CBY2h1zh.js.map → chunk-jiJmCFSR.js.map} +1 -1
- package/dist/cjs/Editor.cjs.js +95 -8
- package/dist/cjs/Editor.cjs.js.map +1 -1
- package/dist/cjs/EditorContent.cjs.js +2 -2
- package/dist/cjs/FormikEditor.cjs.js +2 -2
- package/dist/cjs/Menu.cjs.js +1 -1
- package/dist/cjs/{chunk-C8WnTgx_.cjs.js → chunk-D-D5oWUE.cjs.js} +2 -2
- package/dist/cjs/{chunk-C8WnTgx_.cjs.js.map → chunk-D-D5oWUE.cjs.js.map} +1 -1
- package/dist/cjs/{chunk-Bi1rI-2R.cjs.js → chunk-OZAH-T0Z.cjs.js} +14 -1
- package/dist/cjs/{chunk-Bi1rI-2R.cjs.js.map → chunk-OZAH-T0Z.cjs.js.map} +1 -1
- package/dist/cjs/{chunk-D4o7xzO7.cjs.js → chunk-fDeB4TwF.cjs.js} +2 -2
- package/dist/cjs/{chunk-D4o7xzO7.cjs.js.map → chunk-fDeB4TwF.cjs.js.map} +1 -1
- package/dist/cjs/index.cjs.js +4 -4
- package/dist/cjs/utils.cjs.js +2 -2
- package/dist/editor-stats.html +1 -1
- package/dist/index.js +4 -4
- package/dist/utils.js +2 -2
- package/package.json +1 -1
package/dist/Editor.js
CHANGED
|
@@ -4,18 +4,18 @@ 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, 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 EditorContent, W as MediaUploader, X as LinkAddPopOver, Y as EditorView } from './chunk-
|
|
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 EditorContent, W as MediaUploader, X as LinkAddPopOver, Y as EditorView } from './chunk-BuwZ56CV.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-7IwD_Poi.js';
|
|
10
10
|
import { isNotPresent, findBy, isNotEmpty, isPresent, noop as noop$1, slugify } from '@bigbinary/neeto-cist';
|
|
11
11
|
import { useOnClickOutside, useFuncDebounce } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
12
12
|
import Label from '@bigbinary/neetoui/Label';
|
|
13
|
-
import { is, intersection, difference, union, isEmpty as isEmpty$1, isNil, mergeRight, assoc, equals } from 'ramda';
|
|
13
|
+
import { is, intersection, difference, union, isEmpty as isEmpty$1, isNil, mergeRight, prop, pluck, assoc, equals } from 'ramda';
|
|
14
14
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
15
15
|
import { n } from './chunk-DmrvuTKK.js';
|
|
16
16
|
import { P as Plugin, o as PluginKey, b as Slice, F as Fragment$1, T as TextSelection, S as Selection, d as dropPoint, N as NodeSelection, q as Mapping$1, M as Mark$1, e as MarkType, R as ReplaceError, s as SelectionRange, u as buildLevelsFromOptions, v as validateAndFormatUrl, w as getEditorStyles, x as clipboardTextParser, y as transformPastedHTML, z as setInitialPosition } from './chunk-TvTt0Gg2.js';
|
|
17
17
|
import ReactDOM from 'react-dom/server';
|
|
18
|
-
import { l as lowlight, M as MARGIN_HEIGHT, r as removeEmptyTags } from './chunk-
|
|
18
|
+
import { l as lowlight, M as MARGIN_HEIGHT, F as FUZZY_SEARCH_DEFAULT_LIMIT, D as DEFAULT_SEARCH_KEYS, r as removeEmptyTags } from './chunk-CeRlskgG.js';
|
|
19
19
|
import { L as LINK_VALIDATION_SCHEMA, D as DEFAULT_EDITOR_OPTIONS } from './chunk-BZmNiqsu.js';
|
|
20
20
|
import * as Y from 'yjs';
|
|
21
21
|
import { UndoManager, Item as Item$1, ContentType, Text as Text$2, XmlElement } from 'yjs';
|
|
@@ -14086,6 +14086,91 @@ var SelectionDecoration = Document.extend({
|
|
|
14086
14086
|
}
|
|
14087
14087
|
});
|
|
14088
14088
|
|
|
14089
|
+
var calculateScore = function calculateScore(input, target) {
|
|
14090
|
+
var inputLower = input.toLowerCase();
|
|
14091
|
+
var targetLower = target.toLowerCase();
|
|
14092
|
+
var substringIndex = targetLower.indexOf(inputLower);
|
|
14093
|
+
if (substringIndex !== -1) {
|
|
14094
|
+
return 1.0 - substringIndex / targetLower.length * 0.1;
|
|
14095
|
+
}
|
|
14096
|
+
var inputIndex = 0;
|
|
14097
|
+
var targetIndex = 0;
|
|
14098
|
+
var firstMatchIndex = -1;
|
|
14099
|
+
var consecutiveMatches = 0;
|
|
14100
|
+
var maxConsecutive = 0;
|
|
14101
|
+
while (inputIndex < inputLower.length && targetIndex < targetLower.length) {
|
|
14102
|
+
if (inputLower[inputIndex] === targetLower[targetIndex]) {
|
|
14103
|
+
if (firstMatchIndex === -1) {
|
|
14104
|
+
firstMatchIndex = targetIndex;
|
|
14105
|
+
}
|
|
14106
|
+
consecutiveMatches++;
|
|
14107
|
+
inputIndex++;
|
|
14108
|
+
} else {
|
|
14109
|
+
maxConsecutive = Math.max(maxConsecutive, consecutiveMatches);
|
|
14110
|
+
consecutiveMatches = 0;
|
|
14111
|
+
}
|
|
14112
|
+
targetIndex++;
|
|
14113
|
+
}
|
|
14114
|
+
maxConsecutive = Math.max(maxConsecutive, consecutiveMatches);
|
|
14115
|
+
if (inputIndex < inputLower.length) {
|
|
14116
|
+
return 0;
|
|
14117
|
+
}
|
|
14118
|
+
var positionScore = 1.0 - firstMatchIndex / targetLower.length;
|
|
14119
|
+
var consecutiveBonus = maxConsecutive / inputLower.length;
|
|
14120
|
+
var lengthRatio = inputLower.length / targetLower.length;
|
|
14121
|
+
var score = positionScore * 0.6 + consecutiveBonus * 0.2 + lengthRatio * 0.2;
|
|
14122
|
+
return Math.min(score, 0.89);
|
|
14123
|
+
};
|
|
14124
|
+
var fuzzySearch = function fuzzySearch(items, query) {
|
|
14125
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
14126
|
+
limit: FUZZY_SEARCH_DEFAULT_LIMIT
|
|
14127
|
+
};
|
|
14128
|
+
var _options$limit = options.limit,
|
|
14129
|
+
limit = _options$limit === void 0 ? FUZZY_SEARCH_DEFAULT_LIMIT : _options$limit,
|
|
14130
|
+
_options$keys = options.keys,
|
|
14131
|
+
keys = _options$keys === void 0 ? DEFAULT_SEARCH_KEYS : _options$keys;
|
|
14132
|
+
if (!query || typeof query !== "string" || !items || isEmpty$1(items)) {
|
|
14133
|
+
return items ? items.slice(0, limit) : [];
|
|
14134
|
+
}
|
|
14135
|
+
var trimmedQuery = query.trim();
|
|
14136
|
+
if (!trimmedQuery) {
|
|
14137
|
+
return items ? items.slice(0, limit) : [];
|
|
14138
|
+
}
|
|
14139
|
+
var fieldAccessors = keys.map(function (key) {
|
|
14140
|
+
return {
|
|
14141
|
+
getValue: typeof key === "string" ? prop(key) : prop(key.name),
|
|
14142
|
+
weight: typeof key === "string" ? 1 : key.weight || 1
|
|
14143
|
+
};
|
|
14144
|
+
});
|
|
14145
|
+
var results = items.reduce(function (acc, item) {
|
|
14146
|
+
var bestScore = fieldAccessors.reduce(function (maxScore, accessor) {
|
|
14147
|
+
var fieldValue = accessor.getValue(item);
|
|
14148
|
+
if (isNil(fieldValue)) return maxScore;
|
|
14149
|
+
var fieldString = String(fieldValue);
|
|
14150
|
+
var score = calculateScore(trimmedQuery, fieldString);
|
|
14151
|
+
if (score <= 0) return maxScore;
|
|
14152
|
+
var weightedScore = score * accessor.weight;
|
|
14153
|
+
return weightedScore > maxScore ? weightedScore : maxScore;
|
|
14154
|
+
}, 0);
|
|
14155
|
+
if (bestScore > 0) {
|
|
14156
|
+
acc.push({
|
|
14157
|
+
item: item,
|
|
14158
|
+
score: bestScore
|
|
14159
|
+
});
|
|
14160
|
+
}
|
|
14161
|
+
return acc;
|
|
14162
|
+
}, []);
|
|
14163
|
+
results.sort(function (a, b) {
|
|
14164
|
+
if (Math.abs(a.score - b.score) < 0.001) {
|
|
14165
|
+
var aTitle = a.item.title || a.item.name || "";
|
|
14166
|
+
var bTitle = b.item.title || b.item.name || "";
|
|
14167
|
+
return aTitle.localeCompare(bTitle);
|
|
14168
|
+
}
|
|
14169
|
+
return b.score - a.score;
|
|
14170
|
+
});
|
|
14171
|
+
return pluck("item", results.slice(0, limit));
|
|
14172
|
+
};
|
|
14173
|
+
|
|
14089
14174
|
function ownKeys$a(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
14090
14175
|
function _objectSpread$a(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$a(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$a(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14091
14176
|
function _callSuper$1(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$1() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
@@ -14717,10 +14802,10 @@ var SlashCommands = {
|
|
|
14717
14802
|
},
|
|
14718
14803
|
items: function items(_ref3) {
|
|
14719
14804
|
var query = _ref3.query;
|
|
14720
|
-
|
|
14721
|
-
|
|
14722
|
-
|
|
14723
|
-
|
|
14805
|
+
if (!query) {
|
|
14806
|
+
return commandItems.slice(0, 10);
|
|
14807
|
+
}
|
|
14808
|
+
var filteredItems = fuzzySearch(commandItems, query);
|
|
14724
14809
|
return isEmpty$1(filteredItems) ? [NO_RESULT_MENU_ITEM] : filteredItems;
|
|
14725
14810
|
},
|
|
14726
14811
|
render: function render() {
|
|
@@ -20619,11 +20704,12 @@ var TableActionMenu = function TableActionMenu(_ref) {
|
|
|
20619
20704
|
appendTo: function appendTo() {
|
|
20620
20705
|
return document.body;
|
|
20621
20706
|
},
|
|
20707
|
+
className: "neeto-editor-table-bubble-menu__dropdown",
|
|
20622
20708
|
closeOnSelect: false,
|
|
20623
20709
|
position: "bottom-start",
|
|
20624
20710
|
strategy: "fixed",
|
|
20625
20711
|
buttonProps: {
|
|
20626
|
-
className: "neeto-editor-table-bubble-
|
|
20712
|
+
className: "neeto-editor-table-bubble-menu__dropdown-item",
|
|
20627
20713
|
icon: Down,
|
|
20628
20714
|
iconPosition: "right",
|
|
20629
20715
|
iconSize: 16,
|
|
@@ -20637,7 +20723,7 @@ var TableActionMenu = function TableActionMenu(_ref) {
|
|
|
20637
20723
|
}
|
|
20638
20724
|
},
|
|
20639
20725
|
children: /*#__PURE__*/jsx(Menu, {
|
|
20640
|
-
className: "neeto-ui-
|
|
20726
|
+
className: "neeto-ui-flex neeto-ui-items-center neeto-ui-justify-center",
|
|
20641
20727
|
children: (_action$items = action.items) === null || _action$items === void 0 ? void 0 : _action$items.map(function (_ref3) {
|
|
20642
20728
|
var type = _ref3.type,
|
|
20643
20729
|
command = _ref3.command,
|
|
@@ -20645,6 +20731,7 @@ var TableActionMenu = function TableActionMenu(_ref) {
|
|
|
20645
20731
|
var IconComponent = alignmentIcons[type];
|
|
20646
20732
|
return /*#__PURE__*/jsx(MenuItem, {
|
|
20647
20733
|
children: /*#__PURE__*/jsx(Button, {
|
|
20734
|
+
className: "neeto-editor-table-bubble-menu__item",
|
|
20648
20735
|
icon: IconComponent,
|
|
20649
20736
|
style: "text",
|
|
20650
20737
|
tooltipProps: {
|