[DE] Fix Bug 55281

This commit is contained in:
ShimaginAndrey 2022-02-03 15:56:38 +03:00
parent 210399a1ff
commit 9f185109b8

View file

@ -25,11 +25,16 @@ const LongActionsController = inject('storeAppOptions')(({storeAppOptions}) => {
}; };
useEffect( () => { useEffect( () => {
Common.Notifications.on('engineCreated', (api) => { const on_engine_created = api => {
api.asc_registerCallback('asc_onStartAction', onLongActionBegin); api.asc_registerCallback('asc_onStartAction', onLongActionBegin);
api.asc_registerCallback('asc_onEndAction', onLongActionEnd); api.asc_registerCallback('asc_onEndAction', onLongActionEnd);
api.asc_registerCallback('asc_onOpenDocumentProgress', onOpenDocument); api.asc_registerCallback('asc_onOpenDocumentProgress', onOpenDocument);
}); };
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:endAction', onLongActionEnd);
Common.Notifications.on('preloader:beginAction', onLongActionBegin); Common.Notifications.on('preloader:beginAction', onLongActionBegin);
Common.Notifications.on('preloader:close', closePreloader); Common.Notifications.on('preloader:close', closePreloader);
@ -42,6 +47,7 @@ const LongActionsController = inject('storeAppOptions')(({storeAppOptions}) => {
api.asc_unregisterCallback('asc_onOpenDocumentProgress', onOpenDocument); api.asc_unregisterCallback('asc_onOpenDocumentProgress', onOpenDocument);
} }
Common.Notifications.off('engineCreated', on_engine_created);
Common.Notifications.off('preloader:endAction', onLongActionEnd); Common.Notifications.off('preloader:endAction', onLongActionEnd);
Common.Notifications.off('preloader:beginAction', onLongActionBegin); Common.Notifications.off('preloader:beginAction', onLongActionBegin);
Common.Notifications.off('preloader:close', closePreloader); Common.Notifications.off('preloader:close', closePreloader);