From c543f139eb74e64bc8ca180eab6b084eb226aead Mon Sep 17 00:00:00 2001 From: ShimaginAndrey Date: Sat, 5 Mar 2022 11:01:45 +0300 Subject: [PATCH] [SSE] Fix Bug 55879 --- .../mobile/src/controller/LongActions.jsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/spreadsheeteditor/mobile/src/controller/LongActions.jsx b/apps/spreadsheeteditor/mobile/src/controller/LongActions.jsx index fb7e66519..933429efb 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/LongActions.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/LongActions.jsx @@ -26,12 +26,17 @@ const LongActionsController = inject('storeAppOptions')(({storeAppOptions}) => { }; useEffect( () => { - Common.Notifications.on('engineCreated', (api) => { + const on_engine_created = api => { api.asc_registerCallback('asc_onStartAction', onLongActionBegin); api.asc_registerCallback('asc_onEndAction', onLongActionEnd); api.asc_registerCallback('asc_onOpenDocumentProgress', onOpenDocument); api.asc_registerCallback('asc_onConfirmAction', onConfirmAction); - }); + }; + + const api = Common.EditorApi.get(); + if(!api) Common.Notifications.on('engineCreated', on_engine_created); + else on_engine_created(api); + Common.Notifications.on('preloader:endAction', onLongActionEnd); Common.Notifications.on('preloader:beginAction', onLongActionBegin); Common.Notifications.on('preloader:close', closePreloader); @@ -45,6 +50,7 @@ const LongActionsController = inject('storeAppOptions')(({storeAppOptions}) => { api.asc_unregisterCallback('asc_onConfirmAction', onConfirmAction); } + Common.Notifications.off('engineCreated', on_engine_created); Common.Notifications.off('preloader:endAction', onLongActionEnd); Common.Notifications.off('preloader:beginAction', onLongActionBegin); Common.Notifications.off('preloader:close', closePreloader);