tab row is detecting workspace changes

This commit is contained in:
zadam 2021-02-07 20:55:49 +01:00
parent 2a67d9eae2
commit cd5be59413
4 changed files with 16 additions and 5 deletions

View File

@ -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)

View File

@ -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);

View File

@ -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 {

View File

@ -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);