From c5e8d8417200558a16adcf564693bb5b9bd59fba Mon Sep 17 00:00:00 2001 From: SergeyEzhin Date: Mon, 25 Oct 2021 20:45:08 +0400 Subject: [PATCH] [DE PE SSE mobile] Blocking keyboard --- .../lib/view/collaboration/Collaboration.jsx | 9 +++++++- .../mobile/src/view/add/Add.jsx | 8 ++++++- .../mobile/src/view/edit/Edit.jsx | 8 ++++++- .../mobile/src/view/settings/Settings.jsx | 4 ++++ .../mobile/src/view/add/Add.jsx | 8 ++++++- .../mobile/src/view/edit/Edit.jsx | 8 ++++++- .../mobile/src/view/settings/Settings.jsx | 8 ++++++- .../mobile/src/view/add/Add.jsx | 21 ++++++++++++------- .../mobile/src/view/edit/Edit.jsx | 16 ++++++++------ .../mobile/src/view/settings/Settings.jsx | 8 ++++++- 10 files changed, 77 insertions(+), 21 deletions(-) diff --git a/apps/common/mobile/lib/view/collaboration/Collaboration.jsx b/apps/common/mobile/lib/view/collaboration/Collaboration.jsx index ce900db31..31dca7cb5 100644 --- a/apps/common/mobile/lib/view/collaboration/Collaboration.jsx +++ b/apps/common/mobile/lib/view/collaboration/Collaboration.jsx @@ -147,7 +147,11 @@ class CollaborationView extends Component { } const Collaboration = props => { + const api = Common.EditorApi.get(); + useEffect(() => { + api.asc_enableKeyEvents(false); + if ( Device.phone ) { f7.sheet.open('.coauth__sheet'); } else { @@ -160,7 +164,10 @@ const Collaboration = props => { }); const onviewclosed = () => { - if ( props.onclosed ) props.onclosed(); + if ( props.onclosed ) { + api.asc_enableKeyEvents(true); + props.onclosed(); + } }; return ( diff --git a/apps/documenteditor/mobile/src/view/add/Add.jsx b/apps/documenteditor/mobile/src/view/add/Add.jsx index a53800be8..6edc60edb 100644 --- a/apps/documenteditor/mobile/src/view/add/Add.jsx +++ b/apps/documenteditor/mobile/src/view/add/Add.jsx @@ -213,7 +213,11 @@ class AddView extends Component { } const Add = props => { + const api = Common.EditorApi.get(); + useEffect(() => { + api.asc_enableKeyEvents(false); + if ( Device.phone ) f7.popup.open('.add-popup'); else f7.popover.open('#add-popover', '#btn-add'); @@ -225,8 +229,10 @@ const Add = props => { } }); const onviewclosed = () => { - if ( props.onclosed ) + if ( props.onclosed ) { + api.asc_enableKeyEvents(true); props.onclosed(); + } }; return }; diff --git a/apps/documenteditor/mobile/src/view/edit/Edit.jsx b/apps/documenteditor/mobile/src/view/edit/Edit.jsx index 7554124c2..002aad77c 100644 --- a/apps/documenteditor/mobile/src/view/edit/Edit.jsx +++ b/apps/documenteditor/mobile/src/view/edit/Edit.jsx @@ -328,7 +328,11 @@ const EditView = props => { }; const EditOptions = props => { + const api = Common.EditorApi.get(); + useEffect(() => { + api.asc_enableKeyEvents(false); + if ( Device.phone ) f7.sheet.open('#edit-sheet'); else f7.popover.open('#edit-popover', '#btn-edit'); @@ -339,8 +343,10 @@ const EditOptions = props => { }); const onviewclosed = () => { - if ( props.onclosed ) + if ( props.onclosed ) { + api.asc_enableKeyEvents(true); props.onclosed(); + } }; return ( diff --git a/apps/documenteditor/mobile/src/view/settings/Settings.jsx b/apps/documenteditor/mobile/src/view/settings/Settings.jsx index 4a63c0283..26560eb8f 100644 --- a/apps/documenteditor/mobile/src/view/settings/Settings.jsx +++ b/apps/documenteditor/mobile/src/view/settings/Settings.jsx @@ -60,6 +60,7 @@ const routes = [ const SettingsList = inject("storeAppOptions", "storeReview")(observer(props => { const { t } = useTranslation(); const _t = t('Settings', {returnObjects: true}); + const api = Common.EditorApi.get(); const storeReview = props.storeReview; const displayMode = storeReview.displayMode; const navbar = @@ -72,6 +73,8 @@ const SettingsList = inject("storeAppOptions", "storeReview")(observer(props => }; const closeModal = () => { + api.asc_enableKeyEvents(true); + if (Device.phone) { f7.sheet.close('.settings-popup', false); } else { @@ -85,6 +88,7 @@ const SettingsList = inject("storeAppOptions", "storeReview")(observer(props => } useEffect(() => { + api.asc_enableKeyEvents(false); }); // set mode diff --git a/apps/presentationeditor/mobile/src/view/add/Add.jsx b/apps/presentationeditor/mobile/src/view/add/Add.jsx index afbfcc092..1875a82ac 100644 --- a/apps/presentationeditor/mobile/src/view/add/Add.jsx +++ b/apps/presentationeditor/mobile/src/view/add/Add.jsx @@ -152,7 +152,11 @@ class AddView extends Component { } const Add = props => { + const api = Common.EditorApi.get(); + useEffect(() => { + api.asc_enableKeyEvents(false); + if ( Device.phone ) f7.popup.open('.add-popup'); else f7.popover.open('#add-popover', '#btn-add'); @@ -162,8 +166,10 @@ const Add = props => { } }); const onviewclosed = () => { - if ( props.onclosed ) + if ( props.onclosed ) { + api.asc_enableKeyEvents(true); props.onclosed(); + } }; return }; diff --git a/apps/presentationeditor/mobile/src/view/edit/Edit.jsx b/apps/presentationeditor/mobile/src/view/edit/Edit.jsx index 6bf147ace..76c13a4fc 100644 --- a/apps/presentationeditor/mobile/src/view/edit/Edit.jsx +++ b/apps/presentationeditor/mobile/src/view/edit/Edit.jsx @@ -349,7 +349,11 @@ const EditView = props => { }; const EditOptions = props => { + const api = Common.EditorApi.get(); + useEffect(() => { + api.asc_enableKeyEvents(false); + if ( Device.phone ) f7.sheet.open('#edit-sheet'); else f7.popover.open('#edit-popover', '#btn-edit'); @@ -360,8 +364,10 @@ const EditOptions = props => { }); const onviewclosed = () => { - if ( props.onclosed ) + if ( props.onclosed ) { + api.asc_enableKeyEvents(true); props.onclosed(); + } }; return ( diff --git a/apps/presentationeditor/mobile/src/view/settings/Settings.jsx b/apps/presentationeditor/mobile/src/view/settings/Settings.jsx index 744f34910..6ad187cdb 100644 --- a/apps/presentationeditor/mobile/src/view/settings/Settings.jsx +++ b/apps/presentationeditor/mobile/src/view/settings/Settings.jsx @@ -189,7 +189,11 @@ class SettingsView extends Component { } const Settings = props => { + const api = Common.EditorApi.get(); + useEffect(() => { + api.asc_enableKeyEvents(false); + if ( Device.phone ) f7.popup.open('.settings-popup'); else f7.popover.open('#settings-popover', '#btn-settings'); @@ -199,8 +203,10 @@ const Settings = props => { }); const onviewclosed = () => { - if (props.onclosed) + if (props.onclosed) { + api.asc_enableKeyEvents(true); props.onclosed(); + } }; return diff --git a/apps/spreadsheeteditor/mobile/src/view/add/Add.jsx b/apps/spreadsheeteditor/mobile/src/view/add/Add.jsx index 325442ffa..0d6f3a4ec 100644 --- a/apps/spreadsheeteditor/mobile/src/view/add/Add.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/add/Add.jsx @@ -193,7 +193,17 @@ class AddView extends Component { } const Add = props => { + const api = Common.EditorApi.get(); + const cellinfo = api.asc_getCellInfo(); + const seltype = cellinfo.asc_getSelectionType(); + const iscelllocked = cellinfo.asc_getLocked(); + const isAddShapeHyperlink = api.asc_canAddShapeHyperlink(); + + let options; + useEffect(() => { + api.asc_enableKeyEvents(false); + if ( Device.phone ) { f7.popup.open('.add-popup'); } else { @@ -207,17 +217,12 @@ const Add = props => { }); const onviewclosed = () => { - if ( props.onclosed ) + if ( props.onclosed ) { + api.asc_enableKeyEvents(true); props.onclosed(); + } }; - const api = Common.EditorApi.get(); - const cellinfo = api.asc_getCellInfo(); - const seltype = cellinfo.asc_getSelectionType(); - const iscelllocked = cellinfo.asc_getLocked(); - const isAddShapeHyperlink = api.asc_canAddShapeHyperlink(); - let options; - if ( !iscelllocked ) { options = props.showOptions; if ( !options ) { diff --git a/apps/spreadsheeteditor/mobile/src/view/edit/Edit.jsx b/apps/spreadsheeteditor/mobile/src/view/edit/Edit.jsx index a2faab7b1..7afba155f 100644 --- a/apps/spreadsheeteditor/mobile/src/view/edit/Edit.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/edit/Edit.jsx @@ -430,7 +430,14 @@ const EditView = props => { }; const EditOptions = props => { + const api = Common.EditorApi.get(); + const cellinfo = api.asc_getCellInfo(); + const hyperinfo = cellinfo.asc_getHyperlink(); + const isAddShapeHyperlink = api.asc_canAddShapeHyperlink(); + useEffect(() => { + api.asc_enableKeyEvents(false); + if ( Device.phone ) f7.sheet.open('#edit-sheet'); else f7.popover.open('#edit-popover', '#btn-edit'); @@ -441,15 +448,12 @@ const EditOptions = props => { }); const onviewclosed = () => { - if ( props.onclosed ) + if ( props.onclosed ) { + api.asc_enableKeyEvents(true); props.onclosed(); + } }; - const api = Common.EditorApi.get(); - const cellinfo = api.asc_getCellInfo(); - const hyperinfo = cellinfo.asc_getHyperlink(); - const isAddShapeHyperlink = api.asc_canAddShapeHyperlink(); - return ( ) diff --git a/apps/spreadsheeteditor/mobile/src/view/settings/Settings.jsx b/apps/spreadsheeteditor/mobile/src/view/settings/Settings.jsx index 2a0e42c8e..b71c47fca 100644 --- a/apps/spreadsheeteditor/mobile/src/view/settings/Settings.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/settings/Settings.jsx @@ -193,7 +193,11 @@ class SettingsView extends Component { } const Settings = props => { + const api = Common.EditorApi.get(); + useEffect(() => { + api.asc_enableKeyEvents(false); + if ( Device.phone ) f7.popup.open('.settings-popup'); else f7.popover.open('#settings-popover', '#btn-settings'); @@ -204,8 +208,10 @@ const Settings = props => { const onviewclosed = () => { - if ( props.onclosed ) + if ( props.onclosed ) { + api.asc_enableKeyEvents(true); props.onclosed(); + } }; return