You can pass in `initialValue` as an argument for ...
# questions
h
You can pass in
initialValue
as an argument for the custom keybinding. What you pass in can't be dynamically resolved though. (it has to be a string.) https://wiki.dendron.so/notes/ad270a7d-2aed-4273-8319-eb6536e38b29/#initialvalue
m
I hope you don't mind, I had a quick follow-up and decided to create this thread.
Can
initialValue
take on dynamic values? I am trying something like
proj.xxx.meet.yyyy.mm.dd
.
In other words, can I automatically fill the the year, month and day?
I can't seem to find this info on the docs.
h
What you pass in can't be dynamically resolved.
It has to be a string.
m
I see, but how does the "Create Journal Note" do it? Perhaps I can try it that way?
It seems to always prefill the current date.
h
It's because we specifically have that logic for journal modifiers (https://wiki.dendron.so/notes/ad270a7d-2aed-4273-8319-eb6536e38b29/#journal) If your use case is limited to creating journal-like notes with dates prefilled, you could look at
defaultJournalAddBehavior
(https://wiki.dendron.so/notes/5c213aa6-e4ba-49e8-85c5-1bdcb33ce202/#defaultnodetypeaddbehavior) and set it to add journals under a specific namespace. But the limitation here is that all journal notes will follow that configuration.
A more general solution would be a new feature where you could pass in a template string that could be used like variable substitution in note bodies. Feel free to create a feature request for this 🙂
m
I think you provided enough helpful information to know how to go about this. I am now taking a look at
default{NodeType}AddBehavior
which might be what I was looking for. If not, I will open an issue with a feature request. Thanks a lot for your time!
h
Glad to be of help 👍🏻
k
you can define a custom note trait to create dynamic titles using javascript -> https://wiki.dendron.so/notes/bdZhT3nF8Yz3WDzKp7hqh.html
h
Note that currently we only support two hooks
OnWillCreate
and
OnCreate
, and I believe @User is planning to create an issue for supporting more hooks beyond creation.
m
Note traits to the rescue! I'm trying it now.
That's great to hear!
k
please let us know if this solution works out for you. @User for visibility ☝️ (did the implementation)
m
Will do!
It does what I am after and, at first glance, it seems intuitive. Now, is it possible to assign a keybinding for creating a node with this trait id without having to use the command palette?
I am thinking something like this.
k
don't think we support that today, mind adding a feature request?
m
Will open an issue soon!
2 Views