Templater
Templater copied to clipboard
Using Create New Note From Template in the File Explorer created the note in the left pane
Plugin information (please complete the following information):
- OS: Windows 10
- Templater version: 1.12.0
- Obsidian version: 0.15.2
- Templater settings:
- Template folder location: "Templates/",
- Syntax highlighting: enabled
- Automtic jump to cursor: disabled
- Trigger Templater on New File Creation: disabled
Describe the bug I have template to create a note to store account information.
When I used it via the Create New Note From Template context menu in the File Explorer, the note was created in the left panel.
Expected behavior Expected the new note to be placed in the active editor pane.
Screenshots If applicable, add screenshots to help explain your problem.
Additional context Add any other context about the problem here.
Please see #670. The code snippet below seemed to work if added at the end of your template:
<%*
if (this.app.workspace.activeLeaf.getViewState()?.type =="file-explorer") {
this.app.workspace.setActiveLeaf(this.app.workspace.getMostRecentLeaf())
}
%>
Demo and explanation
![demo](https://i.imgur.com/jJxLeIR.gif)
If the current active leaf == the left file explorer pane, switch the focus to the most recent leaf.
Hope that helps.
~welp
I have the same problem!
The script doesent work for me and it keeps opening on top of the File explorer
@diale13 can you tell me exactly what steps you took that ended up with this problem? Is it the same steps as the op? (i.e., focus is on the file explorer, and then Templater: create new note is executed) And what os are you using?
Also, what is the template you are using? Can you try adding the above script at the start of your template and see what happens? Thanks
Yes sure, sorry i took a while to respond.
OS: Windows 10 Templater version: 1.12.0 Obsidian version: 0.15.8
Templater settings: Template folder location: "📜Templates/", Syntax highlighting: disabled Automtic jump to cursor: disabled Trigger Templater on New File Creation: disabled
Describe the bug
Process:
After template gets created home bar gets replaced by the template. Only way to restore home side bar is to close Obsidian.
When I used it via the Create New Note From Template context menu in the File Explorer, the note was created in the left panel.
Expected behavior Expected the new note to be placed in the active editor pane.
Thanks
Is #691 related?
@diale13 until this issue is resolved, please just add this script to the end of your template
<%*
if (this.app.workspace.activeLeaf.getViewState()?.type =="file-explorer") {
this.app.workspace.setActiveLeaf(this.app.workspace.getMostRecentLeaf())
}
%>
The alternative to completely closing obsidian is to just Reload
from command palate or F5 from console.