55 */
66'use strict' ;
77
8- define ( [ 'knockout' , 'utils/modeledit/navigation/all-navigation ' , 'utils/modelEdit/model-edit-helper ' ,
9- 'utils/modelEdit/alias- helper' , 'utils/modelEdit/meta -helper' , 'utils/modelEdit/message -helper' ,
10- 'ojs/ojarraytreedataprovider' ] ,
11- function ( ko , allNavigation , ModelEditHelper , AliasHelper , MetaHelper , MessageHelper , ArrayTreeDataProvider ) {
8+ define ( [ 'knockout' , 'models/wkt-project ' , 'utils/modeledit/navigation/all-navigation ' ,
9+ 'utils/modelEdit/model-edit- helper' , 'utils/modelEdit/alias -helper' , 'utils/modelEdit/meta -helper' ,
10+ 'utils/modelEdit/message-helper' , ' ojs/ojarraytreedataprovider'] ,
11+ function ( ko , WktProject , allNavigation , ModelEditHelper , AliasHelper , MetaHelper , MessageHelper , ArrayTreeDataProvider ) {
1212
1313 function NavigationHelper ( ) {
1414 // maintain and update the navigation state
@@ -44,10 +44,14 @@ function (ko, allNavigation, ModelEditHelper, AliasHelper, MetaHelper, MessageHe
4444 ModelEditHelper . modelObject . subscribe ( this . updateFromModel ) ;
4545
4646 if ( ! this . menuKey ( ) ) { // if no previous selection, select first nav entry
47- const firstNavEntry = allNavigation [ 0 ] ;
48- this . navigateToElement ( firstNavEntry . modelPath ) . then ( ) ;
47+ this . selectDefault ( ) ;
4948 }
5049
50+ // if a new project is loaded, go to default menu item
51+ WktProject . postOpen . subscribe ( ( ) => {
52+ this . selectDefault ( ) ;
53+ } ) ;
54+
5155 initialized = true ;
5256 } ;
5357
@@ -56,6 +60,11 @@ function (ko, allNavigation, ModelEditHelper, AliasHelper, MetaHelper, MessageHe
5660 this . initialize ( ) ;
5761 } ) ;
5862
63+ this . selectDefault = ( ) => {
64+ const firstNavEntry = allNavigation [ 0 ] ;
65+ this . navigateToElement ( firstNavEntry . modelPath ) . then ( ) ;
66+ } ;
67+
5968 // set the content path when menu selection changes
6069 this . menuItemSelected = ( ) => {
6170 const menuKey = this . menuKey ( ) ;
0 commit comments