From bbeadf82336e10873ee767be9ca2ba62a20b496b Mon Sep 17 00:00:00 2001 From: "Julia.Radzhabova" Date: Fri, 29 Aug 2025 22:37:29 +0300 Subject: [PATCH] For Bug 25910 --- .../main/app/controller/Statusbar.js | 18 +++++++++++-- apps/spreadsheeteditor/main/locale/en.json | 2 ++ apps/spreadsheeteditor/mobile/locale/en.json | 4 ++- .../mobile/src/controller/Statusbar.jsx | 25 ++++++++++++++++--- 4 files changed, 43 insertions(+), 6 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Statusbar.js b/apps/spreadsheeteditor/main/app/controller/Statusbar.js index eb0b141ec4..9b1734897a 100644 --- a/apps/spreadsheeteditor/main/app/controller/Statusbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Statusbar.js @@ -785,9 +785,23 @@ define([ onAddWorksheetClick: function(o, index, opts) { if (this.api) { this.api.asc_closeCellEditor(); - this.api.asc_addWorksheet(this.createSheetName()); - Common.NotificationCenter.trigger('comments:updatefilter', ['doc', 'sheet' + this.api.asc_getActiveWorksheetId()], false); // hide popover + if (this.statusbar.mode.spreadsheet.fileType.toLowerCase()==='csv') { + Common.UI.warning({ + msg: this.warnAddSheetCsv, + buttons: [{value: 'ok', caption: this.textContinue}, 'cancel'], + maxwidth: 500, + callback: _.bind(function (btn) { + if (btn == 'ok') { + this.api.asc_addWorksheet(this.createSheetName()); + Common.NotificationCenter.trigger('comments:updatefilter', ['doc', 'sheet' + this.api.asc_getActiveWorksheetId()], false); // hide popover + } + }, this) + }); + } else { + this.api.asc_addWorksheet(this.createSheetName()); + Common.NotificationCenter.trigger('comments:updatefilter', ['doc', 'sheet' + this.api.asc_getActiveWorksheetId()], false); // hide popover + } } Common.NotificationCenter.trigger('edit:complete', this.statusbar); }, diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index afd19ab7b5..0c8156a970 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -1611,6 +1611,8 @@ "SSE.Controllers.Statusbar.textSheetViewTipFilters": "You are in Sheet View mode. Filters are visible only to you and those who are still in this view.", "SSE.Controllers.Statusbar.warnDeleteSheet": "The selected sheets might contain data. Are you sure you want to proceed?", "SSE.Controllers.Statusbar.zoomText": "Zoom {0}%", + "SSE.Controllers.Statusbar.warnAddSheetCsv": "The CSV format does not support saving a multi-sheet file. Only the active sheet will be saved. To keep all sheets, please save the file in a different format.", + "SSE.Controllers.Statusbar.textContinue": "Continue", "SSE.Controllers.TableDesignTab.notcriticalErrorTitle": "Warning", "SSE.Controllers.TableDesignTab.textExistName": "ERROR! A range with such a name already exists", "SSE.Controllers.TableDesignTab.textInvalidName": "ERROR! Invalid table name", diff --git a/apps/spreadsheeteditor/mobile/locale/en.json b/apps/spreadsheeteditor/mobile/locale/en.json index 0c22698b2d..3201719987 100644 --- a/apps/spreadsheeteditor/mobile/locale/en.json +++ b/apps/spreadsheeteditor/mobile/locale/en.json @@ -448,7 +448,9 @@ "textSheetName": "Sheet Name", "textTabColor": "Tab Color", "textUnhide": "Unhide", - "textWarnDeleteSheet": "The sheet maybe has data. Proceed operation?" + "textWarnDeleteSheet": "The sheet maybe has data. Proceed operation?", + "textContinue": "Continue", + "warnAddSheetCsv": "The CSV format does not support saving a multi-sheet file. Only the active sheet will be saved. To keep all sheets, please save the file in a different format." }, "Toolbar": { "btnRestartNow": "Restart now", diff --git a/apps/spreadsheeteditor/mobile/src/controller/Statusbar.jsx b/apps/spreadsheeteditor/mobile/src/controller/Statusbar.jsx index 031399e012..806e470fcf 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/Statusbar.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/Statusbar.jsx @@ -109,8 +109,8 @@ const StatusbarController = inject('storeWorksheets', 'storeFocusObjects', 'user return null; })); -const Statusbar = inject('storeWorksheets', 'storeAppOptions', 'users')(observer(props => { - const {storeWorksheets, storeAppOptions, users} = props; +const Statusbar = inject('storeWorksheets', 'storeAppOptions', 'users', 'storeSpreadsheetInfo')(observer(props => { + const {storeWorksheets, storeAppOptions, users, storeSpreadsheetInfo} = props; const {t} = useTranslation(); const _t = t('Statusbar', {returnObjects: true}); const isEdit = storeAppOptions.isEdit; @@ -161,7 +161,26 @@ const Statusbar = inject('storeWorksheets', 'storeAppOptions', 'users')(observer const onAddTabClicked = () => { const api = Common.EditorApi.get(); api.asc_closeCellEditor(); - api.asc_addWorksheet(createSheetName()); + + if ((storeSpreadsheetInfo.dataDoc?.fileType ?? '').toLowerCase() === 'csv') { + f7.dialog.create({ + title: _t.notcriticalErrorTitle, + text: _t.warnAddSheetCsv, + buttons: [ + { + text: _t.textCancel + }, + { + text: _t.textContinue, + onClick: () => { + api.asc_addWorksheet(createSheetName()); + } + } + ] + }).open(); + } else { + api.asc_addWorksheet(createSheetName()); + } }; const onTabClick = (i, target) => {