@fileverse-dev/fortune-core 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.
@@ -349,13 +349,15 @@ function handleShiftWithArrowKey(ctx, e) {
349
349
  }
350
350
  export function handleArrowKey(ctx, e) {
351
351
  var _a, _b;
352
- var parser = new DOMParser();
353
- var doc = parser.parseFromString("<div>".concat((_a = document.getElementById("luckysheet-rich-text-editor")) === null || _a === void 0 ? void 0 : _a.innerHTML, "</div>"), "text/html");
354
- var spans = doc.querySelectorAll("span");
355
- var lastSpan = spans[spans.length - 1];
356
- var notFunctionInit = !((_b = document.getElementById("luckysheet-rich-text-editor")) === null || _b === void 0 ? void 0 : _b.innerText.includes('('));
357
- if ((lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.includes(")")) || notFunctionInit && (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.length) > 3) {
358
- return;
352
+ if (ctx.luckysheetCellUpdate.length > 0 || ctx.luckysheet_cell_selected_move || ctx.luckysheet_cell_selected_extend) {
353
+ var parser = new DOMParser();
354
+ var doc = parser.parseFromString("<div>".concat((_a = document.getElementById("luckysheet-rich-text-editor")) === null || _a === void 0 ? void 0 : _a.innerHTML, "</div>"), "text/html");
355
+ var spans = doc.querySelectorAll("span");
356
+ var lastSpan = spans[spans.length - 1];
357
+ var notFunctionInit = !((_b = document.getElementById("luckysheet-rich-text-editor")) === null || _b === void 0 ? void 0 : _b.innerText.includes("("));
358
+ 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)) {
359
+ return;
360
+ }
359
361
  }
360
362
  var moveCount = hideCRCount(ctx, e.key);
361
363
  switch (e.key) {
@@ -1235,7 +1235,7 @@ export function setCaretPosition(ctx, textDom, children, pos) {
1235
1235
  sel === null || sel === void 0 ? void 0 : sel.addRange(range);
1236
1236
  el.focus();
1237
1237
  } catch (err) {
1238
- console.error(err);
1238
+ console.warn("setCaretPosition error");
1239
1239
  moveToEnd(ctx.formulaCache.rangeResizeTo[0]);
1240
1240
  }
1241
1241
  }
@@ -359,13 +359,15 @@ function handleShiftWithArrowKey(ctx, e) {
359
359
  }
360
360
  function handleArrowKey(ctx, e) {
361
361
  var _a, _b;
362
- var parser = new DOMParser();
363
- var doc = parser.parseFromString("<div>".concat((_a = document.getElementById("luckysheet-rich-text-editor")) === null || _a === void 0 ? void 0 : _a.innerHTML, "</div>"), "text/html");
364
- var spans = doc.querySelectorAll("span");
365
- var lastSpan = spans[spans.length - 1];
366
- var notFunctionInit = !((_b = document.getElementById("luckysheet-rich-text-editor")) === null || _b === void 0 ? void 0 : _b.innerText.includes('('));
367
- if ((lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.includes(")")) || notFunctionInit && (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.length) > 3) {
368
- return;
362
+ if (ctx.luckysheetCellUpdate.length > 0 || ctx.luckysheet_cell_selected_move || ctx.luckysheet_cell_selected_extend) {
363
+ var parser = new DOMParser();
364
+ var doc = parser.parseFromString("<div>".concat((_a = document.getElementById("luckysheet-rich-text-editor")) === null || _a === void 0 ? void 0 : _a.innerHTML, "</div>"), "text/html");
365
+ var spans = doc.querySelectorAll("span");
366
+ var lastSpan = spans[spans.length - 1];
367
+ var notFunctionInit = !((_b = document.getElementById("luckysheet-rich-text-editor")) === null || _b === void 0 ? void 0 : _b.innerText.includes("("));
368
+ 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)) {
369
+ return;
370
+ }
369
371
  }
370
372
  var moveCount = (0, _2.hideCRCount)(ctx, e.key);
371
373
  switch (e.key) {
@@ -1264,7 +1264,7 @@ function setCaretPosition(ctx, textDom, children, pos) {
1264
1264
  sel === null || sel === void 0 ? void 0 : sel.addRange(range);
1265
1265
  el.focus();
1266
1266
  } catch (err) {
1267
- console.error(err);
1267
+ console.warn("setCaretPosition error");
1268
1268
  (0, _cursor.moveToEnd)(ctx.formulaCache.rangeResizeTo[0]);
1269
1269
  }
1270
1270
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-core",
3
- "version": "1.1.36",
3
+ "version": "1.1.37",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.js",
6
6
  "typings": "lib/index.d.ts",