weather-fetcher icon indicating copy to clipboard operation
weather-fetcher copied to clipboard

Templater usage issue

Open symph0nic opened this issue 3 years ago • 4 comments

Hello! Firstly let me say that this is awesome.

Secondly, I'm having an issue - I have this set up to be called as part of my daily note, using Templater as follows:

<%* app.commands.executeCommandById("weather-fetcher:weather-insert") %>

Edit - Actually it's inserting the weather at the cursor position, which is the top of the file, not the location in the file where the above template command is located.

symph0nic avatar Jan 27 '22 07:01 symph0nic

I am having a similar issue with the Templater content being inserted into a random location in my file.

ebdavison avatar Feb 04 '22 22:02 ebdavison

Same here. Would be nice of having some way of using it from a template

DZPM avatar Sep 15 '22 10:09 DZPM

Same issue. Has someone a solutions to this?

TheBigFudge avatar Feb 20 '23 14:02 TheBigFudge

Hello peeps! I think I have a solution for y'all :)

Due to the plugin looking at the cursor position for where to insert the weather info-- simply manipulate the cursor's position programmatically within the Templater snippet.

<%* 
app.workspace.activeEditor.editor.setCursor(14, 1); // lineNumber, characterNumber
app.commands.executeCommandById("weather-fetcher:weather-insert") 
%>

Note: In my tests, it appears that it is actually inserting on 2 lines before what I indicate in the setCursor() function. I'm not sure if it will be the same for others, but do a couple experiments to see how it works for you.

unxok avatar Dec 20 '23 05:12 unxok