@fileverse-dev/fortune-core 1.2.67 → 1.2.68
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/es/modules/cell.js
CHANGED
|
@@ -541,6 +541,9 @@ export function updateCell(ctx, r, c, $input, value, canvas) {
|
|
|
541
541
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
542
542
|
if (ctx.allowEdit === false || ctx.isFlvReadOnly) return;
|
|
543
543
|
var inputText = $input === null || $input === void 0 ? void 0 : $input.innerText;
|
|
544
|
+
if (inputText === null || inputText === void 0 ? void 0 : inputText.startsWith("=")) {
|
|
545
|
+
inputText = inputText === null || inputText === void 0 ? void 0 : inputText.replace(/[\r\n]/g, "");
|
|
546
|
+
}
|
|
544
547
|
var inputHtml = $input === null || $input === void 0 ? void 0 : $input.innerHTML;
|
|
545
548
|
var flowdata = getFlowdata(ctx);
|
|
546
549
|
if (!flowdata) return;
|
|
@@ -606,7 +609,7 @@ export function updateCell(ctx, r, c, $input, value, canvas) {
|
|
|
606
609
|
}];
|
|
607
610
|
}
|
|
608
611
|
}
|
|
609
|
-
value = value ||
|
|
612
|
+
value = value || inputText;
|
|
610
613
|
var shouldClearError = (oldValue === null || oldValue === void 0 ? void 0 : oldValue.f) ? oldValue.f !== value : (oldValue === null || oldValue === void 0 ? void 0 : oldValue.v) !== value;
|
|
611
614
|
if (shouldClearError) {
|
|
612
615
|
clearCellError(ctx, r, c);
|
package/es/modules/formula.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ export declare function createFormulaRangeSelect(ctx: Context, select: {
|
|
|
40
40
|
} & Rect): void;
|
|
41
41
|
export declare function createRangeHightlight(ctx: Context, inputInnerHtmlStr: string, ignoreRangeIndex?: number): void;
|
|
42
42
|
export declare function moveCursorToEnd(editableDiv: HTMLDivElement): void;
|
|
43
|
-
export declare function setCaretPosition(ctx: Context, textDom: HTMLElement, children: number, pos: number): void;
|
|
43
|
+
export declare function setCaretPosition(ctx: Context, textDom: HTMLElement, children: number, pos: number, parentTextDom?: HTMLElement): 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;
|
package/es/modules/formula.js
CHANGED
|
@@ -1254,7 +1254,7 @@ export function moveCursorToEnd(editableDiv) {
|
|
|
1254
1254
|
selection.addRange(range);
|
|
1255
1255
|
}
|
|
1256
1256
|
}
|
|
1257
|
-
export function setCaretPosition(ctx, textDom, children, pos) {
|
|
1257
|
+
export function setCaretPosition(ctx, textDom, children, pos, parentTextDom) {
|
|
1258
1258
|
var _a, _b;
|
|
1259
1259
|
try {
|
|
1260
1260
|
var el = textDom;
|
|
@@ -1274,9 +1274,7 @@ export function setCaretPosition(ctx, textDom, children, pos) {
|
|
|
1274
1274
|
el.focus();
|
|
1275
1275
|
} catch (err) {
|
|
1276
1276
|
console.error(err);
|
|
1277
|
-
|
|
1278
|
-
moveCursorToEnd(textDom);
|
|
1279
|
-
}, 10);
|
|
1277
|
+
moveCursorToEnd(parentTextDom);
|
|
1280
1278
|
}
|
|
1281
1279
|
}
|
|
1282
1280
|
function functionRange(ctx, obj, v, vp) {
|
|
@@ -1288,7 +1286,7 @@ function functionRange(ctx, obj, v, vp) {
|
|
|
1288
1286
|
currSelection.selectAllChildren(obj);
|
|
1289
1287
|
currSelection.collapseToEnd();
|
|
1290
1288
|
} else {
|
|
1291
|
-
setCaretPosition(ctx, obj.querySelectorAll("span")[fri[0]], 0, fri[1]);
|
|
1289
|
+
setCaretPosition(ctx, obj.querySelectorAll("span")[fri[0]], 0, fri[1], obj);
|
|
1292
1290
|
}
|
|
1293
1291
|
} else if (document.selection) {
|
|
1294
1292
|
ctx.formulaCache.functionRangeIndex.moveToElementText(obj);
|
package/lib/modules/cell.js
CHANGED
|
@@ -574,6 +574,9 @@ function updateCell(ctx, r, c, $input, value, canvas) {
|
|
|
574
574
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
575
575
|
if (ctx.allowEdit === false || ctx.isFlvReadOnly) return;
|
|
576
576
|
var inputText = $input === null || $input === void 0 ? void 0 : $input.innerText;
|
|
577
|
+
if (inputText === null || inputText === void 0 ? void 0 : inputText.startsWith("=")) {
|
|
578
|
+
inputText = inputText === null || inputText === void 0 ? void 0 : inputText.replace(/[\r\n]/g, "");
|
|
579
|
+
}
|
|
577
580
|
var inputHtml = $input === null || $input === void 0 ? void 0 : $input.innerHTML;
|
|
578
581
|
var flowdata = (0, _context.getFlowdata)(ctx);
|
|
579
582
|
if (!flowdata) return;
|
|
@@ -639,7 +642,7 @@ function updateCell(ctx, r, c, $input, value, canvas) {
|
|
|
639
642
|
}];
|
|
640
643
|
}
|
|
641
644
|
}
|
|
642
|
-
value = value ||
|
|
645
|
+
value = value || inputText;
|
|
643
646
|
var shouldClearError = (oldValue === null || oldValue === void 0 ? void 0 : oldValue.f) ? oldValue.f !== value : (oldValue === null || oldValue === void 0 ? void 0 : oldValue.v) !== value;
|
|
644
647
|
if (shouldClearError) {
|
|
645
648
|
(0, _api.clearCellError)(ctx, r, c);
|
package/lib/modules/formula.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ export declare function createFormulaRangeSelect(ctx: Context, select: {
|
|
|
40
40
|
} & Rect): void;
|
|
41
41
|
export declare function createRangeHightlight(ctx: Context, inputInnerHtmlStr: string, ignoreRangeIndex?: number): void;
|
|
42
42
|
export declare function moveCursorToEnd(editableDiv: HTMLDivElement): void;
|
|
43
|
-
export declare function setCaretPosition(ctx: Context, textDom: HTMLElement, children: number, pos: number): void;
|
|
43
|
+
export declare function setCaretPosition(ctx: Context, textDom: HTMLElement, children: number, pos: number, parentTextDom?: HTMLElement): 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;
|
package/lib/modules/formula.js
CHANGED
|
@@ -1284,7 +1284,7 @@ function moveCursorToEnd(editableDiv) {
|
|
|
1284
1284
|
selection.addRange(range);
|
|
1285
1285
|
}
|
|
1286
1286
|
}
|
|
1287
|
-
function setCaretPosition(ctx, textDom, children, pos) {
|
|
1287
|
+
function setCaretPosition(ctx, textDom, children, pos, parentTextDom) {
|
|
1288
1288
|
var _a, _b;
|
|
1289
1289
|
try {
|
|
1290
1290
|
var el = textDom;
|
|
@@ -1304,9 +1304,7 @@ function setCaretPosition(ctx, textDom, children, pos) {
|
|
|
1304
1304
|
el.focus();
|
|
1305
1305
|
} catch (err) {
|
|
1306
1306
|
console.error(err);
|
|
1307
|
-
|
|
1308
|
-
moveCursorToEnd(textDom);
|
|
1309
|
-
}, 10);
|
|
1307
|
+
moveCursorToEnd(parentTextDom);
|
|
1310
1308
|
}
|
|
1311
1309
|
}
|
|
1312
1310
|
function functionRange(ctx, obj, v, vp) {
|
|
@@ -1318,7 +1316,7 @@ function functionRange(ctx, obj, v, vp) {
|
|
|
1318
1316
|
currSelection.selectAllChildren(obj);
|
|
1319
1317
|
currSelection.collapseToEnd();
|
|
1320
1318
|
} else {
|
|
1321
|
-
setCaretPosition(ctx, obj.querySelectorAll("span")[fri[0]], 0, fri[1]);
|
|
1319
|
+
setCaretPosition(ctx, obj.querySelectorAll("span")[fri[0]], 0, fri[1], obj);
|
|
1322
1320
|
}
|
|
1323
1321
|
} else if (document.selection) {
|
|
1324
1322
|
ctx.formulaCache.functionRangeIndex.moveToElementText(obj);
|