Open MelodyDuplaix opened 1 month ago
I am not able to reproduce this on Obsidian 1.7.3 and Templater 2.7.2. Here is the root folder template I'm testing with. It is the only folder template I have in this vault.
# Heading
Content
Can you provide more details about your setup, such as if you have other folder templates, and the contents of the root folder template?
Templater already has a delay of 300ms, to account for core plugins such as Note Composer and community plugins such as Note Extractor. When I've adjusted this delay in the past, I've gotten bug reports saying that it broke other community plugins, so I would like to avoid adjusting that delay.
My root folder template is like this:
---
aliases:
nature:
tags:
jour: <% tp.date.now("YYYY-MM-DD") %>
---
And, yes I also have other folder templates but I don't think that has anything to do with the problem:
I also use the option in obsidian web clipper to not open the note (option "Save clipped note without opening it"). And, the bug isn't happen all the time, rather about once in 2.
Do you have a specific URL I can test with? And the Clipper template? I've tried dozens of times and haven't been able to reproduce.
For example, I just retested, and it was reproduced with this page: https://resources.arc.net/hc/en-us/articles/22513842649623-Arc-for-Windows-2023-2024-Release-Notes and this clipper template : article-clipper.json.
I still can't understand why the bug doesn't appear every time, but only at certain times. I also found another solution (with advanced uri and a global shortcut to replace a general folder template) to create new notes with a global template, so this bug bothers me less now. So it's not that important to me anymore. And I don't know if others have had this bug.
Tried with that site and template a dozen time, no dice. Maybe it's a Windows only bug, or some combination of plugins is causing the bug. I don't have a Windows 11 device to test with.
Regardless, I'll keep this open for a while to see if any devs can reproduce and have ideas for solutions around this.
I have the same issue on Windows 10... After the note is created, pressing CTRL-Z (undo) recovers the clipped text. It happens almost 100% of the time (just so that I don't say 100% of the time).
NOTE / EDIT: I'm on Obsidian 1.7.4.
I also found another solution (with advanced uri and a global shortcut to replace a general folder template) to create new notes with a global template, so this bug bothers me less now. So it's not that important to me anymore. And I don't know if others have had this bug.
What did you do to fix this?
I also found another solution (with advanced uri and a global shortcut to replace a general folder template) to create new notes with a global template, so this bug bothers me less now. So it's not that important to me anymore. And I don't know if others have had this bug.
What did you do to fix this?
I used an external software (power toys) to create a shortcut that open an advanced uri url, to create a file and apply the global template, and I remapped this shortcut to Ctrl Shift N. I realize however that he seemed to not really work lately. Moreover, it's still complex for what it bringsI realize however that he seemed to not really work lately. Moreover, it's still complex for what it brings.
But, I haven't tried again recently to put a global Template in templater and see if there is still the problem.
To check if it can come from an interaction between plugins, which other plugins do you use?
A quick way to tell if it's an interaction between plugins would be to create a new vault with just the Templater community plugin installed and enabled.
So, I tested again and for the moment I can no longer reproduce the problem whether in a test vault or in my personal vault.
To check if it can come from an interaction between plugins, which other plugins do you use?
With only Templater being enabled the same thing happens.
I guess it is the order of the operations and the time Templater takes to process things.
The new note is created with the contents already populated, but then the global template is triggered and apples the template which replaces all the contents of the note... This is why undo
always works.
A quick way to tell if it's an interaction between plugins would be to create a new vault with just the Templater community plugin installed and enabled.
I think it is how the Templater plugin applies the template. This also started happening with notes shared on mobile directly to Obsidian.
I don't clip things that much, so I can't say when it started. Sharing or clipping to existing files work without issues as it doesn't trigger Templater templates.
I'll just add that I'm seeing this on all my primary Apple devices (MacBook Air, iPhone, and iPad) as well, so it's not just Windows. I don't yet have any additional data points to add, though I'm planning to test it with a new, barebones vault with only Templater installed. My global template is pretty basic, so it's not a critical concern at the moment.
Plugin information
Describe the bug
Obsidian version 1.7.3 introduced a modification to the URI system, which is used by the Obsidian Web Clipper extension. The issue arises when there is a global template set in Templater's configuration, i.e., a folder template that applies to "/". When creating a note via a URI, such as with the Obsidian Web Clipper, there is usually content added—either directly from the URI or appended from the clipboard by Obsidian. I believe the content is not applied immediately, and there is a slight delay between the creation of the note and the insertion of the content. This causes a problem when using a global template with Templater because Templater tries to apply the global template to the empty note during this brief delay. As a result, approximately 50% of the time, when creating a note via the URI, the expected content is missing, and only the global template is applied.
Expected behavior
I would like the global template to be applied only if no content is inserted by Obsidian. I'm unsure how this could be achieved—perhaps by introducing a slight delay before applying the global template.