Skip to content

Build your personal knowledge base with Trilium Notes

tab row is detecting workspace changes

zadamcd5be594135d
diff --git a/src/public/app/services/load_results.js b/src/public/app/services/load_results.js
index 359dbc31c2..a75cae9fff 100644
--- a/src/public/app/services/load_results.js
+++ b/src/public/app/services/load_results.js
@@ -54,6 +54,7 @@ export default class LoadResults {
this.attributes.push({attributeId, sourceId});
}
+ /** @return {Attribute[]} */
getAttributes(sourceId = 'none') {
return this.attributes
.filter(row => row.sourceId !== sourceId)
diff --git a/src/public/app/widgets/note_tree.js b/src/public/app/widgets/note_tree.js
index e10d233975..0f534487f0 100644
--- a/src/public/app/widgets/note_tree.js
+++ b/src/public/app/widgets/note_tree.js
@@ -515,7 +515,9 @@ export default class NoteTreeWidget extends TabAwareWidget {
$span.find('.tree-item-button').remove();
- if (activeTabContext && activeTabContext.hoistedNoteId === note.noteId && note.noteId !== 'root') {
+ const isHoistedNote = activeTabContext && activeTabContext.hoistedNoteId === note.noteId && note.noteId !== 'root';
+
+ if (isHoistedNote) {
const $unhoistButton = $('<span class="tree-item-button unhoist-button bx bx-door-open" title="Unhoist"></span>');
$unhoistButton.on('click', () => alert("bebe"));
@@ -523,7 +525,7 @@ export default class NoteTreeWidget extends TabAwareWidget {
$span.append($unhoistButton);
}
- if (note.hasLabel('workspace')) {
+ if (note.hasLabel('workspace') && !isHoistedNote) {
const $enterWorkspaceButton = $('<span class="tree-item-button enter-workspace-button bx bx-door-open" title="Hoist this note (workspace)"></span>');
$span.append($enterWorkspaceButton);
diff --git a/src/public/app/widgets/quick_search.js b/src/public/app/widgets/quick_search.js
index 8860c3ba57..48740293f4 100644
--- a/src/public/app/widgets/quick_search.js
+++ b/src/public/app/widgets/quick_search.js
@@ -10,8 +10,8 @@ const TPL = `
<div class="quick-search input-group input-group-sm" style="width: 250px;">
<style>
.quick-search {
- margin-left: 10px;
- margin-right: 10px;
+ margin-left: 5px;
+ margin-right: 5px;
}
.quick-search .dropdown-menu {
diff --git a/src/public/app/widgets/tab_row.js b/src/public/app/widgets/tab_row.js
index e853513b1d..1991125a4a 100644
--- a/src/public/app/widgets/tab_row.js
+++ b/src/public/app/widgets/tab_row.js
@@ -657,7 +657,15 @@ export default class TabRowWidget extends BasicWidget {
async entitiesReloadedEvent({loadResults}) {
for (const tabContext of appContext.tabManager.tabContexts) {
- if (loadResults.isNoteReloaded(tabContext.noteId)) {
+ if (!tabContext.noteId) {
+ continue;
+ }
+
+ if (loadResults.isNoteReloaded(tabContext.noteId) ||
+ loadResults.getAttributes().find(attr =>
+ ['workspace', 'workspaceIconClass', 'workspaceTabBackgroundColor'].includes(attr.name)
+ && attr.isAffecting(tabContext.note))
+ ) {
const $tab = this.getTabById(tabContext.tabId);
this.updateTab($tab, tabContext.note);