@fileverse-dev/fortune-core 1.1.48 → 1.1.50

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.
@@ -355,7 +355,7 @@ export function handleArrowKey(ctx, e) {
355
355
  var spans = doc.querySelectorAll("span");
356
356
  var lastSpan = spans[spans.length - 1];
357
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 && /^[a-zA-Z]+$/.test(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText) && !_.includes(["="], lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText)) {
358
+ if ((lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.includes(")")) || (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText) === '""' || notFunctionInit && /^[a-zA-Z]+$/.test(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText) && !_.includes(["="], lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText)) {
359
359
  return;
360
360
  }
361
361
  }
@@ -178,7 +178,7 @@ export function handleCellAreaMouseDown(ctx, globalCache, e, cellInput, containe
178
178
  var spans = doc.querySelectorAll("span");
179
179
  var firstSpan = spans[0];
180
180
  var lastSpan = spans[spans.length - 1];
181
- if (ctx.formulaCache.rangestart || ctx.formulaCache.rangedrag_column_start || ctx.formulaCache.rangedrag_row_start || israngeseleciton(ctx)) {
181
+ if (ctx.formulaCache.rangestart || ctx.formulaCache.rangedrag_column_start || ctx.formulaCache.rangedrag_row_start || israngeseleciton(ctx) || (firstSpan === null || firstSpan === void 0 ? void 0 : firstSpan.innerText.includes("=")) && !(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.includes(")"))) {
182
182
  var rowseleted = [row_index, row_index_ed];
183
183
  var columnseleted = [col_index, col_index_ed];
184
184
  var left = col_pre;
@@ -39,8 +39,8 @@ export declare function createFormulaRangeSelect(ctx: Context, select: {
39
39
  rangeIndex: number;
40
40
  } & Rect): void;
41
41
  export declare function createRangeHightlight(ctx: Context, inputInnerHtmlStr: string, ignoreRangeIndex?: number): void;
42
- export declare function setCaretPosition(ctx: Context, textDom: HTMLElement, children: number, pos: number): void;
43
42
  export declare function moveCursorToEnd(editableDiv: HTMLDivElement): void;
43
+ export declare function setCaretPosition(ctx: Context, textDom: HTMLElement, children: number, pos: number): void;
44
44
  export declare function getrangeseleciton(): ParentNode | ChildNode | null | undefined;
45
45
  export declare function rangeHightlightselected(ctx: Context, $editor: HTMLDivElement): void;
46
46
  export declare function functionHTMLGenerate(txt: string): string;
@@ -28,7 +28,6 @@ import { locale } from "../locale";
28
28
  import { colors } from "./color";
29
29
  import { colLocation, mousePosition, rowLocation } from "./location";
30
30
  import { cancelFunctionrangeSelected, seletedHighlistByindex, spillSortResult } from ".";
31
- import { isLetterNumberPattern, removeLastSpan } from "../utils/index";
32
31
  var functionHTMLIndex = 0;
33
32
  var rangeIndexes = [];
34
33
  var operatorPriority = {
@@ -1216,6 +1215,17 @@ export function createRangeHightlight(ctx, inputInnerHtmlStr, ignoreRangeIndex)
1216
1215
  });
1217
1216
  ctx.formulaRangeHighlight = formulaRanges;
1218
1217
  }
1218
+ export function moveCursorToEnd(editableDiv) {
1219
+ editableDiv.focus();
1220
+ var range = document.createRange();
1221
+ var selection = window.getSelection();
1222
+ range.selectNodeContents(editableDiv);
1223
+ range.collapse(false);
1224
+ if (selection) {
1225
+ selection.removeAllRanges();
1226
+ selection.addRange(range);
1227
+ }
1228
+ }
1219
1229
  export function setCaretPosition(ctx, textDom, children, pos) {
1220
1230
  var _a, _b;
1221
1231
  try {
@@ -1239,17 +1249,6 @@ export function setCaretPosition(ctx, textDom, children, pos) {
1239
1249
  moveCursorToEnd(textDom);
1240
1250
  }
1241
1251
  }
1242
- export function moveCursorToEnd(editableDiv) {
1243
- editableDiv.focus();
1244
- var range = document.createRange();
1245
- var selection = window.getSelection();
1246
- range.selectNodeContents(editableDiv);
1247
- range.collapse(false);
1248
- if (selection) {
1249
- selection.removeAllRanges();
1250
- selection.addRange(range);
1251
- }
1252
- }
1253
1252
  function functionRange(ctx, obj, v, vp) {
1254
1253
  if (window.getSelection) {
1255
1254
  var currSelection = window.getSelection();
@@ -1949,14 +1948,6 @@ export function functionStrChange(txt, type, rc, orient, stindex, step) {
1949
1948
  }
1950
1949
  export function rangeSetValue(ctx, cellInput, selected, fxInput) {
1951
1950
  var _a, _b, _c, _d, _e;
1952
- var parser = new DOMParser();
1953
- var doc = parser.parseFromString("<div>".concat(cellInput.innerHTML, "</div>"), "text/html");
1954
- var spans = doc.querySelectorAll("span");
1955
- var lastSpan = spans[spans.length - 1];
1956
- if (lastSpan && isLetterNumberPattern(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText)) {
1957
- var htmlR = removeLastSpan(cellInput.innerHTML);
1958
- cellInput.innerHTML = "".concat(htmlR);
1959
- }
1960
1951
  var $editor = cellInput;
1961
1952
  var $copyTo = fxInput;
1962
1953
  if (((_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.id) === "luckysheet-functionbox-cell") {
@@ -365,7 +365,7 @@ function handleArrowKey(ctx, e) {
365
365
  var spans = doc.querySelectorAll("span");
366
366
  var lastSpan = spans[spans.length - 1];
367
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 && /^[a-zA-Z]+$/.test(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText) && !_lodash.default.includes(["="], lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText)) {
368
+ if ((lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.includes(")")) || (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText) === '""' || notFunctionInit && /^[a-zA-Z]+$/.test(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText) && !_lodash.default.includes(["="], lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText)) {
369
369
  return;
370
370
  }
371
371
  }
@@ -197,7 +197,7 @@ function handleCellAreaMouseDown(ctx, globalCache, e, cellInput, container, fxIn
197
197
  var spans = doc.querySelectorAll("span");
198
198
  var firstSpan = spans[0];
199
199
  var lastSpan = spans[spans.length - 1];
200
- if (ctx.formulaCache.rangestart || ctx.formulaCache.rangedrag_column_start || ctx.formulaCache.rangedrag_row_start || (0, _modules.israngeseleciton)(ctx)) {
200
+ if (ctx.formulaCache.rangestart || ctx.formulaCache.rangedrag_column_start || ctx.formulaCache.rangedrag_row_start || (0, _modules.israngeseleciton)(ctx) || (firstSpan === null || firstSpan === void 0 ? void 0 : firstSpan.innerText.includes("=")) && !(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.includes(")"))) {
201
201
  var rowseleted = [row_index, row_index_ed];
202
202
  var columnseleted = [col_index, col_index_ed];
203
203
  var left = col_pre;
@@ -39,8 +39,8 @@ export declare function createFormulaRangeSelect(ctx: Context, select: {
39
39
  rangeIndex: number;
40
40
  } & Rect): void;
41
41
  export declare function createRangeHightlight(ctx: Context, inputInnerHtmlStr: string, ignoreRangeIndex?: number): void;
42
- export declare function setCaretPosition(ctx: Context, textDom: HTMLElement, children: number, pos: number): void;
43
42
  export declare function moveCursorToEnd(editableDiv: HTMLDivElement): void;
43
+ export declare function setCaretPosition(ctx: Context, textDom: HTMLElement, children: number, pos: number): void;
44
44
  export declare function getrangeseleciton(): ParentNode | ChildNode | null | undefined;
45
45
  export declare function rangeHightlightselected(ctx: Context, $editor: HTMLDivElement): void;
46
46
  export declare function functionHTMLGenerate(txt: string): string;
@@ -38,7 +38,6 @@ var _locale = require("../locale");
38
38
  var _color = require("./color");
39
39
  var _location = require("./location");
40
40
  var _2 = require(".");
41
- var _index = require("../utils/index");
42
41
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
43
42
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
44
43
  var __assign = void 0 && (void 0).__assign || function () {
@@ -1246,6 +1245,17 @@ function createRangeHightlight(ctx, inputInnerHtmlStr, ignoreRangeIndex) {
1246
1245
  });
1247
1246
  ctx.formulaRangeHighlight = formulaRanges;
1248
1247
  }
1248
+ function moveCursorToEnd(editableDiv) {
1249
+ editableDiv.focus();
1250
+ var range = document.createRange();
1251
+ var selection = window.getSelection();
1252
+ range.selectNodeContents(editableDiv);
1253
+ range.collapse(false);
1254
+ if (selection) {
1255
+ selection.removeAllRanges();
1256
+ selection.addRange(range);
1257
+ }
1258
+ }
1249
1259
  function setCaretPosition(ctx, textDom, children, pos) {
1250
1260
  var _a, _b;
1251
1261
  try {
@@ -1269,17 +1279,6 @@ function setCaretPosition(ctx, textDom, children, pos) {
1269
1279
  moveCursorToEnd(textDom);
1270
1280
  }
1271
1281
  }
1272
- function moveCursorToEnd(editableDiv) {
1273
- editableDiv.focus();
1274
- var range = document.createRange();
1275
- var selection = window.getSelection();
1276
- range.selectNodeContents(editableDiv);
1277
- range.collapse(false);
1278
- if (selection) {
1279
- selection.removeAllRanges();
1280
- selection.addRange(range);
1281
- }
1282
- }
1283
1282
  function functionRange(ctx, obj, v, vp) {
1284
1283
  if (window.getSelection) {
1285
1284
  var currSelection = window.getSelection();
@@ -1979,14 +1978,6 @@ function functionStrChange(txt, type, rc, orient, stindex, step) {
1979
1978
  }
1980
1979
  function rangeSetValue(ctx, cellInput, selected, fxInput) {
1981
1980
  var _a, _b, _c, _d, _e;
1982
- var parser = new DOMParser();
1983
- var doc = parser.parseFromString("<div>".concat(cellInput.innerHTML, "</div>"), "text/html");
1984
- var spans = doc.querySelectorAll("span");
1985
- var lastSpan = spans[spans.length - 1];
1986
- if (lastSpan && (0, _index.isLetterNumberPattern)(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText)) {
1987
- var htmlR = (0, _index.removeLastSpan)(cellInput.innerHTML);
1988
- cellInput.innerHTML = "".concat(htmlR);
1989
- }
1990
1981
  var $editor = cellInput;
1991
1982
  var $copyTo = fxInput;
1992
1983
  if (((_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.id) === "luckysheet-functionbox-cell") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-core",
3
- "version": "1.1.48",
3
+ "version": "1.1.50",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.js",
6
6
  "typings": "lib/index.d.ts",