diff options
| author | Terry Truong <terry06890@gmail.com> | 2022-07-06 17:04:57 +1000 |
|---|---|---|
| committer | Terry Truong <terry06890@gmail.com> | 2022-07-06 17:04:57 +1000 |
| commit | 7e67af7003ece713d7823fa7d6b32749516d508a (patch) | |
| tree | 992b567a39986351312585ccb8eabf0034c146d1 /src/App.vue | |
| parent | d554c2ffc79dccc366626270760a73a7cf6772aa (diff) | |
Add link-to-node functionality
Diffstat (limited to 'src/App.vue')
| -rw-r--r-- | src/App.vue | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/App.vue b/src/App.vue index df2b9b7..cd38621 100644 --- a/src/App.vue +++ b/src/App.vue @@ -889,8 +889,13 @@ export default defineComponent({ }, // For initialisation async initTreeFromServer(firstInit = true){ + // Get possible target node from URL + let nodeName = (new URL(window.location.href)).searchParams.get('node'); // Query server let urlParams = 'type=node'; + if (nodeName != null){ + urlParams += '&name=' + encodeURIComponent(nodeName) + '&toroot=true'; + } urlParams += '&tree=' + this.uiOpts.tree; let responseObj: {[x: string]: TolNode} = await this.loadFromServer(urlParams); if (responseObj == null){ @@ -915,14 +920,21 @@ export default defineComponent({ this.layoutTree = initLayoutTree(this.tolMap, rootName, 0); this.activeRoot = this.layoutTree; this.layoutMap = initLayoutMap(this.layoutTree); - // Relayout - await this.updateAreaDims(); - this.relayoutWithCollapse(false); // Skip initial transition if (firstInit){ this.justInitialised = true; setTimeout(() => {this.justInitialised = false}, this.uiOpts.transitionDuration); } + // Relayout + await this.updateAreaDims(); + this.relayoutWithCollapse(false); + // Possibly jump to a target node + if (nodeName != null){ + let oldSetting = this.uiOpts.searchJumpMode; + this.uiOpts.searchJumpMode = true; + await this.onSearch(nodeName); + this.uiOpts.searchJumpMode = oldSetting; + } }, async reInit(){ if (this.activeRoot != this.layoutTree){ |
