mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
switching notes and tabs now work for most widgets
This commit is contained in:
parent
493730dff6
commit
6d276582cb
@ -42,7 +42,7 @@ class Attributes extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
activeNoteChangedListener() {
|
||||
tabNoteSwitchedListener() {
|
||||
if (utils.isDesktop()) {
|
||||
this.refreshAttributes();
|
||||
} else {
|
||||
|
@ -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) {
|
||||
|
@ -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"));
|
||||
}
|
||||
|
||||
|
@ -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'];
|
||||
|
||||
|
@ -28,7 +28,7 @@ class LinkMapWidget extends StandardWidget {
|
||||
return [$showFullButton];
|
||||
}
|
||||
|
||||
async activeTabChanged() {
|
||||
async refresh() {
|
||||
this.$body.css('opacity', 0);
|
||||
this.$body.html(TPL);
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -403,7 +403,7 @@ export default class NoteTreeWidget extends TabAwareWidget {
|
||||
|
||||
collapseTreeListener() { this.collapseTree(); }
|
||||
|
||||
async activeTabChanged() {
|
||||
async refresh() {
|
||||
const oldActiveNode = this.getActiveNode();
|
||||
|
||||
if (oldActiveNode) {
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user