diff --git a/src/controllers/sheetBar.js b/src/controllers/sheetBar.js index 7c6d36b99..df8aacb3d 100644 --- a/src/controllers/sheetBar.js +++ b/src/controllers/sheetBar.js @@ -136,6 +136,10 @@ let luckysheetsheetrightclick = function ($t, $cur, e) { }, 1); } else { + //保存正在编辑的单元格内容 + if (parseInt($("#luckysheet-input-box").css("top")) > 0) { + formula.updatecell(Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[1]); + } $("#luckysheet-input-box").removeAttr("style"); $("#luckysheet-formula-functionrange .luckysheet-formula-functionrange-highlight").remove(); } diff --git a/src/global/api.js b/src/global/api.js index 7f1e88215..118f3e3e7 100644 --- a/src/global/api.js +++ b/src/global/api.js @@ -4519,7 +4519,7 @@ export function setSheetAdd(options = {}) { let index = sheetmanage.generateRandomSheetIndex(); // calcChain公式链里的index也要跟着变化 - if (sheetObject.calcChain.length > 0) { + if (sheetObject.calcChain && sheetObject.calcChain.length > 0) { sheetObject.calcChain.forEach((item) => { item.index = index })