@fileverse-dev/fortune-react 1.1.36 → 1.1.37

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.
@@ -200,10 +200,10 @@ var InputBox = function InputBox() {
200
200
  }
201
201
  }, [getActiveFormula, insertSelectedFormula]);
202
202
  var onKeyDown = useCallback(function (e) {
203
- var _a;
203
+ var _a, _b;
204
204
  lastKeyDownEventRef.current = new KeyboardEvent(e.type, e.nativeEvent);
205
205
  preText.current = inputRef.current.innerText;
206
- if (e.key !== "ArrowLeft") {
206
+ if (e.key === "Delete" || e.key === "Backspace") {
207
207
  setTimeout(function () {
208
208
  moveCursorToEnd(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current);
209
209
  }, 5);
@@ -223,8 +223,12 @@ var InputBox = function InputBox() {
223
223
  var doc = parser.parseFromString("<div>".concat((_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.innerHTML, "</div>"), "text/html");
224
224
  var spans = doc.querySelectorAll("span");
225
225
  var lastSpan = spans[spans.length - 1];
226
+ var notFunctionInit = !((_b = document.getElementById("luckysheet-rich-text-editor")) === null || _b === void 0 ? void 0 : _b.innerText.includes("("));
227
+ if ((lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.includes(")")) || notFunctionInit && (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.length) >= 1 && !_.includes(["="], lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText)) {
228
+ return;
229
+ }
226
230
  if (((lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText) === "(" || (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText) === "," || (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.includes(":")) || (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText) !== ")") && !isLetterNumberPattern(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText)) {
227
- if (!(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.includes("(")) && (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.length) > 2 || (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.length) === 2 && !isLetterNumberPattern(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText)) {
231
+ if (!(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current.innerText.includes("(")) && (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.length) > 2 || (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.length) === 2 && !isLetterNumberPattern(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText)) {
228
232
  return;
229
233
  }
230
234
  inputRef.current.innerHTML = "".concat(inputRef.current.innerHTML, "<span class=\"fortune-formula-functionrange-cell\" rangeindex=\"0\" dir=\"auto\" style=\"color:#c1232b;\">").concat(refCell, "</span>");
@@ -209,10 +209,10 @@ var InputBox = function InputBox() {
209
209
  }
210
210
  }, [getActiveFormula, insertSelectedFormula]);
211
211
  var onKeyDown = (0, _react.useCallback)(function (e) {
212
- var _a;
212
+ var _a, _b;
213
213
  lastKeyDownEventRef.current = new KeyboardEvent(e.type, e.nativeEvent);
214
214
  preText.current = inputRef.current.innerText;
215
- if (e.key !== "ArrowLeft") {
215
+ if (e.key === "Delete" || e.key === "Backspace") {
216
216
  setTimeout(function () {
217
217
  (0, _helper.moveCursorToEnd)(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current);
218
218
  }, 5);
@@ -232,8 +232,12 @@ var InputBox = function InputBox() {
232
232
  var doc = parser.parseFromString("<div>".concat((_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.innerHTML, "</div>"), "text/html");
233
233
  var spans = doc.querySelectorAll("span");
234
234
  var lastSpan = spans[spans.length - 1];
235
+ var notFunctionInit = !((_b = document.getElementById("luckysheet-rich-text-editor")) === null || _b === void 0 ? void 0 : _b.innerText.includes("("));
236
+ if ((lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.includes(")")) || notFunctionInit && (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.length) >= 1 && !_lodash.default.includes(["="], lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText)) {
237
+ return;
238
+ }
235
239
  if (((lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText) === "(" || (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText) === "," || (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.includes(":")) || (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText) !== ")") && !(0, _helper.isLetterNumberPattern)(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText)) {
236
- if (!(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.includes("(")) && (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.length) > 2 || (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.length) === 2 && !(0, _helper.isLetterNumberPattern)(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText)) {
240
+ if (!(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current.innerText.includes("(")) && (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.length) > 2 || (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.length) === 2 && !(0, _helper.isLetterNumberPattern)(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText)) {
237
241
  return;
238
242
  }
239
243
  inputRef.current.innerHTML = "".concat(inputRef.current.innerHTML, "<span class=\"fortune-formula-functionrange-cell\" rangeindex=\"0\" dir=\"auto\" style=\"color:#c1232b;\">").concat(refCell, "</span>");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-react",
3
- "version": "1.1.36",
3
+ "version": "1.1.37",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "module": "es/index.js",
@@ -16,7 +16,7 @@
16
16
  "tsc": "tsc"
17
17
  },
18
18
  "dependencies": {
19
- "@fileverse-dev/fortune-core": "1.1.36",
19
+ "@fileverse-dev/fortune-core": "1.1.37",
20
20
  "@fileverse/ui": "^4.1.7-patch-21",
21
21
  "@tippyjs/react": "^4.2.6",
22
22
  "@types/regenerator-runtime": "^0.13.6",