mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
tab row is detecting workspace changes
This commit is contained in:
parent
2a67d9eae2
commit
cd5be59413
@ -54,6 +54,7 @@ export default class LoadResults {
|
|||||||
this.attributes.push({attributeId, sourceId});
|
this.attributes.push({attributeId, sourceId});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @return {Attribute[]} */
|
||||||
getAttributes(sourceId = 'none') {
|
getAttributes(sourceId = 'none') {
|
||||||
return this.attributes
|
return this.attributes
|
||||||
.filter(row => row.sourceId !== sourceId)
|
.filter(row => row.sourceId !== sourceId)
|
||||||
|
@ -515,7 +515,9 @@ export default class NoteTreeWidget extends TabAwareWidget {
|
|||||||
|
|
||||||
$span.find('.tree-item-button').remove();
|
$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>');
|
const $unhoistButton = $('<span class="tree-item-button unhoist-button bx bx-door-open" title="Unhoist"></span>');
|
||||||
|
|
||||||
$unhoistButton.on('click', () => alert("bebe"));
|
$unhoistButton.on('click', () => alert("bebe"));
|
||||||
@ -523,7 +525,7 @@ export default class NoteTreeWidget extends TabAwareWidget {
|
|||||||
$span.append($unhoistButton);
|
$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>');
|
const $enterWorkspaceButton = $('<span class="tree-item-button enter-workspace-button bx bx-door-open" title="Hoist this note (workspace)"></span>');
|
||||||
|
|
||||||
$span.append($enterWorkspaceButton);
|
$span.append($enterWorkspaceButton);
|
||||||
|
@ -10,8 +10,8 @@ const TPL = `
|
|||||||
<div class="quick-search input-group input-group-sm" style="width: 250px;">
|
<div class="quick-search input-group input-group-sm" style="width: 250px;">
|
||||||
<style>
|
<style>
|
||||||
.quick-search {
|
.quick-search {
|
||||||
margin-left: 10px;
|
margin-left: 5px;
|
||||||
margin-right: 10px;
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.quick-search .dropdown-menu {
|
.quick-search .dropdown-menu {
|
||||||
|
@ -657,7 +657,15 @@ export default class TabRowWidget extends BasicWidget {
|
|||||||
|
|
||||||
async entitiesReloadedEvent({loadResults}) {
|
async entitiesReloadedEvent({loadResults}) {
|
||||||
for (const tabContext of appContext.tabManager.tabContexts) {
|
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);
|
const $tab = this.getTabById(tabContext.tabId);
|
||||||
|
|
||||||
this.updateTab($tab, tabContext.note);
|
this.updateTab($tab, tabContext.note);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user