From 6363d01faf41a66983a038d78a42104f522a535f Mon Sep 17 00:00:00 2001 From: Jamie Cope Date: Thu, 25 Aug 2022 12:28:22 -0400 Subject: [PATCH] Bug fix for article reader in tours --- source/client/applications/ExplorerApplication.ts | 9 ++++++++- source/client/components/CVReader.ts | 4 ---- source/client/ui/explorer/MainMenu.ts | 7 ++++++- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/source/client/applications/ExplorerApplication.ts b/source/client/applications/ExplorerApplication.ts index e3a403ff..0ea7f3f1 100755 --- a/source/client/applications/ExplorerApplication.ts +++ b/source/client/applications/ExplorerApplication.ts @@ -397,9 +397,16 @@ Version: ${ENV_VERSION} toggleReader() { - const readerIns = this.system.getMainComponent(CVDocumentProvider).activeComponent.setup.reader.ins; + const reader = this.system.getMainComponent(CVDocumentProvider).activeComponent.setup.reader; + const readerIns = reader.ins; readerIns.enabled.setValue(!readerIns.enabled.value); + readerIns.focus.setValue(readerIns.enabled.value); + + if(readerIns.enabled.value) { + readerIns.articleId.setValue(reader.articles.length === 1 ? reader.articles[0].article.id : ""); + } + this.analytics.sendProperty("Reader.Enabled", readerIns.enabled.value); } diff --git a/source/client/components/CVReader.ts b/source/client/components/CVReader.ts index 9bf1e92b..77d57000 100644 --- a/source/client/components/CVReader.ts +++ b/source/client/components/CVReader.ts @@ -127,10 +127,6 @@ export default class CVReader extends Component if (ins.enabled.changed) { //this.analytics.sendProperty("Reader.Enabled", ins.enabled.value); - - if(ins.enabled.value) { - ins.articleId.setValue(this.articles.length === 1 ? this.articles[0].article.id : ""); - } } if (ins.articleId.changed) { const entry = this._articles[ins.articleId.value] || null; diff --git a/source/client/ui/explorer/MainMenu.ts b/source/client/ui/explorer/MainMenu.ts index 66bfe1f5..fef690c7 100644 --- a/source/client/ui/explorer/MainMenu.ts +++ b/source/client/ui/explorer/MainMenu.ts @@ -154,10 +154,15 @@ export default class MainMenu extends DocumentView protected onToggleReader() { - const readerIns = this.activeDocument.setup.reader.ins; + const reader = this.activeDocument.setup.reader; + const readerIns = reader.ins; readerIns.enabled.setValue(!readerIns.enabled.value); readerIns.focus.setValue(readerIns.enabled.value); + if(readerIns.enabled.value) { + readerIns.articleId.setValue(reader.articles.length === 1 ? reader.articles[0].article.id : ""); + } + this.analytics.sendProperty("Reader.Enabled", readerIns.enabled.value); }