Giter Site home page Giter Site logo

Comments (6)

Zachatoo avatar Zachatoo commented on September 17, 2024

Instead of a timeout I would recommend seeing if the hooks module resolves the issue for you. Try wrapping your editor changes in the on_all_templates_executed hook.

from templater.

luckman212 avatar luckman212 commented on September 17, 2024

Thanks @Zachatoo but I updated my code to use hooks, and still can't get it to work in 2.3.2. I updated the top post to point to a new version of the script that uses tp.hooks.on_all_templates_executed()

from templater.

tobyfb avatar tobyfb commented on September 17, 2024

I might have a problem related to this. All my templates that use regex are built with the following structure / logic:

<%*
// based on the following example: https://github.com/SilentVoid13/Templater/discussions/255; relevant for other
var content = tp.file.content;
content = content.replace(/updated:(.*)/g, "updated: " + tp.date.now("YYYY-MM-DDTHH:mm:ss"));
var file = app.workspace.activeLeaf.view.file; // *get current file*
app.vault.modify(file, content); // *replace content with new content*
%>

This stopped working for me with 2.3.2.

I see a flicker where content is replaced as expected and then after a split second, things revert. It would be great to know if this is a bug or intended behavior and how I might need to adjust all of my templater templates for this to work.

from templater.

FeralFlora avatar FeralFlora commented on September 17, 2024

frontmatter just flickers and gets replaced with the save content as before

I was able to reproduce a similar issue when using "Create new note from template" with a simple template that includes tp.hooks.on_all_templates_executed to add frontmatter: #1309 (comment)

After the template insertion fix in 2.3.2, template insertion works (surprise!), but the frontmatter disappears when using "create new note from template" with the same template.

from templater.

luckman212 avatar luckman212 commented on September 17, 2024

Not quite sure how, but I fixed my template and it's working with 2.3.2 now.

from templater.

Zachatoo avatar Zachatoo commented on September 17, 2024

Should be fixed in 2.3.3.

from templater.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.