From 8e1fb526c001a7d26e73079e813161843a399c78 Mon Sep 17 00:00:00 2001 From: Julia Svinareva Date: Wed, 9 Oct 2019 10:06:30 +0300 Subject: [PATCH] [SSE] Bug 37388 (insert worksheet) --- .../main/app/controller/Statusbar.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Statusbar.js b/apps/spreadsheeteditor/main/app/controller/Statusbar.js index 784565ac5..3c8523651 100644 --- a/apps/spreadsheeteditor/main/app/controller/Statusbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Statusbar.js @@ -254,8 +254,12 @@ define([ }); switch (item.value) { case 'ins': + var arrNames = []; + for(var i = 0; i < arrIndex.length; i++) { + arrNames.push(me.createSheetName(arrNames)); + } setTimeout(function () { - me.api.asc_insertWorksheet(me.createSheetName()); + me.api.asc_insertWorksheet(arrNames); }, 1); break; case 'del': @@ -278,7 +282,7 @@ define([ } }, - createSheetName: function() { + createSheetName: function(curArrNames) { var items = [], wc = this.api.asc_getWorksheetsCount(); while (wc--) { items.push(this.api.asc_getWorksheetName(wc).toLowerCase()); @@ -290,6 +294,17 @@ define([ if (items.indexOf(name.toLowerCase()) < 0) break; } + if (curArrNames && curArrNames.length > 0) { + var arr = []; + curArrNames.forEach(function (item) { + arr.push(item.toLowerCase()); + }); + while(arr.indexOf(name.toLowerCase()) !== -1) { + index++; + name = this.strSheet + index; + } + } + return name; },