switching notes and tabs now work for most widgets

This commit is contained in:
zadam 2020-01-18 20:49:49 +01:00
parent 493730dff6
commit 6d276582cb
11 changed files with 14 additions and 14 deletions

View File

@ -42,7 +42,7 @@ class Attributes extends Component {
}
}
activeNoteChangedListener() {
tabNoteSwitchedListener() {
if (utils.isDesktop()) {
this.refreshAttributes();
} else {

View File

@ -23,8 +23,8 @@ class AttributesWidget extends StandardWidget {
return [$showFullButton];
}
async activeTabChanged() {
const attributes = await this.tabContext.attributes.getAttributes();
async refresh() {
const attributes = await this.tabContext.attributes.getAttributes();console.log("attributes", attributes);
const ownedAttributes = attributes.filter(attr => attr.noteId === this.tabContext.note.noteId);
if (attributes.length === 0) {

View File

@ -38,7 +38,7 @@ class CalendarWidget extends StandardWidget {
this.$body.html(TPL);
}
async activeTabChanged() {
async refresh() {
this.init(this.$body, await this.tabContext.note.getLabelValue("dateNote"));
}

View File

@ -11,7 +11,7 @@ export default class Component {
async eventReceived(name, data) {
await this.initialized;
console.log(`Received ${name} to ${this.componentId}`);
// console.log(`Received ${name} to ${this.componentId}`);
const fun = this[name + 'Listener'];

View File

@ -28,7 +28,7 @@ class LinkMapWidget extends StandardWidget {
return [$showFullButton];
}
async activeTabChanged() {
async refresh() {
this.$body.css('opacity', 0);
this.$body.html(TPL);

View File

@ -31,7 +31,7 @@ class NoteInfoWidget extends StandardWidget {
this.$body.html(TPL);
}
activeTabChanged() {
refresh() {
const $noteId = this.$body.find(".note-info-note-id");
const $dateCreated = this.$body.find(".note-info-date-created");
const $dateModified = this.$body.find(".note-info-date-modified");
@ -58,7 +58,7 @@ class NoteInfoWidget extends StandardWidget {
syncDataListener({data}) {
if (data.find(sd => sd.entityName === 'notes' && sd.entityId === this.tabContext.note.noteId)) {
this.activeTabChanged();
this.refresh();
}
}
}

View File

@ -26,7 +26,7 @@ class NoteRevisionsWidget extends StandardWidget {
return [$showFullButton];
}
async activeTabChanged() {
async refresh() {
const note = this.tabContext.note;
const revisionItems = await server.get(`notes/${note.noteId}/revisions`);
@ -57,7 +57,7 @@ class NoteRevisionsWidget extends StandardWidget {
syncDataListener({data}) {
if (data.find(sd => sd.entityName === 'note_revisions' && sd.noteId === this.tabContext.note.noteId)) {
this.activeTabChanged();
this.refresh();
}
}
}

View File

@ -403,7 +403,7 @@ export default class NoteTreeWidget extends TabAwareWidget {
collapseTreeListener() { this.collapseTree(); }
async activeTabChanged() {
async refresh() {
const oldActiveNode = this.getActiveNode();
if (oldActiveNode) {

View File

@ -35,7 +35,7 @@ export default class PromotedAttributesWidget extends TabAwareWidget {
return this.$widget;
}
async activeTabChanged() {
async refresh() {
this.$container.empty();
const attributes = await this.tabContext.attributes.getAttributes();

View File

@ -14,7 +14,7 @@ class SimilarNotesWidget extends StandardWidget {
getMaxHeight() { return "200px"; }
async activeTabChanged() {
async refresh() {
// remember which title was when we found the similar notes
this.title = this.tabContext.note.title;

View File

@ -22,7 +22,7 @@ class WhatLinksHereWidget extends StandardWidget {
return [$showFullButton];
}
async activeTabChanged() {
async refresh() {
const targetRelations = await this.tabContext.note.getTargetRelations();
if (targetRelations.length === 0) {