From 2ff9f8537f29f138e63e38a609dafd833eee0892 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 23 Jun 2022 22:12:36 +0300 Subject: [PATCH] Refactoring navigation panel --- apps/documenteditor/main/app/controller/Navigation.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/documenteditor/main/app/controller/Navigation.js b/apps/documenteditor/main/app/controller/Navigation.js index 31daa23b5..6eb7b8105 100644 --- a/apps/documenteditor/main/app/controller/Navigation.js +++ b/apps/documenteditor/main/app/controller/Navigation.js @@ -57,10 +57,7 @@ define([ 'Navigation': { 'show': function() { if (!this.canUseViwerNavigation) { - var obj = me.api.asc_ShowDocumentOutline(); - if (!me._navigationObject) - me._navigationObject = obj; - me.updateNavigation(); + me.api.asc_ShowDocumentOutline(); } else { if (me.panelNavigation && me.panelNavigation.viewNavigationList && me.panelNavigation.viewNavigationList.scroller) me.panelNavigation.viewNavigationList.scroller.update({alwaysVisibleY: true}); @@ -131,6 +128,9 @@ define([ }, updateNavigation: function() { + if (!this._navigationObject) + this._navigationObject = this.api.asc_GetDocumentOutlineManager(); + if (!this._navigationObject) return; var count = this._navigationObject.get_ElementsCount(), @@ -168,6 +168,9 @@ define([ }, updateChangeNavigation: function(index) { + if (!this._navigationObject) + this._navigationObject = this.api.asc_GetDocumentOutlineManager(); + if (!this._navigationObject) return; var item = this.getApplication().getCollection('Navigation').at(index);