diff --git a/src/controllers/sheetBar.js b/src/controllers/sheetBar.js index 231b1e9..9aba9a0 100644 --- a/src/controllers/sheetBar.js +++ b/src/controllers/sheetBar.js @@ -20,7 +20,7 @@ import luckysheetConfigsetting from './luckysheetConfigsetting'; //表格底部名称栏区域 相关事件(增、删、改、隐藏显示、颜色等等) -let isInitialSheetConfig = false, luckysheetcurrentSheetitem = null, jfdbclicklagTimeout = null; +let isInitialSheetConfig = false, luckysheetcurrentSheetitem = null, jfdbclicklagTimeout = null,oldSheetFileName = "";; function showsheetconfigmenu() { if (!isInitialSheetConfig) { isInitialSheetConfig = true; @@ -229,6 +229,18 @@ export function initialSheetBar(){ if(Store.allowEdit===false){ return; } + + if(0 === $(this).text().length){ + + alert(locale_sheetconfig.sheetNamecannotIsEmptyError); + setTimeout(()=>{ + $(this).text(oldSheetFileName); + luckysheetsheetnameeditor($(this)); + $(this).focus(); + }, 1); + return; + } + let $t = $(this); let txt = $t.text(), oldtxt = $t.data("oldtxt"); var reg1 = new RegExp("[\\[\\]:\\?*\/'\"]"); @@ -279,6 +291,7 @@ export function initialSheetBar(){ let $t = $(this); if (kcode == keycode.ENTER) { let index = getSheetIndex(Store.currentSheetIndex); + oldSheetFileName = Store.luckysheetfile[index].name || oldSheetFileName; Store.luckysheetfile[index].name = $t.text(); $t.attr("contenteditable", "false"); } diff --git a/src/locale/en.js b/src/locale/en.js index 67589dd..9ccfc13 100644 --- a/src/locale/en.js +++ b/src/locale/en.js @@ -9512,6 +9512,7 @@ export default { noHide:"Can't hide, at least keep one sheet tag", chartEditNoOpt:"This operation is not allowed in chart editing mode!", sheetNameSpecCharError:"The name cannot contain:[ ] : \ ? * / ' \"", + sheetNamecannotIsEmptyError:"Sheet name cannot be empty" }, conditionformat: { conditionformat_greaterThan: 'Conditionformat-GreaterThan', diff --git a/src/locale/es.js b/src/locale/es.js index ce51b35..b08e20c 100644 --- a/src/locale/es.js +++ b/src/locale/es.js @@ -9510,6 +9510,7 @@ export default { noHide:"No se puede ocultar, al menos conserva una etiqueta de hoja", chartEditNoOpt:"¡Esta operación no está permitida en el modo de edición de gráficos!", sheetNameSpecCharError:"El nombre no puede contener:[ ] : \ ? * / ' \"", + sheetNamecannotIsEmptyError:"El nombre de la hoja no puede estar vacío" }, conditionformat: { conditionformat_greaterThan: 'Conditionformat-GreaterThan', diff --git a/src/locale/zh.js b/src/locale/zh.js index dd7b883..cf3a2b7 100644 --- a/src/locale/zh.js +++ b/src/locale/zh.js @@ -9755,6 +9755,7 @@ export default { noHide:"不能隐藏, 至少保留一个sheet标签", chartEditNoOpt:"图表编辑模式下不允许该操作!", sheetNameSpecCharError:"名称不能包含:[ ] : \ ? * / ' \"", + sheetNamecannotIsEmptyError:"名称不能为空" }, conditionformat: { conditionformat_greaterThan: '条件格式——大于',