@fileverse-dev/fortune-core 1.0.78 → 1.0.79
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/formula.js +8 -0
- package/lib/modules/formula.js +8 -0
- package/package.json +1 -1
package/es/modules/formula.js
CHANGED
|
@@ -1193,10 +1193,18 @@ export function createRangeHightlight(ctx, inputInnerHtmlStr, ignoreRangeIndex)
|
|
|
1193
1193
|
ctx.formulaRangeHighlight = formulaRanges;
|
|
1194
1194
|
}
|
|
1195
1195
|
export function setCaretPosition(ctx, textDom, children, pos) {
|
|
1196
|
+
var _a, _b;
|
|
1196
1197
|
try {
|
|
1197
1198
|
var el = textDom;
|
|
1198
1199
|
var range = document.createRange();
|
|
1199
1200
|
var sel = window.getSelection();
|
|
1201
|
+
var mainSpan = document.querySelector('.luckysheet-formula-text-string');
|
|
1202
|
+
var textContent = ((_b = (_a = mainSpan === null || mainSpan === void 0 ? void 0 : mainSpan.firstChild) === null || _a === void 0 ? void 0 : _a.nodeValue) === null || _b === void 0 ? void 0 : _b.trim()) || '';
|
|
1203
|
+
var innerSpan = mainSpan === null || mainSpan === void 0 ? void 0 : mainSpan.querySelector('.fortune-formula-functionrange-cell');
|
|
1204
|
+
if (innerSpan && mainSpan) {
|
|
1205
|
+
textContent += innerSpan.textContent;
|
|
1206
|
+
el.innerHTML = textContent;
|
|
1207
|
+
}
|
|
1200
1208
|
range.setStart(el.childNodes[children], pos);
|
|
1201
1209
|
range.collapse(true);
|
|
1202
1210
|
sel === null || sel === void 0 ? void 0 : sel.removeAllRanges();
|
package/lib/modules/formula.js
CHANGED
|
@@ -1222,10 +1222,18 @@ function createRangeHightlight(ctx, inputInnerHtmlStr, ignoreRangeIndex) {
|
|
|
1222
1222
|
ctx.formulaRangeHighlight = formulaRanges;
|
|
1223
1223
|
}
|
|
1224
1224
|
function setCaretPosition(ctx, textDom, children, pos) {
|
|
1225
|
+
var _a, _b;
|
|
1225
1226
|
try {
|
|
1226
1227
|
var el = textDom;
|
|
1227
1228
|
var range = document.createRange();
|
|
1228
1229
|
var sel = window.getSelection();
|
|
1230
|
+
var mainSpan = document.querySelector('.luckysheet-formula-text-string');
|
|
1231
|
+
var textContent = ((_b = (_a = mainSpan === null || mainSpan === void 0 ? void 0 : mainSpan.firstChild) === null || _a === void 0 ? void 0 : _a.nodeValue) === null || _b === void 0 ? void 0 : _b.trim()) || '';
|
|
1232
|
+
var innerSpan = mainSpan === null || mainSpan === void 0 ? void 0 : mainSpan.querySelector('.fortune-formula-functionrange-cell');
|
|
1233
|
+
if (innerSpan && mainSpan) {
|
|
1234
|
+
textContent += innerSpan.textContent;
|
|
1235
|
+
el.innerHTML = textContent;
|
|
1236
|
+
}
|
|
1229
1237
|
range.setStart(el.childNodes[children], pos);
|
|
1230
1238
|
range.collapse(true);
|
|
1231
1239
|
sel === null || sel === void 0 ? void 0 : sel.removeAllRanges();
|