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

Templater Hides Properties on Obsidian 1.5.0 #1253

Closed
Comprehensive-Jason opened this issue Nov 22, 2023 · 9 comments
Closed

Templater Hides Properties on Obsidian 1.5.0 #1253

Comprehensive-Jason opened this issue Nov 22, 2023 · 9 comments
Labels
bug Something isn't working

Comments

@Comprehensive-Jason
Copy link

The Desktop Catalyst release of Obsidian 1.5.0 messed with how Templater interacts with Obsidian properties, making them disappear after adding a template.

Plugin information (please complete the following information):

  • OS: Windows 11
  • Templater version: 1.18.1
  • Obsidian version: 1.5.0
  • Templater settings: fresh install, no settings changed

Describe the bug
After adding a template to a new note, the properties fail to appear in Live Preview Mode unless I close the note and open it again. Switching between Live Preview and Source Mode does not make properties appear in Live Preview.

Expected behavior
Properties should simply appear alongside the rest of the template I add.

Screenshots
ezgif com-video-to-gif (1)

Additional context
This problem was replicated in Sandbox. This issue does not happen with the Templates core plugin.

@Comprehensive-Jason Comprehensive-Jason added the bug Something isn't working label Nov 22, 2023
@FeralFlora
Copy link

Try pressing enter after inserting. I have line numbers enabled, and when I tested this behavior, I could see the line number change from line 1 to line 5, even though the cursor didn't move further down. If I press enter, the properties appear, without having to reopen. This might hold some clues as to how this can be resolved.

Obsidian_Ec13bZq38y

@I-Pch
Copy link

I-Pch commented Nov 24, 2023

I have one template where I'm getting similar results (live preview appears to not be refreshed/is not in sync with source mode unless you insert a newline after applying the template) but inconsistently 🤨 ...

I mean, using 2 different templates doing the same thing (erasing completely the content of a note, Properties included) relying on 2 different Obsidian API methods, I get 2 different results:

The first one relies on app.workspace.activeEditor.editor ... and for that one, I can also see the template working as expected, underneath, as like in FeralFlora's screen recording, the line number is refreshed (going from the initial line number 12 to 1) but then I need to add a newline to effectively have live preview displaying the same result as in Source mode.

Here's a screen-recording illustrating that 😇 : Left side is the Testing note opened in Source and the right side is LP 😊 .

Testing.-.Source.vs.LP.mov

On the other hand, a template relying on app.vault.process ... doesn't display such behavior 🤷‍♀️ ... I.e.: no newline needed and both source and LP are in sync (displaying the same content) ...

Testing.-.Source.vs.LP.2.mov

I'm just mentioning this in case it could help 😇 ... as in both cases, 99% of the template uses Obsidian API only and I just thought this could potentially give some hint as to where the issue might be 😊 ...

@jcrum
Copy link

jcrum commented Nov 28, 2023

I am experiencing the same thing on some of my templates but I noticed the templates that are working make use of the tp.file.cursor, tp.file.move, or custom scripts. Attached is a video that shows how adding tp.file.cursor will trigger the properties to be shown.

ObsidianTemplaterBug1253.mov

@I-Pch
Copy link

I-Pch commented Nov 28, 2023

tp.file.cursor

Can confirm for that one at least 😊 ...

I used a template adding properties to a note with a tp.file.cursor() somewhere in it and didn't encountered the issue 🤷‍♀️ ...
I mean, there didn't seem to have any delay between Source/Live Preview, everything was rendered at once and my cursor was placed where wanted...

I can only guess that tp.file.cursor() somewhat replace manually adding a newline (while setting the focus on the specific note in Live Preview) ?

@Zachatoo
Copy link
Collaborator

Zachatoo commented Dec 1, 2023

Should be resolved in 1.18.2!

@Zachatoo Zachatoo closed this as completed Dec 1, 2023
@SedesGobhani
Copy link

With Templater 2.1.3 to avoid this behavior I needed to include this cursor command (as above) and enable option "Automatic jump to cursor".

@Comprehensive-Jason
Copy link
Author

Comprehensive-Jason commented Feb 8, 2024

As @SedesGobhani said, the problem is back in version 2.1.3.

@Zachatoo
Copy link
Collaborator

Zachatoo commented Feb 8, 2024

Thanks, I'll add some tests so I don't accidentally break this again in the future.

@Zachatoo Zachatoo reopened this Feb 8, 2024
Zachatoo added a commit that referenced this issue Feb 10, 2024
…ntmatter after creation and tests for properties showing in live preview on insert of template with frontmatter

refs: #1253, #1309
@Zachatoo
Copy link
Collaborator

I believe this has been fixed again in 2.1.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants