From f69cc6f1b103b4b8c69f055a478f2834313e51f9 Mon Sep 17 00:00:00 2001 From: Book Pauk Date: Tue, 3 Nov 2020 23:04:06 +0700 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=20=D0=BD?= =?UTF-8?q?=D0=B0=D0=B4=20BookmarkSettings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BookmarkSettings/BookmarkSettings.vue | 24 ++++++++++++++++--- .../components/ExternalLibs/ExternalLibs.vue | 12 ++++++++-- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/client/components/ExternalLibs/BookmarkSettings/BookmarkSettings.vue b/client/components/ExternalLibs/BookmarkSettings/BookmarkSettings.vue index 90ca0dc6..1eeb6f3d 100644 --- a/client/components/ExternalLibs/BookmarkSettings/BookmarkSettings.vue +++ b/client/components/ExternalLibs/BookmarkSettings/BookmarkSettings.vue @@ -103,11 +103,14 @@ class BookmarkSettings extends BookmarkSettingsProps { get nodes() { const result = []; - this.expanded = []; + const expanded = []; + this.links = {}; let i = 0; this.libs.groups.forEach(group => { const rkey = `${i}`; const g = {label: group.r, key: rkey, children: []}; + this.links[rkey] = group.r; + let j = 0; group.list.forEach(link => { const key = `${i}-${j}`; @@ -115,8 +118,10 @@ class BookmarkSettings extends BookmarkSettingsProps { label: (link.c ? link.c + ' ': '') + lu.removeOrigin(link.l), key }); - if (link.l == this.libs.startLink && this.expanded.indexOf(rkey) < 0) { - this.expanded.push(rkey); + + this.links[key] = link.l; + if (link.l == this.libs.startLink && expanded.indexOf(rkey) < 0) { + expanded.push(rkey); } j++; @@ -126,6 +131,10 @@ class BookmarkSettings extends BookmarkSettingsProps { i++; }); + this.$nextTick(() => { + this.expanded = expanded; + }); + return result; } @@ -135,6 +144,15 @@ class BookmarkSettings extends BookmarkSettingsProps { } openSelected() { + if (!this.selected) + return; + if (this.selected.indexOf('-') < 0) {//rootLink + this.$emit('do-action', {action: 'setRootLink', data: this.links[this.selected]}); + } else {//selectedLink + this.$emit('do-action', {action: 'setSelectedLink', data: this.links[this.selected]}); + } + + //this.close(); } openOptions() { diff --git a/client/components/ExternalLibs/ExternalLibs.vue b/client/components/ExternalLibs/ExternalLibs.vue index 2439aaf5..463aa6a1 100644 --- a/client/components/ExternalLibs/ExternalLibs.vue +++ b/client/components/ExternalLibs/ExternalLibs.vue @@ -47,7 +47,7 @@ Вернуться на стартовую страницу - + Загрузить URL во фрейм @@ -97,7 +97,7 @@ - + @@ -292,6 +292,14 @@ class ExternalLibs extends Vue { this.updateSelectedLink(); } + doAction(event) { + switch (event.action) { + case 'setLibs': this.commitLibs(event.data); break; + case 'setRootLink': this.rootLink = event.data; this.rootLinkInput(); break; + case 'setSelectedLink': this.selectedLink = event.data; this.selectedLinkInput(); break; + } + } + get mode() { return this.$store.state.config.mode; }