Can I color a note title in tree based on attribute? #2759
-
I'd like all notes in the tree that have a certain attribute to automatically have their title colored. I imagine a new CSS note with my desired colorization and attribute |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
You can apply an attribute to the whole subtree by making it inheritable: |
Beta Was this translation helpful? Give feedback.
-
Done, leaving it here for whoever is interested. SolutionWe need two notes, one will contain the desired CSS, the other the implementation. CSS NoteThis note of type span.fancytree-node.fixme .fancytree-title {
color: #C70039!important;
font-weight: bold;
background-color: #FFC300!important;
} ImplementationThis note of type api.runOnBackend(() => {
const myNotes = api.searchForNotes('#fixme');
for (var i = 0; i < myNotes.length; ++i) {
myNotes[i].setLabel('cssClass','fixme');
}
}); |
Beta Was this translation helpful? Give feedback.
Done, leaving it here for whoever is interested.
Solution
We need two notes, one will contain the desired CSS, the other the implementation.
CSS Note
This note of type
CSS
needs the label#appCss
, which makes the CSS code available for later use.Implementation
This note of type
JS frontend
needs the label#run=frontendStartup
, which makes it execute, well, on frontend startup.It searches for all notes having the label
#fixme
and usessetLabel()
which, in turn, creates#cssClass=fixme
in the note if it doesn't already exist. My first idea was ru…