diff --git a/www/common/onlyoffice/inner.js b/www/common/onlyoffice/inner.js index dd085a9dc..5684a1dd8 100644 --- a/www/common/onlyoffice/inner.js +++ b/www/common/onlyoffice/inner.js @@ -506,6 +506,19 @@ define([ } myUniqueOOId = undefined; setMyId(); + var editor = getEditor(); + if (editor) { + var app = common.getMetadataMgr().getPrivateData().ooType; + var d; + if (app === 'doc') { + d = editor.GetDocument().Document; + } else if (app === 'presentation') { + d = editor.GetPresentation().Presentation; + } + if (d) { + APP.oldCursor = d.GetSelectionState(); + } + } if (APP.docEditor) { APP.docEditor.destroyEditor(); } // Kill the old editor $('iframe[name="frameEditor"]').after(h('div#cp-app-oo-placeholder-a')).remove(); ooLoaded = false; @@ -1713,6 +1726,21 @@ define([ var l = w.Common.util.LanguageInfo.getLocalLanguageCode(lang); getEditor().asc_setDefaultLanguage(l); } + + if (APP.oldCursor) { + var app = common.getMetadataMgr().getPrivateData().ooType; + var d; + if (app === 'doc') { + d = getEditor().GetDocument().Document; + } else if (app === 'presentation') { + d = getEditor().GetPresentation().Presentation; + } + if (d) { + d.SetSelectionState(APP.oldCursor); + d.UpdateSelection(); + } + delete APP.oldCursor; + } } delete APP.startNew;