From 95a4d207bcc8b03f884691c50fd8b59a10fcf780 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 28 Nov 2022 22:11:35 +0300 Subject: [PATCH 1/4] For bug 52224 --- apps/documenteditor/main/app/controller/Main.js | 6 +++++- apps/documenteditor/main/locale/en.json | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 16a1bf070..0520667a7 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1787,6 +1787,9 @@ define([ this.showTips([this.scriptLoadError]); this.tooltip && this.tooltip.getBSTip().$tip.css('z-index', 10000); return; + } else if (id == Asc.c_oAscError.ID.CanNotPasteImage) { + this.showTips([this.errorCannotPasteImg], {timeout: 7000, hideCloseTip: true}); + return; } this.hidePreloader(); @@ -3321,7 +3324,8 @@ define([ errorInconsistentExtXlsx: 'An error has occurred while opening the file.
The file content corresponds to spreadsheets (e.g. xlsx), but the file has the inconsistent extension: %1.', errorInconsistentExtPptx: 'An error has occurred while opening the file.
The file content corresponds to presentations (e.g. pptx), but the file has the inconsistent extension: %1.', errorInconsistentExtPdf: 'An error has occurred while opening the file.
The file content corresponds to one of the following formats: pdf/djvu/xps/oxps, but the file has the inconsistent extension: %1.', - errorInconsistentExt: 'An error has occurred while opening the file.
The file content does not match the file extension.' + errorInconsistentExt: 'An error has occurred while opening the file.
The file content does not match the file extension.', + errorCannotPasteImg: 'We can\'t paste this image from the Clipboard, but you can save it to your device and \ninsert it from there, or you can copy the image without text and paste it into the document.' } })(), DE.Controllers.Main || {})) }); \ No newline at end of file diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index ceeff19ba..de9d479cb 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -771,6 +771,7 @@ "DE.Controllers.Main.errorUserDrop": "The file cannot be accessed right now.", "DE.Controllers.Main.errorUsersExceed": "The number of users allowed by the pricing plan was exceeded", "DE.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.", + "DE.Controllers.Main.errorCannotPasteImg": "We can't paste this image from the Clipboard, but you can save it to your device and \ninsert it from there, or you can copy the image without text and paste it into the document.", "DE.Controllers.Main.leavePageText": "You have unsaved changes in this document. Click \"Stay on This Page\", then \"Save\" to save them. Click \"Leave This Page\" to discard all the unsaved changes.", "DE.Controllers.Main.leavePageTextOnClose": "All unsaved changes in this document will be lost.
Click \"Cancel\" then \"Save\" to save them. Click \"OK\" to discard all the unsaved changes.", "DE.Controllers.Main.loadFontsTextText": "Loading data...", From 02be3055da77bbba8825574f93a118bf36ccb705 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 29 Nov 2022 11:57:14 +0300 Subject: [PATCH 2/4] For Bug 52224 --- apps/presentationeditor/main/app/controller/Main.js | 6 +++++- apps/presentationeditor/main/locale/en.json | 1 + apps/spreadsheeteditor/main/app/controller/Main.js | 6 +++++- apps/spreadsheeteditor/main/locale/en.json | 1 + 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index d2d5af115..d99da5bf5 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -1428,6 +1428,9 @@ define([ this.showTips([this.scriptLoadError]); this.tooltip && this.tooltip.getBSTip().$tip.css('z-index', 10000); return; + } else if (id == Asc.c_oAscError.ID.CanNotPasteImage) { + this.showTips([this.errorCannotPasteImg], {timeout: 7000, hideCloseTip: true}); + return; } this.hidePreloader(); @@ -3051,7 +3054,8 @@ define([ errorInconsistentExtXlsx: 'An error has occurred while opening the file.
The file content corresponds to spreadsheets (e.g. xlsx), but the file has the inconsistent extension: %1.', errorInconsistentExtPptx: 'An error has occurred while opening the file.
The file content corresponds to presentations (e.g. pptx), but the file has the inconsistent extension: %1.', errorInconsistentExtPdf: 'An error has occurred while opening the file.
The file content corresponds to one of the following formats: pdf/djvu/xps/oxps, but the file has the inconsistent extension: %1.', - errorInconsistentExt: 'An error has occurred while opening the file.
The file content does not match the file extension.' + errorInconsistentExt: 'An error has occurred while opening the file.
The file content does not match the file extension.', + errorCannotPasteImg: 'We can\'t paste this image from the Clipboard, but you can save it to your device and \ninsert it from there, or you can copy the image without text and paste it into the presentation.' } })(), PE.Controllers.Main || {})) }); diff --git a/apps/presentationeditor/main/locale/en.json b/apps/presentationeditor/main/locale/en.json index 0edde656e..365015f58 100644 --- a/apps/presentationeditor/main/locale/en.json +++ b/apps/presentationeditor/main/locale/en.json @@ -843,6 +843,7 @@ "PE.Controllers.Main.errorUserDrop": "The file cannot be accessed right now.", "PE.Controllers.Main.errorUsersExceed": "The number of users allowed by the pricing plan was exceeded", "PE.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.", + "PE.Controllers.Main.errorCannotPasteImg": "We can't paste this image from the Clipboard, but you can save it to your device and \ninsert it from there, or you can copy the image without text and paste it into the presentation.", "PE.Controllers.Main.leavePageText": "You have unsaved changes in this presentation. Click \"Stay on This Page\", then \"Save\" to save them. Click \"Leave This Page\" to discard all the unsaved changes.", "PE.Controllers.Main.leavePageTextOnClose": "All unsaved changes in this presentation will be lost.
Click \"Cancel\" then \"Save\" to save them. Click \"OK\" to discard all the unsaved changes.", "PE.Controllers.Main.loadFontsTextText": "Loading data...", diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 40b126438..5004abb40 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -1572,6 +1572,9 @@ define([ this.showTips([this.scriptLoadError]); this.tooltip && this.tooltip.getBSTip().$tip.css('z-index', 10000); return; + } else if (id == Asc.c_oAscError.ID.CanNotPasteImage) { + this.showTips([this.errorCannotPasteImg], {timeout: 7000, hideCloseTip: true}); + return; } this.hidePreloader(); @@ -3715,7 +3718,8 @@ define([ errorInconsistentExtXlsx: 'An error has occurred while opening the file.
The file content corresponds to spreadsheets (e.g. xlsx), but the file has the inconsistent extension: %1.', errorInconsistentExtPptx: 'An error has occurred while opening the file.
The file content corresponds to presentations (e.g. pptx), but the file has the inconsistent extension: %1.', errorInconsistentExtPdf: 'An error has occurred while opening the file.
The file content corresponds to one of the following formats: pdf/djvu/xps/oxps, but the file has the inconsistent extension: %1.', - errorInconsistentExt: 'An error has occurred while opening the file.
The file content does not match the file extension.' + errorInconsistentExt: 'An error has occurred while opening the file.
The file content does not match the file extension.', + errorCannotPasteImg: 'We can\'t paste this image from the Clipboard, but you can save it to your device and \ninsert it from there, or you can copy the image without text and paste it into the spreadsheet.' } })(), SSE.Controllers.Main || {})) }); diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index d56275437..26297cc59 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -959,6 +959,7 @@ "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.errorWrongPassword": "The password you supplied is not correct.", + "SSE.Controllers.Main.errorCannotPasteImg": "We can't paste this image from the Clipboard, but you can save it to your device and \ninsert it from there, or you can copy the image without text and paste it into the spreadsheet.", "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.", From 1102a2f762c22a9e5e15aff1aef4178bc4bfac80 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 29 Nov 2022 12:53:43 +0300 Subject: [PATCH 3/4] [PE] Fix Bug 59908 --- .../main/app/controller/DocumentHolder.js | 2 +- apps/presentationeditor/main/app/controller/ViewTab.js | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/apps/presentationeditor/main/app/controller/DocumentHolder.js b/apps/presentationeditor/main/app/controller/DocumentHolder.js index ece6868f3..207f3b813 100644 --- a/apps/presentationeditor/main/app/controller/DocumentHolder.js +++ b/apps/presentationeditor/main/app/controller/DocumentHolder.js @@ -2163,7 +2163,7 @@ define([ onGuidesClick: function(menu, item) { if (item.value == 'del-guide' && item.options.guideId) - this.api.asc_deleteGuide(item.options.guideId); + this.documentHolder.fireEvent('guides:delete', [item.options.guideId]); else if (item.value === 'add-vert' || item.value === 'add-hor') this.documentHolder.fireEvent('guides:add', [item.value]); else if (item.value === 'clear') diff --git a/apps/presentationeditor/main/app/controller/ViewTab.js b/apps/presentationeditor/main/app/controller/ViewTab.js index 57cb07fd2..d08b3409c 100644 --- a/apps/presentationeditor/main/app/controller/ViewTab.js +++ b/apps/presentationeditor/main/app/controller/ViewTab.js @@ -123,6 +123,7 @@ define([ 'DocumentHolder': { 'guides:show': _.bind(this.onGuidesShow, this), 'guides:add': _.bind(this.onGuidesAdd, this), + 'guides:delete': _.bind(this.onGuidesDelete, this), 'guides:clear': _.bind(this.onGuidesClear, this), 'guides:smart': _.bind(this.onGuidesSmartShow, this), 'gridlines:show': _.bind(this.onGridlinesShow, this), @@ -277,8 +278,17 @@ define([ Common.NotificationCenter.trigger('edit:complete', this.view); }, + onGuidesDelete: function(id) { + this.api.asc_deleteGuide(id); + this.api.asc_getShowGuides() && (this.api.asc_getGuidesCount()<1) && this.onGuidesShow(false); + + Common.NotificationCenter.trigger('edit:complete', this.view); + }, + onGuidesClear: function() { this.api.asc_clearGuides(); + this.api.asc_getShowGuides() && this.onGuidesShow(false); + Common.NotificationCenter.trigger('edit:complete', this.view); }, From 1d03ef54eeaa40495764a0c39b8aa30741120946 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 29 Nov 2022 12:58:39 +0300 Subject: [PATCH 4/4] [PE] Fix guides lock on document loading --- .../main/app/controller/DocumentHolder.js | 2 +- .../main/app/controller/ViewTab.js | 1 + .../main/app/view/DocumentHolder.js | 15 ++++++++------- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/apps/presentationeditor/main/app/controller/DocumentHolder.js b/apps/presentationeditor/main/app/controller/DocumentHolder.js index 207f3b813..c909e3ff4 100644 --- a/apps/presentationeditor/main/app/controller/DocumentHolder.js +++ b/apps/presentationeditor/main/app/controller/DocumentHolder.js @@ -2398,7 +2398,7 @@ define([ }, onLockViewProps: function(lock) { - this.documentHolder && (this.documentHolder._state.viewPropsLock = lock); + Common.Utils.InternalSettings.set("pe-lock-view-props", lock); var me = this, currentMenu = me.documentHolder.currentMenu; diff --git a/apps/presentationeditor/main/app/controller/ViewTab.js b/apps/presentationeditor/main/app/controller/ViewTab.js index d08b3409c..9cc92668f 100644 --- a/apps/presentationeditor/main/app/controller/ViewTab.js +++ b/apps/presentationeditor/main/app/controller/ViewTab.js @@ -375,6 +375,7 @@ define([ onLockViewProps: function(lock) { this._state.lock_viewProps = lock; + Common.Utils.InternalSettings.set("pe-lock-view-props", lock); if (this.view) { if (this.view.btnGridlines && (typeof this.view.btnGridlines.menu === 'object') && this.view.btnGridlines.menu.isVisible()) this.onGridlinesAfterShow(); diff --git a/apps/presentationeditor/main/app/view/DocumentHolder.js b/apps/presentationeditor/main/app/view/DocumentHolder.js index 3bb73ee7b..00508b82a 100644 --- a/apps/presentationeditor/main/app/view/DocumentHolder.js +++ b/apps/presentationeditor/main/app/view/DocumentHolder.js @@ -1036,10 +1036,11 @@ define([ } me.mnuGuides.menu.items[6].setChecked(me.api.asc_getShowSmartGuides(), true); - me.mnuGuides.menu.items[2].setDisabled(me._state.viewPropsLock); - me.mnuGuides.menu.items[3].setDisabled(me._state.viewPropsLock); - me.mnuGuides.menu.items[4].setDisabled(me._state.viewPropsLock); - me.mnuGuides.menu.items[7].setDisabled(me._state.viewPropsLock || !me.api.asc_canClearGuides()); + var viewPropsLock = !!Common.Utils.InternalSettings.get("pe-lock-view-props"); + me.mnuGuides.menu.items[2].setDisabled(viewPropsLock); + me.mnuGuides.menu.items[3].setDisabled(viewPropsLock); + me.mnuGuides.menu.items[4].setDisabled(viewPropsLock); + me.mnuGuides.menu.items[7].setDisabled(viewPropsLock || !me.api.asc_canClearGuides()); me.mnuGridlines.menu.items[0].setChecked(me.api.asc_getShowGridlines(), true); me.mnuGridlines.menu.items[1].setChecked(me.api.asc_getSnapToGrid(), true); @@ -1072,10 +1073,10 @@ define([ item.setChecked(true); else item.setChecked(false); - item.setDisabled(me._state.viewPropsLock); + item.setDisabled(viewPropsLock); } - me.mnuGridlines.menu.items[1].setDisabled(me._state.viewPropsLock); - me.mnuGridlines.menu.items[items.length-1].setDisabled(me._state.viewPropsLock); + me.mnuGridlines.menu.items[1].setDisabled(viewPropsLock); + me.mnuGridlines.menu.items[items.length-1].setDisabled(viewPropsLock); me.mnuRulers.setChecked(!Common.Utils.InternalSettings.get("pe-hidden-rulers")); }