Browse Source

限制sheet工作表的重命名不能为空

master
flowerField 5 years ago
parent
commit
5ed073bb10
  1. 15
      src/controllers/sheetBar.js
  2. 1
      src/locale/en.js
  3. 1
      src/locale/es.js
  4. 1
      src/locale/zh.js

15
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");
}

1
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',

1
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',

1
src/locale/zh.js

@ -9755,6 +9755,7 @@ export default {
noHide:"不能隐藏, 至少保留一个sheet标签",
chartEditNoOpt:"图表编辑模式下不允许该操作!",
sheetNameSpecCharError:"名称不能包含:[ ] : \ ? * / ' \"",
sheetNamecannotIsEmptyError:"名称不能为空"
},
conditionformat: {
conditionformat_greaterThan: '条件格式——大于',

Loading…
Cancel
Save