From 85882cf1131bc6ae313e455a0146963fe32296ae Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Sun, 8 Aug 2021 23:10:52 +0300 Subject: [PATCH] [SSE] Fix hyperlinks editing. Add errors --- .../main/app/controller/DocumentHolder.js | 15 +++++---------- .../main/app/controller/Main.js | 19 +++++++++++++++++-- .../main/app/view/Toolbar.js | 2 +- apps/spreadsheeteditor/main/locale/en.json | 3 +++ 4 files changed, 26 insertions(+), 13 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index cade3f2e2..ebe965730 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -237,7 +237,7 @@ define([ view.menuParagraphBullets.menu.on('show:after', _.bind(me.onBulletMenuShowAfter, me)); view.menuAddHyperlinkShape.on('click', _.bind(me.onInsHyperlink, me)); view.menuEditHyperlinkShape.on('click', _.bind(me.onInsHyperlink, me)); - view.menuRemoveHyperlinkShape.on('click', _.bind(me.onRemoveHyperlinkShape, me)); + view.menuRemoveHyperlinkShape.on('click', _.bind(me.onDelHyperlink, me)); view.pmiTextAdvanced.on('click', _.bind(me.onTextAdvanced, me)); view.mnuShapeAdvanced.on('click', _.bind(me.onShapeAdvanced, me)); view.mnuChartEdit.on('click', _.bind(me.onChartEdit, me)); @@ -638,6 +638,10 @@ define([ }, onDelHyperlink: function(item) { + Common.NotificationCenter.trigger('protect:check', this.onDelHyperlinkCallback, this); + }, + + onDelHyperlinkCallback: function(item) { if (this.api) { this.api.asc_removeHyperlink(); @@ -898,15 +902,6 @@ define([ Common.component.Analytics.trackEvent('DocumentHolder', 'List Type'); }, - onRemoveHyperlinkShape: function(item) { - if (this.api) { - this.api.asc_removeHyperlink(); - - Common.NotificationCenter.trigger('edit:complete', this.documentHolder); - Common.component.Analytics.trackEvent('DocumentHolder', 'Remove Hyperlink'); - } - }, - onTextAdvanced: function(item) { var me = this; diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 73cc99db7..72b37c109 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -1800,6 +1800,18 @@ define([ config.msg = this.errorLocationOrDataRangeError; break; + case Asc.c_oAscError.ID.PasswordIsNotCorrect: + config.msg = this.errorPasswordIsNotCorrect; + break; + + case Asc.c_oAscError.ID.DeleteColumnContainsLockedCell: + config.msg = this.errorDeleteColumnContainsLockedCell; + break; + + case Asc.c_oAscError.ID.DeleteRowContainsLockedCell: + config.msg = this.errorDeleteRowContainsLockedCell; + break; + default: config.msg = (typeof id == 'string') ? id : this.errorDefaultMessage.replace('%1', id); break; @@ -2164,7 +2176,7 @@ define([ }, checkProtectedRange: function(callback, scope, args) { - var result = this.api.asc_checkActiveCellProtectedRange(); + var result = this.api.asc_isProtectedSheet() ? this.api.asc_checkActiveCellProtectedRange() : false; if (result===null) { this.onError(Asc.c_oAscError.ID.ChangeOnProtectedSheet, Asc.c_oAscError.Level.NoCritical); return; @@ -3311,7 +3323,10 @@ define([ textLearnMore: 'Learn More', errorSingleColumnOrRowError: 'Location reference is not valid because the cells are not all in the same column or row.
Select cells that are all in a single column or row.', errorLocationOrDataRangeError: 'The reference for the location or data range is not valid.', - txtErrorLoadHistory: 'Loading history failed' + txtErrorLoadHistory: 'Loading history failed', + errorPasswordIsNotCorrect: 'The password you supplied is not correct.
Verify that the CAPS LOCK key is off and be sure to use the correct capitalization.', + errorDeleteColumnContainsLockedCell: 'You are trying to delete a column that contains a locked cell. Locked cells cannot be deleted while the worksheet is protected.
To delete a locked cell, unprotect the sheet. You might be requested to enter a password.', + errorDeleteRowContainsLockedCell: 'You are trying to delete a row that contains a locked cell. Locked cells cannot be deleted while the worksheet is protected.
To delete a locked cell, unprotect the sheet. You might be requested to enter a password.' } })(), SSE.Controllers.Main || {})) }); diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js index 723d340cf..a11d75f43 100644 --- a/apps/spreadsheeteditor/main/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js @@ -1219,7 +1219,7 @@ define([ cls : 'btn-toolbar x-huge icon-top', iconCls : 'toolbar__icon btn-colorschemas', caption : me.capBtnColorSchemas, - lock : [_set.editCell, _set.lostConnect, _set.coAuth], + lock : [_set.editCell, _set.lostConnect, _set.coAuth, _set.wsLock], menu : new Common.UI.Menu({ cls: 'shifted-left', items: [], diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index b7605e2da..03703ded1 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -707,6 +707,9 @@ "SSE.Controllers.Main.errorViewerDisconnect": "Connection is lost. You can still view the document,
but will not be able to download or print it until the connection is restored and page is reloaded.", "SSE.Controllers.Main.errorWrongBracketsCount": "An error in the entered formula.
Wrong number of brackets is used.", "SSE.Controllers.Main.errorWrongOperator": "An error in the entered formula. Wrong operator is used.
Please correct the error.", + "SSE.Controllers.Main.errorPasswordIsNotCorrect": "The password you supplied is not correct.
Verify that the CAPS LOCK key is off and be sure to use the correct capitalization.", + "SSE.Controllers.Main.errorDeleteColumnContainsLockedCell": "You are trying to delete a column that contains a locked cell. Locked cells cannot be deleted while the worksheet is protected.
To delete a locked cell, unprotect the sheet. You might be requested to enter a password.", + "SSE.Controllers.Main.errorDeleteRowContainsLockedCell": "You are trying to delete a row that contains a locked cell. Locked cells cannot be deleted while the worksheet is protected.
To delete a locked cell, unprotect the sheet. You might be requested to enter a password.", "SSE.Controllers.Main.errRemDuplicates": "Duplicate values found and deleted: {0}, unique values left: {1}.", "SSE.Controllers.Main.leavePageText": "You have unsaved changes in this spreadsheet. Click 'Stay on this Page' then 'Save' to save them. Click 'Leave this Page' to discard all the unsaved changes.", "SSE.Controllers.Main.leavePageTextOnClose": "All unsaved changes in this spreadsheet will be lost.
Click \"Cancel\" then \"Save\" to save them. Click \"OK\" to discard all the unsaved changes.",