Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin prompts for template selection when using Templater folder templates #13

Open
Pseudoscops opened this issue Aug 5, 2023 · 2 comments

Comments

@Pseudoscops
Copy link

Pseudoscops commented Aug 5, 2023

I really like this plugin and it has helped me to understand the basics of how Obsidian plugins work. I have never written or read any plugin before, so this is a great learning experience for me.

However, I have an issue with the plugin when I click on a link of tomorrow’s daily note that triggers Templater’s folder template and automatically applies a daily template. This plugin asks me what template I want to apply, which is redundant and annoying. I solved my problem by adding this code to shouldTriggerTemplatePrompt:

if (this.app.plugins.plugins["templater-obsidian"]) {
      let templater_folders = this.app.plugins.plugins["templater-obsidian"].settings["folder_templates"]
    
      for (let folder_info of templater_folders) {
        if (file.path.startsWith(folder_info["folder"]+"/")) {
          return false;
        }
      }
    }

I did not want to make a pull request without knowing if this is a feature that the author would like to have in the plugin, and without getting some feedback on the quality of the code. I am not sure if this is the best way to implement it, or if there is a more efficient way to do it (maybe by loading the list of Templater folder templates once when the plugin is initialized and then checking if the file path is in that list, or something like that). I would appreciate any comments or suggestions on how to improve it. Thank you for your time and attention.

@Jetsadaporn87
Copy link

Can you tell me how? It must be added to which file? Thank you.

@numeroflip
Copy link
Owner

@Jetsadaporn87 Do you still experience this problem? If so, would you kindly provide details about what's the expected behavior in your case, and what's actually happening?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants