Skip to content

Build your personal knowledge base with Trilium Notes

client/quick edit dialog: make available the CSS variables with the custom color of the edited note

Adorian Dorana01fb3959957
diff --git a/apps/client/src/widgets/dialogs/popup_editor.ts b/apps/client/src/widgets/dialogs/popup_editor.ts
index 1deb584d93..9b4e70c321 100644
--- a/apps/client/src/widgets/dialogs/popup_editor.ts
+++ b/apps/client/src/widgets/dialogs/popup_editor.ts
@@ -57,17 +57,19 @@ const TPL = /*html*/`\
}
</style>
- <div class="modal-dialog modal-lg" role="document">
- <div class="modal-content">
- <div class="modal-header">
- <div class="modal-title">
- <!-- This is where the first child will be injected -->
+ <div class="quick-edit-dialog-wrapper">
+ <div class="modal-dialog modal-lg" role="document">
+ <div class="modal-content">
+ <div class="modal-header">
+ <div class="modal-title">
+ <!-- This is where the first child will be injected -->
+ </div>
+ <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
- <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
- </div>
- <div class="modal-body">
- <!-- This is where all but the first child will be injected. -->
+ <div class="modal-body">
+ <!-- This is where all but the first child will be injected. -->
+ </div>
</div>
</div>
</div>
@@ -79,6 +81,7 @@ export default class PopupEditorDialog extends Container<BasicWidget> {
private noteContext: NoteContext;
private $modalHeader!: JQuery<HTMLElement>;
private $modalBody!: JQuery<HTMLElement>;
+ private $wrapper!: JQuery<HTMLDivElement>;
constructor() {
super();
@@ -93,6 +96,7 @@ export default class PopupEditorDialog extends Container<BasicWidget> {
const $newWidget = $(TPL);
this.$modalHeader = $newWidget.find(".modal-title");
this.$modalBody = $newWidget.find(".modal-body");
+ this.$wrapper = $newWidget.find(".quick-edit-dialog-wrapper");
const children = this.$widget.children();
this.$modalHeader.append(children[0]);
@@ -112,6 +116,15 @@ export default class PopupEditorDialog extends Container<BasicWidget> {
}
});
+ const colorClass = this.noteContext.note?.getColorClass();
+ const wrapperElement = this.$wrapper.get(0)!;
+
+ if (colorClass) {
+ wrapperElement.className = "quick-edit-dialog-wrapper tinted-dialog " + colorClass;
+ } else {
+ wrapperElement.className = "quick-edit-dialog-wrapper";
+ }
+
const activeEl = document.activeElement;
if (activeEl && "blur" in activeEl) {
(activeEl as HTMLElement).blur();