@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/cjs/Editor.cjs.js
CHANGED
|
@@ -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-
|
|
8
|
+
var Menu$4 = require('./chunk-D-D5oWUE.cjs.js');
|
|
9
9
|
var classnames = require('classnames');
|
|
10
10
|
var constants = require('./chunk-D1TqtxZX.cjs.js');
|
|
11
11
|
var neetoCist = require('@bigbinary/neeto-cist');
|
|
@@ -16,7 +16,7 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
16
16
|
var injectCss = require('./chunk-vQvjPR2x.cjs.js');
|
|
17
17
|
var utils = require('./chunk-OJSm0BS5.cjs.js');
|
|
18
18
|
var ReactDOM = require('react-dom/server');
|
|
19
|
-
var common = require('./chunk-
|
|
19
|
+
var common = require('./chunk-OZAH-T0Z.cjs.js');
|
|
20
20
|
var constants$1 = require('./chunk-0DRyiTvN.cjs.js');
|
|
21
21
|
var Y = require('yjs');
|
|
22
22
|
var Megaphone = require('@bigbinary/neeto-icons/misc/Megaphone');
|
|
@@ -14106,6 +14106,91 @@ var SelectionDecoration = Document.extend({
|
|
|
14106
14106
|
}
|
|
14107
14107
|
});
|
|
14108
14108
|
|
|
14109
|
+
var calculateScore = function calculateScore(input, target) {
|
|
14110
|
+
var inputLower = input.toLowerCase();
|
|
14111
|
+
var targetLower = target.toLowerCase();
|
|
14112
|
+
var substringIndex = targetLower.indexOf(inputLower);
|
|
14113
|
+
if (substringIndex !== -1) {
|
|
14114
|
+
return 1.0 - substringIndex / targetLower.length * 0.1;
|
|
14115
|
+
}
|
|
14116
|
+
var inputIndex = 0;
|
|
14117
|
+
var targetIndex = 0;
|
|
14118
|
+
var firstMatchIndex = -1;
|
|
14119
|
+
var consecutiveMatches = 0;
|
|
14120
|
+
var maxConsecutive = 0;
|
|
14121
|
+
while (inputIndex < inputLower.length && targetIndex < targetLower.length) {
|
|
14122
|
+
if (inputLower[inputIndex] === targetLower[targetIndex]) {
|
|
14123
|
+
if (firstMatchIndex === -1) {
|
|
14124
|
+
firstMatchIndex = targetIndex;
|
|
14125
|
+
}
|
|
14126
|
+
consecutiveMatches++;
|
|
14127
|
+
inputIndex++;
|
|
14128
|
+
} else {
|
|
14129
|
+
maxConsecutive = Math.max(maxConsecutive, consecutiveMatches);
|
|
14130
|
+
consecutiveMatches = 0;
|
|
14131
|
+
}
|
|
14132
|
+
targetIndex++;
|
|
14133
|
+
}
|
|
14134
|
+
maxConsecutive = Math.max(maxConsecutive, consecutiveMatches);
|
|
14135
|
+
if (inputIndex < inputLower.length) {
|
|
14136
|
+
return 0;
|
|
14137
|
+
}
|
|
14138
|
+
var positionScore = 1.0 - firstMatchIndex / targetLower.length;
|
|
14139
|
+
var consecutiveBonus = maxConsecutive / inputLower.length;
|
|
14140
|
+
var lengthRatio = inputLower.length / targetLower.length;
|
|
14141
|
+
var score = positionScore * 0.6 + consecutiveBonus * 0.2 + lengthRatio * 0.2;
|
|
14142
|
+
return Math.min(score, 0.89);
|
|
14143
|
+
};
|
|
14144
|
+
var fuzzySearch = function fuzzySearch(items, query) {
|
|
14145
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
14146
|
+
limit: common.FUZZY_SEARCH_DEFAULT_LIMIT
|
|
14147
|
+
};
|
|
14148
|
+
var _options$limit = options.limit,
|
|
14149
|
+
limit = _options$limit === void 0 ? common.FUZZY_SEARCH_DEFAULT_LIMIT : _options$limit,
|
|
14150
|
+
_options$keys = options.keys,
|
|
14151
|
+
keys = _options$keys === void 0 ? common.DEFAULT_SEARCH_KEYS : _options$keys;
|
|
14152
|
+
if (!query || typeof query !== "string" || !items || ramda.isEmpty(items)) {
|
|
14153
|
+
return items ? items.slice(0, limit) : [];
|
|
14154
|
+
}
|
|
14155
|
+
var trimmedQuery = query.trim();
|
|
14156
|
+
if (!trimmedQuery) {
|
|
14157
|
+
return items ? items.slice(0, limit) : [];
|
|
14158
|
+
}
|
|
14159
|
+
var fieldAccessors = keys.map(function (key) {
|
|
14160
|
+
return {
|
|
14161
|
+
getValue: typeof key === "string" ? ramda.prop(key) : ramda.prop(key.name),
|
|
14162
|
+
weight: typeof key === "string" ? 1 : key.weight || 1
|
|
14163
|
+
};
|
|
14164
|
+
});
|
|
14165
|
+
var results = items.reduce(function (acc, item) {
|
|
14166
|
+
var bestScore = fieldAccessors.reduce(function (maxScore, accessor) {
|
|
14167
|
+
var fieldValue = accessor.getValue(item);
|
|
14168
|
+
if (ramda.isNil(fieldValue)) return maxScore;
|
|
14169
|
+
var fieldString = String(fieldValue);
|
|
14170
|
+
var score = calculateScore(trimmedQuery, fieldString);
|
|
14171
|
+
if (score <= 0) return maxScore;
|
|
14172
|
+
var weightedScore = score * accessor.weight;
|
|
14173
|
+
return weightedScore > maxScore ? weightedScore : maxScore;
|
|
14174
|
+
}, 0);
|
|
14175
|
+
if (bestScore > 0) {
|
|
14176
|
+
acc.push({
|
|
14177
|
+
item: item,
|
|
14178
|
+
score: bestScore
|
|
14179
|
+
});
|
|
14180
|
+
}
|
|
14181
|
+
return acc;
|
|
14182
|
+
}, []);
|
|
14183
|
+
results.sort(function (a, b) {
|
|
14184
|
+
if (Math.abs(a.score - b.score) < 0.001) {
|
|
14185
|
+
var aTitle = a.item.title || a.item.name || "";
|
|
14186
|
+
var bTitle = b.item.title || b.item.name || "";
|
|
14187
|
+
return aTitle.localeCompare(bTitle);
|
|
14188
|
+
}
|
|
14189
|
+
return b.score - a.score;
|
|
14190
|
+
});
|
|
14191
|
+
return ramda.pluck("item", results.slice(0, limit));
|
|
14192
|
+
};
|
|
14193
|
+
|
|
14109
14194
|
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; }
|
|
14110
14195
|
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; }
|
|
14111
14196
|
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)); }
|
|
@@ -14737,10 +14822,10 @@ var SlashCommands = {
|
|
|
14737
14822
|
},
|
|
14738
14823
|
items: function items(_ref3) {
|
|
14739
14824
|
var query = _ref3.query;
|
|
14740
|
-
|
|
14741
|
-
|
|
14742
|
-
|
|
14743
|
-
|
|
14825
|
+
if (!query) {
|
|
14826
|
+
return commandItems.slice(0, 10);
|
|
14827
|
+
}
|
|
14828
|
+
var filteredItems = fuzzySearch(commandItems, query);
|
|
14744
14829
|
return ramda.isEmpty(filteredItems) ? [NO_RESULT_MENU_ITEM] : filteredItems;
|
|
14745
14830
|
},
|
|
14746
14831
|
render: function render() {
|
|
@@ -20639,11 +20724,12 @@ var TableActionMenu = function TableActionMenu(_ref) {
|
|
|
20639
20724
|
appendTo: function appendTo() {
|
|
20640
20725
|
return document.body;
|
|
20641
20726
|
},
|
|
20727
|
+
className: "neeto-editor-table-bubble-menu__dropdown",
|
|
20642
20728
|
closeOnSelect: false,
|
|
20643
20729
|
position: "bottom-start",
|
|
20644
20730
|
strategy: "fixed",
|
|
20645
20731
|
buttonProps: {
|
|
20646
|
-
className: "neeto-editor-table-bubble-
|
|
20732
|
+
className: "neeto-editor-table-bubble-menu__dropdown-item",
|
|
20647
20733
|
icon: Down,
|
|
20648
20734
|
iconPosition: "right",
|
|
20649
20735
|
iconSize: 16,
|
|
@@ -20657,7 +20743,7 @@ var TableActionMenu = function TableActionMenu(_ref) {
|
|
|
20657
20743
|
}
|
|
20658
20744
|
},
|
|
20659
20745
|
children: /*#__PURE__*/jsxRuntime.jsx(Menu, {
|
|
20660
|
-
className: "neeto-ui-
|
|
20746
|
+
className: "neeto-ui-flex neeto-ui-items-center neeto-ui-justify-center",
|
|
20661
20747
|
children: (_action$items = action.items) === null || _action$items === void 0 ? void 0 : _action$items.map(function (_ref3) {
|
|
20662
20748
|
var type = _ref3.type,
|
|
20663
20749
|
command = _ref3.command,
|
|
@@ -20665,6 +20751,7 @@ var TableActionMenu = function TableActionMenu(_ref) {
|
|
|
20665
20751
|
var IconComponent = alignmentIcons[type];
|
|
20666
20752
|
return /*#__PURE__*/jsxRuntime.jsx(MenuItem, {
|
|
20667
20753
|
children: /*#__PURE__*/jsxRuntime.jsx(Button, {
|
|
20754
|
+
className: "neeto-editor-table-bubble-menu__item",
|
|
20668
20755
|
icon: IconComponent,
|
|
20669
20756
|
style: "text",
|
|
20670
20757
|
tooltipProps: {
|