Skip to content

Commit

Permalink
Bug fix for article reader in tours
Browse files Browse the repository at this point in the history
  • Loading branch information
gjcope committed Aug 25, 2022
1 parent 0ee329e commit 6363d01
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
9 changes: 8 additions & 1 deletion source/client/applications/ExplorerApplication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
4 changes: 0 additions & 4 deletions source/client/components/CVReader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 6 additions & 1 deletion source/client/ui/explorer/MainMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 6363d01

Please sign in to comment.