mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
added workspace icon and background color
This commit is contained in:
parent
61f30373d4
commit
b9c0823abf
@ -265,10 +265,14 @@ class NoteShort {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getIcon(isFolder = false) {
|
getIcon(isFolder = false) {
|
||||||
const iconCassLabels = this.getLabels('iconClass');
|
const iconClassLabels = this.getLabels('iconClass');
|
||||||
|
const workspaceIconClass = this.getWorkspaceIconClass();
|
||||||
|
|
||||||
if (iconCassLabels.length > 0) {
|
if (iconClassLabels.length > 0) {
|
||||||
return iconCassLabels.map(l => l.value).join(' ');
|
return iconClassLabels.map(l => l.value).join(' ');
|
||||||
|
}
|
||||||
|
else if (workspaceIconClass) {
|
||||||
|
return workspaceIconClass;
|
||||||
}
|
}
|
||||||
else if (this.noteId === 'root') {
|
else if (this.noteId === 'root') {
|
||||||
return "bx bx-chevrons-right";
|
return "bx bx-chevrons-right";
|
||||||
@ -547,9 +551,14 @@ class NoteShort {
|
|||||||
return labels.map(l => l.value).join(' ');
|
return labels.map(l => l.value).join(' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
getHoistedCssClass() {
|
getWorkspaceIconClass() {
|
||||||
const labels = this.getLabels('hoistedCssClass');
|
const labels = this.getLabels('workspaceIconClass');
|
||||||
return labels.map(l => l.value).join(' ');
|
return labels.length > 0 ? labels[0].value : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
getWorkspaceTabBackgroundColor() {
|
||||||
|
const labels = this.getLabels('workspaceTabBackgroundColor');
|
||||||
|
return labels.length > 0 ? labels[0].value : "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ const TAB_SIZE_MINI = 48;
|
|||||||
const TAB_TPL = `
|
const TAB_TPL = `
|
||||||
<div class="note-tab">
|
<div class="note-tab">
|
||||||
<div class="note-tab-wrapper">
|
<div class="note-tab-wrapper">
|
||||||
|
<div class="note-tab-icon"></div>
|
||||||
<div class="note-tab-title"></div>
|
<div class="note-tab-title"></div>
|
||||||
<div class="note-tab-drag-handle"></div>
|
<div class="note-tab-drag-handle"></div>
|
||||||
<div class="note-tab-close" title="Close tab" data-trigger-command="closeActiveTab"><span>×</span></div>
|
<div class="note-tab-close" title="Close tab" data-trigger-command="closeActiveTab"><span>×</span></div>
|
||||||
@ -160,6 +161,12 @@ const TAB_ROW_TPL = `
|
|||||||
color: var(--muted-text-color);
|
color: var(--muted-text-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.note-tab-row .note-tab .note-tab-icon {
|
||||||
|
position: relative;
|
||||||
|
top: -1px;
|
||||||
|
padding-right: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
.note-tab-row .note-tab[is-small] .note-tab-title {
|
.note-tab-row .note-tab[is-small] .note-tab-title {
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
}
|
}
|
||||||
@ -624,7 +631,15 @@ export default class TabRowWidget extends BasicWidget {
|
|||||||
const hoistedNote = treeCache.getNoteFromCache(tabContext.hoistedNoteId);
|
const hoistedNote = treeCache.getNoteFromCache(tabContext.hoistedNoteId);
|
||||||
|
|
||||||
if (hoistedNote) {
|
if (hoistedNote) {
|
||||||
$tab.addClass(hoistedNote.getHoistedCssClass());
|
$tab.find('.note-tab-icon')
|
||||||
|
.removeClass()
|
||||||
|
.addClass("note-tab-icon")
|
||||||
|
.addClass(hoistedNote.getWorkspaceIconClass());
|
||||||
|
|
||||||
|
$tab.find('.note-tab-wrapper').css("background", hoistedNote.getWorkspaceTabBackgroundColor());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$tab.find('.note-tab-wrapper').removeAttr("style");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user