From d036f961712240bf14bfb6fb28f5d1a5c640b1e4 Mon Sep 17 00:00:00 2001 From: SergeyEzhin Date: Wed, 22 Dec 2021 18:37:54 +0300 Subject: [PATCH] [DE PE SSE mobile] Fix Bug 54632 --- apps/documenteditor/mobile/locale/en.json | 3 +++ apps/documenteditor/mobile/src/controller/Main.jsx | 12 ++++++++++++ apps/presentationeditor/mobile/locale/en.json | 3 +++ .../mobile/src/controller/Main.jsx | 12 ++++++++++++ apps/spreadsheeteditor/mobile/locale/en.json | 3 +++ .../spreadsheeteditor/mobile/src/controller/Main.jsx | 11 ++++++++++- 6 files changed, 43 insertions(+), 1 deletion(-) diff --git a/apps/documenteditor/mobile/locale/en.json b/apps/documenteditor/mobile/locale/en.json index ed5477af9..1c3e16466 100644 --- a/apps/documenteditor/mobile/locale/en.json +++ b/apps/documenteditor/mobile/locale/en.json @@ -390,6 +390,9 @@ "errorUpdateVersion": "The file version has been changed. The page will be reloaded.", "leavePageText": "You have unsaved changes. Click 'Stay on this Page' to wait for autosave. Click 'Leave this Page' to discard all the unsaved changes.", "notcriticalErrorTitle": "Warning", + "textReplaceSuccess": "The search has been done. Occurrences replaced: {0}", + "textReplaceSkipped": "The replacement has been made. {0} occurrences were skipped.", + "textNoTextFound": "Text not found", "SDK": { " -Section ": " -Section ", "above": "above", diff --git a/apps/documenteditor/mobile/src/controller/Main.jsx b/apps/documenteditor/mobile/src/controller/Main.jsx index 3bcb7be53..1a35b24b7 100644 --- a/apps/documenteditor/mobile/src/controller/Main.jsx +++ b/apps/documenteditor/mobile/src/controller/Main.jsx @@ -681,6 +681,18 @@ class MainController extends Component { if (this.props.users.isDisconnected) return; storeToolbarSettings.setCanRedo(can); }); + + this.api.asc_registerCallback('asc_onReplaceAll', this.onApiTextReplaced.bind(this)); + } + + onApiTextReplaced(found, replaced) { + const { t } = this.props; + + if (found) { + f7.dialog.alert(null, !(found - replaced > 0) ? Common.Utils.String.format(t('Main.textReplaceSuccess'), replaced) : Common.Utils.String.format(t('Main.textReplaceSkipped'), found - replaced)); + } else { + f7.dialog.alert(null, t('Main.textNoTextFound')); + } } onShowListActions(obj, x, y) { diff --git a/apps/presentationeditor/mobile/locale/en.json b/apps/presentationeditor/mobile/locale/en.json index 5b7022a7b..24a328345 100644 --- a/apps/presentationeditor/mobile/locale/en.json +++ b/apps/presentationeditor/mobile/locale/en.json @@ -70,6 +70,9 @@ "errorUpdateVersion": "The file version has been changed. The page will be reloaded.", "leavePageText": "You have unsaved changes in this document. Click 'Stay on this Page' to wait for autosave. Click 'Leave this Page' to discard all the unsaved changes.", "notcriticalErrorTitle": "Warning", + "textReplaceSuccess": "The search has been done. Occurrences replaced: {0}", + "textReplaceSkipped": "The replacement has been made. {0} occurrences were skipped.", + "textNoTextFound": "Text not found", "SDK": { "Chart": "Chart", "Click to add first slide": "Click to add first slide", diff --git a/apps/presentationeditor/mobile/src/controller/Main.jsx b/apps/presentationeditor/mobile/src/controller/Main.jsx index 808a3888e..2c49ee791 100644 --- a/apps/presentationeditor/mobile/src/controller/Main.jsx +++ b/apps/presentationeditor/mobile/src/controller/Main.jsx @@ -414,6 +414,18 @@ class MainController extends Component { this.api.asc_registerCallback('asc_onCountPages', (count) => { storeToolbarSettings.setCountPages(count); }); + + this.api.asc_registerCallback('asc_onReplaceAll', this.onApiTextReplaced.bind(this)); + } + + onApiTextReplaced(found, replaced) { + const { t } = this.props; + + if (found) { + f7.dialog.alert(null, !(found - replaced > 0) ? Common.Utils.String.format(t('Controller.Main.textReplaceSuccess'), replaced) : Common.Utils.String.format(t('Controller.Main.textReplaceSkipped'), found - replaced)); + } else { + f7.dialog.alert(null, t('Controller.Main.textNoTextFound')); + } } onDocumentContentReady () { diff --git a/apps/spreadsheeteditor/mobile/locale/en.json b/apps/spreadsheeteditor/mobile/locale/en.json index 4f29f1c03..5762f154d 100644 --- a/apps/spreadsheeteditor/mobile/locale/en.json +++ b/apps/spreadsheeteditor/mobile/locale/en.json @@ -73,6 +73,9 @@ "errorUpdateVersion": "The file version has been changed. The page will be reloaded.", "leavePageText": "You have unsaved changes in this document. Click 'Stay on this Page' to wait for autosave. Click 'Leave this Page' to discard all the unsaved changes.", "notcriticalErrorTitle": "Warning", + "textReplaceSuccess": "The search has been done. Occurrences replaced: {0}", + "textReplaceSkipped": "The replacement has been made. {0} occurrences were skipped.", + "textNoTextFound": "Text not found", "SDK": { "txtAccent": "Accent", "txtAll": "(All)", diff --git a/apps/spreadsheeteditor/mobile/src/controller/Main.jsx b/apps/spreadsheeteditor/mobile/src/controller/Main.jsx index ebc81dd13..2f0bd5c32 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/Main.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/Main.jsx @@ -412,7 +412,16 @@ class MainController extends Component { }); this.api.asc_registerCallback('asc_onChangeProtectWorksheet', this.onChangeProtectSheet.bind(this)); - this.api.asc_registerCallback('asc_onActiveSheetChanged', this.onChangeProtectSheet.bind(this)); + this.api.asc_registerCallback('asc_onActiveSheetChanged', this.onChangeProtectSheet.bind(this)); + this.api.asc_registerCallback('asc_onRenameCellTextEnd', this.onRenameText.bind(this)); + } + + onRenameText(found, replaced) { + const { t } = this.props; + + if (this.api.isReplaceAll) { + f7.dialog.alert(null, (found) ? ((!found - replaced) ? Common.Utils.String.format(t('Controller.Main.textReplaceSuccess'), replaced) : Common.Utils.String.format(t('Controller.Main.textReplaceSkipped'), found - replaced)) : t('Controller.Main.textNoTextFound')); + } } onChangeProtectSheet() {