mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-31 04:02:26 +08:00
feat(tab): trigger note icons via theme variable
This commit is contained in:
parent
55e78f25ef
commit
a2f39c4f99
@ -244,6 +244,9 @@ export default class TabRowWidget extends BasicWidget {
|
|||||||
doRender() {
|
doRender() {
|
||||||
this.$widget = $(TAB_ROW_TPL);
|
this.$widget = $(TAB_ROW_TPL);
|
||||||
|
|
||||||
|
const documentStyle = window.getComputedStyle(document.documentElement);
|
||||||
|
this.showNoteIcons = (documentStyle.getPropertyValue("--tab-note-icons") === "true");
|
||||||
|
|
||||||
this.draggabillies = [];
|
this.draggabillies = [];
|
||||||
|
|
||||||
this.setupStyle();
|
this.setupStyle();
|
||||||
@ -667,11 +670,16 @@ export default class TabRowWidget extends BasicWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let noteIcon = "";
|
||||||
|
|
||||||
if (noteContext) {
|
if (noteContext) {
|
||||||
const hoistedNote = froca.getNoteFromCache(noteContext.hoistedNoteId);
|
const hoistedNote = froca.getNoteFromCache(noteContext.hoistedNoteId);
|
||||||
|
|
||||||
if (hoistedNote) {
|
if (hoistedNote) {
|
||||||
$tab.find('.note-tab-wrapper').css("background", hoistedNote.getWorkspaceTabBackgroundColor());
|
$tab.find('.note-tab-wrapper').css("background", hoistedNote.getWorkspaceTabBackgroundColor());
|
||||||
|
if (!this.showNoteIcons) {
|
||||||
|
noteIcon = hoistedNote.getWorkspaceIconClass();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$tab.find('.note-tab-wrapper').removeAttr("style");
|
$tab.find('.note-tab-wrapper').removeAttr("style");
|
||||||
@ -692,10 +700,16 @@ export default class TabRowWidget extends BasicWidget {
|
|||||||
$tab.addClass(utils.getNoteTypeClass(note.type));
|
$tab.addClass(utils.getNoteTypeClass(note.type));
|
||||||
$tab.addClass(utils.getMimeTypeClass(note.mime));
|
$tab.addClass(utils.getMimeTypeClass(note.mime));
|
||||||
|
|
||||||
|
if (this.showNoteIcons) {
|
||||||
|
noteIcon = note.getIcon();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (noteIcon) {
|
||||||
$tab.find('.note-tab-icon')
|
$tab.find('.note-tab-icon')
|
||||||
.removeClass()
|
.removeClass()
|
||||||
.addClass("note-tab-icon")
|
.addClass("note-tab-icon")
|
||||||
.addClass(note.getIcon());
|
.addClass(noteIcon);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async entitiesReloadedEvent({loadResults}) {
|
async entitiesReloadedEvent({loadResults}) {
|
||||||
|
@ -55,6 +55,9 @@
|
|||||||
--menu-item-icon-vert-offset: 0;
|
--menu-item-icon-vert-offset: 0;
|
||||||
|
|
||||||
--more-accented-background-color: var(--card-background-hover-color);
|
--more-accented-background-color: var(--card-background-hover-color);
|
||||||
|
|
||||||
|
/* Theme capabilities */
|
||||||
|
--tab-note-icons: true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user