Git Product home page Git Product logo

buttons's People

Contributors

0snug0 avatar antulik avatar balake avatar cumany avatar henrebotha avatar liimurr avatar lx avatar navirl avatar ouchpotato avatar pangolinsec avatar rafa-carmo avatar razmag avatar ryanjamurphy avatar sabridw avatar shabegom avatar shirobachi avatar unxok avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

buttons's Issues

link's action converted into all lowercase causes problem

My code:

```button
name Templater Help
type link
action https://silentvoid13.github.io/Templater/docs/internal-variables-functions/
color green
```

/Templater/ will be converted to /template/ which causes 404 not found error.

[FEAT]Calculate And Execute the corresponding actions

WHAT

I don't know if it is doable that calculate how many times the buttons has been pushed, and if it is doable.

Is it possible to execute the corresponding actions based on the number of times?

like:

name Daily Quote
type Text
times [1-n]
loop True
action: [1: action1;2: action2;3: action3;4: action4.....n: actionN;]

WHY I NEED AND HOW TO USE IT

It will be useful when I want to create different files in different day.

Or for building a text game.

When I use a folder the split mode does not work correctly

If I use the following command, it generates a file inside Journal, but it opens an empty panel in obsidian.
If I remove Journal\ it works correctly.

name Journal
type note(Journal\<% moment().format("YYYY-MM-DD__HH_mm_ss") %>, split) template
action tp-daily
templater true

^button-6ut6

Buttons don't appear outside of main pane on startup

I have a table of contents that I keep docked to the left side of my workspace so it is easily accessible.

image

Upon opening obsidian, the buttons are not initially loaded if the file is not in the main section.

image

It is easy enough to close the page and reload it but I wanted to at least put this here.

Calculation not working

Wanted a counter button so started testing with the example code:

```button
name Add Em Up
type calculate
action 2+2
```
But nothing happened when clicking, nowhere to find the output

Win10, plugin version 0.4.15, Obsidian version 0.12.12

Clash with another plugin - 'Filename Heading Sync' and replace [1, 9999] question

I have these two buttons below on an Obsidian Note. My goal was that each button when pressed will execute a python script and clean up any templater code inserted into the page and leave a 'clean' display of the two buttons.

The issue (not yours) I found is that it is necessary to turn off the community plugin 'Filename Heading Sync' which was throwing out the replace activity for some reason.

The replace [1, 99999] works perfectly and removes the inserted templater code by either button.

My question is why does replace [1, 9999] not destroy the second button? Does it take a full snapshot of the page prior to the templater script execution? I was confused by the documentation.

I'm not complaining because my use case works perfectly and I have a page called command centre (below) that now has lots of buttons for my scripts which is great.

Thanks for your excellent work in bring Buttons plugin to the community.

Button 1

name run My Schedule
type line(99999) template
action Run Python Script For Schedule
templater true
color yellow
replace [1, 99999]

Button 2

name run Project Review
type line(99999) template
action Run Python Script For Project Review
templater true
color blue
replace [1, 99999]

The Obsidian Note - Command Centre
07 - Command Centre.md

Template button does not execute in working directory of the note itself

I am trying to create a simple template button which invokes "ls" through a Templater user-defined function:

name files in this directory
type note(Filelist, split) template
action template - ls

And the "template - ls" template is:

<% tp.user.ls({a: tp.file.folder(true)}) %>

And the "ls" user defined function in Templater is merely:

ls "$a"

I expected to get a list of the files in the same directory as the originating note, but I get a list of files in my home directory.

Is there a workaround?

[Feat] Open newly created notes in new pane in edit mode

When creating a new note from a template, the current behavior replaces the current pane with the new note shown in preview mode. However, this is kind of inconvenient because I would like to keep the original pane with the button open and immediately edit the new note I created.

Example button code:

```button
name Add Task
type note(New Task) template
action Task Template
class dataview-button
```

Thanks!

Templater prompts with button 'remove' option

When templater prompts are mixed with a button to replace the templates and also set to remove, the button doesn't get removed. (likely because the template prompt reinserts it)

<% tp.system.prompt("Enter text.") %>

button
name Finish
type command
action Templater: Replace templates in the active file
remove true

TypeError when clicking button

When clicking a button nothing happens and the following error is shown in the Console:

Uncaught (in promise) TypeError: Cannot read property 'settings' of undefined
    at template (eval at <anonymous> (app.js:1), <anonymous>:1202:55)
    at eval (eval at <anonymous> (app.js:1), <anonymous>:1413:13)
template @ buttonTypes.ts:104
eval @ button.ts:85
async function (async)
eval @ button.ts:81
setTimeout (async)
clickHandler @ button.ts:80
async function (async)
clickHandler @ button.ts:57
eval @ button.ts:45
s @ app.js:1

I just installed Buttons and this happens with the first button that I create, using Button Maker. I do not see any settings tab for Buttons under Plugin Options in the Obsidian Settings dialog. I'm not sure if there is supposed to be one, just going off of the context of the error message.

Here is the text that I'm using:

button
name Create Task
type note(Task) template
action Task Template

Obsidian Version: 0.12.4
Buttons Version: 0.4.10

Using Icons in Buttons

Love the plugin!

Are you familiar with the Icons plugin from visini?

It would be great if we could render these icon in the buttons. Unfortunately, the combination is not working currently.

Are you able to make this work, or should we contact visini?

Looking forward to hearing your comment.

Issues with Colors in Button Maker (especially blue)

When setting the button color to blue specifically in the button maker, it creates a button with color #76b3fa. However it doesn't seem like hex colors are recognized and renders as the default black button:

image

Changing the line manually to color blue gives the expected result:

image

This doesn't seem to be an issue with the other colors.

Feature request: Have templater buttons that just run the template (without prepending o appending)

It would be great to have also a button that only runs a template.

Why? Because then we could run templates like the following to, for example (in the code below), replace all the checked boxes for unchecked ones, without adding any text to the note:

<%*

//get file content and replace checked boxes for unchecked
var noteContent = tp.file.content.replaceAll ("[x]","[ ]");

//select all in note
let cmEditorAct = this.app.workspace.activeLeaf.view.editor;
cmEditorAct.setSelection({ line: 0, ch: 0 }, { line: 9999, ch: 9999 });

//replace content + set cursor at the start
cursor = tp.file.cursor(0);
tR = cursor + noteContent.split("<%*")[0];

%>

Right now I do the trick of using append then removing that appended text: noteContent.split("<%*")[0]
But this works randomly depending on some speed of an internal process that appends the templater text to the note (because thats the button I am using).

This works perfectly when applying the template using templater command, but with buttons we cannot replicate because of the extra text insertion.

This feature would allow us to run any javascript to modify the current note using templater, I think it would be pretty cool :)

Thank you!

Feature: add a "group" parameter to group buttons and make them work together

Hello!
Thank you for this wonderful plugin.

As discussed in discord, adding a "group" parameter would be very useful.

Example usage : I would like to have a button that inserts a template containing plenty of various buttons (let's say each of these buttons would insert a specific checklist/template). Once I click on the button I would like to have the template replace the button, but also all of the other buttons.

addButtonToStore uncaught typeerror for removeDuplicates

I was using a Templater script that I had created when I received these three errors in my console.

image

The script has nothing to do with any buttons - it does not interact with buttons.

When passing the store to removeDuplicates, it is unable to read index 0 because the store seems to be null.

The script I used simply creates a new file based on some name and type. It relies mostly on app.vault.create.

I am running Obsidian v0.12.2. Buttons is on the latest version as well.

Here is the call stack:

-- -- --
removeDuplicates @ buttonStore.ts:79
addButtonToStore @ buttonStore.ts:26
eval @ events.ts:8
e.tryTrigger @ app.js:1
e.trigger @ app.js:1
t.trigger @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
s @ app.js:1
setTimeout (async)
e.tryTrigger @ app.js:1
e.trigger @ app.js:1
t.trigger @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
s @ app.js:1
Promise.then (async)
l @ app.js:1
s @ app.js:1
Promise.then (async)
l @ app.js:1
(anonymous) @ app.js:1
o @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
o @ app.js:1
(anonymous) @ app.js:1
Promise.then (async)
e.queue @ app.js:1
t.onCreateOrModify @ app.js:1
t.onCreate @ app.js:1
e.tryTrigger @ app.js:1
e.trigger @ app.js:1
t.trigger @ app.js:1
t.onChange @ app.js:1
e.trigger @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
o @ app.js:1
e.reconcileFileCreation @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
s @ app.js:1
Promise.then (async)
l @ app.js:1
(anonymous) @ app.js:1
o @ app.js:1
e.reconcileFileInternal @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
s @ app.js:1
Promise.then (async)
l @ app.js:1
(anonymous) @ app.js:1
o @ app.js:1
e.reconcileFile @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
o @ app.js:1
e.reconcileInternalFile @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
s @ app.js:1
Promise.then (async)
l @ app.js:1
s @ app.js:1
Promise.then (async)
l @ app.js:1
(anonymous) @ app.js:1
o @ app.js:1
(anonymous) @ app.js:1
Promise.then (async)
e.queue @ app.js:1
e.write @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
s @ app.js:1
Promise.then (async)
l @ app.js:1
(anonymous) @ app.js:1
o @ app.js:1
t.create @ app.js:1
addFromTemplate @ D:\Mapper\Tools\Dev\…ipts\QuickAdd.js:46
async function (async)
addFromTemplate @ D:\Mapper\Tools\Dev\…ipts\QuickAdd.js:38
(anonymous) @ D:\Mapper\Tools\Dev\…ipts\QuickAdd.js:14
start @ D:\Mapper\Tools\Dev\…ipts\QuickAdd.js:33
async function (async)
start @ D:\Mapper\Tools\Dev\…ipts\QuickAdd.js:20
eval @ VM207:6
eval @ eta.es.js:998
render @ eta.es.js:996
renderAsync @ eta.es.js:1030
eval @ TemplateParser.ts:74
eval @ tslib.es6.js:76
__awaiter @ tslib.es6.js:72
parseTemplates @ TemplateParser.ts:69
eval @ Templater.ts:59
fulfilled @ tslib.es6.js:73
Promise.then (async)
step @ tslib.es6.js:75
fulfilled @ tslib.es6.js:73
Promise.then (async)
step @ tslib.es6.js:75
eval @ tslib.es6.js:76
__awaiter @ tslib.es6.js:72
read_and_parse_template @ Templater.ts:56
eval @ Templater.ts:97
eval @ tslib.es6.js:76
__awaiter @ tslib.es6.js:72
eval @ Templater.ts:97
eval @ Templater.ts:37
eval @ tslib.es6.js:76
__awaiter @ tslib.es6.js:72
errorWrapper @ Templater.ts:35
eval @ Templater.ts:97
eval @ tslib.es6.js:76
__awaiter @ tslib.es6.js:72
append_template @ Templater.ts:90
eval @ main.ts:209
step @ tslib.es6.js:102
eval @ tslib.es6.js:83
eval @ tslib.es6.js:76
__awaiter @ tslib.es6.js:72
HotkeysForTemplates.templaterInsertTemplate @ main.ts:203
callback @ main.ts:120
GE @ app.js:1
e.executeCommandById @ app.js:1
e.onTrigger @ app.js:1
e.handleKey @ app.js:1
e.onKeyEvent @ app.js:1

Add template directly below button

Hello,

Thanks for creating this awesome plugin. I'm wondering if there's some way to have a button that adds a template directly below it. I have a number of notes for 'meetings' with different people, and like to have the most recent meeting at the top of the pile. It would be great to have a button at the very top to be able to quickly add the next blank meeting template, but if it appears above the button, I then have to move the button up again or it'll get lost, which is more work than hitting ctrl+t and adding the template from there. If it's not a tricky feature to add, I would be able to use it in many places in my vault. Otherwise, I'm already getting value from your awesome plugin in other ways.

Thanks again for your time and have a great day!

Using buttons to modify frontmatter

Hey there! I'm cross-posting this with the Obsidian forum, because after giving it a day, I realized I just may not be using Buttons correctly. =) If this isn't suitable for an issue, feel free to close. Here's what I've got!

Hey all,

In most of my tasks, I've got front matter looking akin to:

---
created: 2021-06-06
assigned: 2021-06-06
dueDate: 2021-06-09
todoDate: 2021-06-07
inprogressDate: ""
doneDate: ""
status: 2
statusList:
  - ❔ Created
  - 📆 Scheduled
  - ⚙️ In Progress
  - ✅ Complete
  - ❎ Will Not Do
class: MAT220🧮
task: "Data Visualization"
---

I then use dataview to render tables of tasks with their various traits. It's quite nice!

I'd like to streamline things, though by being able to graphically update the status number. As it stands, I wind up needing to count to be sure in most cases, which is lame and slow. =)

So I wrote this little python script:

#!/usr/bin/env python3

import sys
import frontmatter
import os

if len(sys.argv) != 2:
	quit()

current_filename = sys.argv[1]
desired_status   = os.environ["desired_status"].lower()

if len(desired_status) == 0:
	quit()

with open(current_filename) as current_file:
	post = frontmatter.load(current_file)

	desired_index = -1

	for index, status in enumerate(post["statusList"]):
	    if desired_status in status.lower():
	        desired_index = index

	if desired_index != -1:
	    post["status"] = desired_index
	    print(frontmatter.dumps(post))
	else:
	    print(f"Could not find status '{desired_status}'.")

And put it into action with this here Buttons button:

```button
name Mark Complete
type line(1) text
action <% tp.user.update_status({desired_status: "complete"}) %>
replace [1,0]
templater true
color blue
```

It doesn't work quite, as it winds up appending everything. I tried using replace [1,1000], replace [1,-1], and replace [1,0] but it seems like Buttons wants exact line numbers.

So... thoughts? Is there a simpler way to graphically run a Templater command? Or maybe there's some way to run Templater commands via hotkeys?

I'm open to whatever solution. =) Thanks in advance!

New note function doesn't work

I dunno why, but when i try creating a new note from a template it doesn't work at all.
That's the code generated by Button Maker:

name Nueva idea
type note(Nueva idea) template
action 📜 NUEVA Idea
color purple

^button-ocsm

[Bug] Multiple Buttons Results in Wrong Button Being Run

It seems like if I have multiple buttons on one page it puts the wrong template on the new note and puts it in the wrong folder. I tried it both with and without templater scripts and got the same result.

Example:

  • I pressed the Day Journal button which should have input the Day template, but instead put the Code Diary template.
  • It also put it in the wrong folder, it should have gone to Journal but instead went to Workout Log.

bbgmu0Njf3

YAML increment/decrementer

I've been thinking on the idea of a way to increment or decrement a value in YAML frontmatter. It's something I may work on eventually, but then I came across your plugin (a great idea, by the way!) and thought it would make an excellent pairing, if you think it sounds worthwhile.

I may eventually work on such an idea if I get the urge to work on a plugin, but if you want to make it part of buttons, I won't complain!

Markdown in button names isn't rendered

It would be super helpful to be able to add eg inline math equations to buttons, ie name $a^2+b^2=c^2$.

Currently it doesn't seem to support any markdown, but thankfully the Obsidian API makes this super easy! There's a MarkdownRenderer.renderMarkdown static function, and you can see how it's used for Kanban card items right here.

Templater button loses template in button block after first use

If I have a button block like

name Create New Meeting File
type note(Team meeting <% tp.date.now("YYYY-MM-DD") %>) template
action Meeting template file
templater true

^button-myteammeeting

If I press the button, the file ('Team meeting 2021-05-14') is successfully created, but the button block now reads:

name Create New Meeting File
type note(Team meeting 2021-05-14) template
action Meeting template file
templater true

^button-myteammeeting

type note(Path/to/note) template doesn't work if Path is an icon

Hi I'm a huge fan of Button, thank your for this plugin

This works (assuming "Tasks" is an existing folder)

name Add Task
type note(Tasks/New Task) template
action task
class dataview-button

but this won't (assuming "📥" is an existing folder)

name Add Task
type note(📥/New Task) template
action task
class dataview-button

Button will not remove after click

This plugin is amazing! Thank you so much.

Just having trouble getting the button to remove after clicking. Here is the snippet:

name Monday Checklist
type prepend template
action Template Monday Checklist
remove true

It inserts the template but doesn't remove, it just moves to the bottom of the template.

Sorry if there is an obvious solution—I'm not a tech savvy person haha.

Thanks for all your hard work!

Screen Shot 2021-05-06 at 10 21 05 PM

Screen Shot 2021-05-06 at 10 20 46 PM

prepend/append for commands

Hello,

I found a bug: if the command called by the button inserts text, the text will be inserted inside the code of the button and the button will not be removed if remove=true.

To reproduce:

name Add Daily Agenda
type command
action ICS: import events
remove true

Perhaps one way to solve this would be to first remove the button then launch the command.
Another way would be to let users append/prepend/etc with commands in case they return text.

Note: the bug only happens if one stays in the "preview" mode. If I click the button, then quickly switch to edit mode, the text is entered correctly.

No Scrolling for Button Maker Modal

One of the computers I use has a relatively small resolution (1024x768), causing parts of the Button Maker modal to get a bit cut off.

Screenshot_2021-05-11_23-50-05

I can zoom out to see the full modal, but it would be nice to be able to scroll here.

Otherwise, I am really enjoying this plugin! Thanks a lot!

Remove button not working when using Templater system prompt

When I use the template button to run a template using multiple tp.system.prompt commands the removal of the instructed buttons works on click but the buttons all reappear after the final prompt has been responded to. Below is the template I am using:

Did you achieve what you set out to do this session?

  • <% await tp.system.prompt("Did you achieve what you set out to do this session?", "") %>

Did you get bogged down? Where?

  • <% await tp.system.prompt("Did you get bogged down? Where?", "") %>

Any takeaways or lessons?

  • <% await tp.system.prompt("Any takeaways or lessons?", "") %>

Below is the button:

name End Session 
type append template
action Templ - WC Debrief
remove true
color purple

^button-endSession

Thanks for the awesome plugin :)

Feature requests regrading template and input prompt

This is a good plugin and I like it. I think that this needs more features to make it a more useful plugin. There are 2 suggestions.

  1. The button can create notes from a template. However, it cannot load the template commands inside the template during the creation. If the button can create a note from templates with built-in template commands or the Templater ones, this will be a better tool of UI for productivity.
  2. Input prompt is another powerful feature to be added. With it, I can create lines, notes, files with customised input to adapt the practical uses. For example, an input prompt will pop up when you click the button to request the filename of the created notes from templates.

Those are my suggestions. I can see great potential from this plugin to be used with Dataview and Templater. I hope that this plugin will make Obsidian note-taking a more user-friendly process with an easy UI like Notion.

Sometimes don't render buttons on Mobile

When I'm starting Obsidian on Android, it sometimes (in general) just render button IDs on starting note, and I need to navigate through some notes and then get back to let plugin reparse and try to re-render buttons. Button codes live on another note document.

Maybe there could be some setting that let plugin know in which exact notes live buttons code, for properly parsing possibility.
But idk its just how it can work in my imagination, I'm not a coder 😄

Plugin is amazing 👍 thank you for this brilliant ❤️

Feature Request: run multiple commands

It would be really great if the button could run a multiple commands in a sequence.

for example. In my daily notes, i run:

  • Turn note into folder ( folder note plugin command)
  • note refactor - H3 ( take all of the H3 headings and turn them into subnotes)

I would love to wrap this into a single button that i just click at the end of the day.

Button code could be"

button
name Note to Folder
type command
action Folder Note: Make Current Note to Folder
action Toggle edit/preview mode
action Note Refactor: Split note by headings - H3
color blue

^button-hzax

Note: Note Refactor can only run in edit mode so it needs to switch back to edit to run properly.*

Bug: replace not working

After the most recent update the "replace" option in my buttons with prepend template, stopped working completely.

   ```button
   name Refresh
   type prepend template
   action weather_window
   replace ## R
   color blue
   \```

I used it to refresh a weather template window I put in my daily notes.

Button acts on active file rather than file it's placed in

When clicking a button, the button acts on the active file, rather than the file the button is in.

In the attached video, the "Shaken" and "OK" buttons act as expected when clicked on while the "Andrea" file has focus, changing the third line of the file to Status: [[Shaken]] or Status: OK, respectively. When the "Test Encounter" file has focus and the user clicks on the button from the hover preview of the "Andrea" file, the button acts on the "Test Encounter" file, even though there are no buttons in that file.

Screen.Recording.2021-08-11.at.9.44.23.PM.mov

Can`t remove double button by id

I am trying to remove both buttons after clicking one of the two via ID

Buttons are triggered, but no deletion occurs

What's my mistake

It`s my button:

name Weekday
type prepend templates
action daily_wday
color blue
remove [wday,vih]

^button-wday

name Holiday
type prepend templates
action daily_hil
color red
remove [bud,hol]

^button-hol

Help me please

Feature request: copy to clipboard button?

I'd like to make a note that has buttons to copy various LaTeX math syntax to my clipboard, a little like this but as a dynamic, editable note, not a static sidebar pane.

It would be super helpful if buttons could copy arbitrary text! (not just the displayed text)

I suspect this might already be possible to achieve through a template button with arbitrary JS but that isn't as ergonomic.

Unable to Add Template with Hyphens in Name

I can't seem to get the button plugin to work if my template has a - hyphen in the name, it just says that it can't find the specified template.

Could you add something like "" quotations to pull the file names so I wouldn't have to rename files?

template action not working?

Hi - thanks for the plugin! Love it.

I am trying to use the world's simplest "append template" action but am getting the message "Couldn't find the specified template". Yes, I have the templates plugin installed and directory configured (I'm using templates in other ways, successfully).

Am I missing something? This is using 0.3.8

name ClickMe  
type append template  
action templatetest  

in this example, templatetest file (actually templatetest.md) exists and is in the template folder.

Inline buttons not rendered after opening Obsidian

When Obsidian is opened my inline buttons are not rendered (neither via desktop client - macOS - nor mobile client - iOS). As a workaround I can edit the note and then go back to preview mode to see the inline buttons.

With "regular" (i.e., not inline) buttons, I don't have the problem.

FYI: I am using the latest (insider) builds of Obsidian --> v0.12.12 (desktop macOS) and 1.0.4 (iOS)

See screenshots (screenshot 1 = immediately after opening Obsidian; screenshot 2 = as expected)

image

image

After updating from 0.2.10 to 0.3.1 all buttons disappeared

Hello
After updating from 0.2.10 to 0.3.1 all buttons disappeared

Here is the console output

button

This is an example of my buttons

name Будний день
type prepend templates
action daily_bud
color blue
remove true
id bud
remove true

help me pls

For Template New Note Buttons, allow manual naming of the new note in a pop-up window, which will allow Templater tp.file.title functions to run.

Problem

  • pre-defining a note name is problematic in some cases. most times when clicking a New Note Button, you would want to be able to type an original note name.
  • Specifically in some of my templates, I want Templater to use the tp.file.title function each time I make a new note. However, if the note name is predefined, this is not possible.

Expected solution

  • When creating a new template button, instead of selecting Note Name (What should the new note be named?), there should be a checkbox to select for something like "Name new note in pop-up window".
  • After clicking the button, a pop-up window to name the new note is presented. such as:
    image
  • Naming the note would then allow Templater to run and completes the tp.file.title field.

for example, my current use case, where I would want to manually rename New Note:

  • my current button
name New Task
type note(New Note) template
action New Task
templater true
color blue

image

  • my template
# <% tp.file.title %>
---
#tasks #inbox
Completed:: 
Project:: [[<%tp.file.cursor(1)%>]]
Status:: #active
Priority:: 
Date Created:: <% tp.date.now("YYYY-MM-DD") %>
Due Date::
Defer Date::
Recur Length::

image


I hope this makes sense and is useful for others.

Template Button Does Not Recognize Templater Plugin

Heyo, thanks for the awesome plugin but I'm running into a problem where the plugin doesn't recognize Templater.

Every time I use a template action I get the alert "You need to have the Templates plugin enabled". I have specified templates folder, and the templates plugin works fine.

Screenshots proving the above

New Screenshot 2021-04-24 at 11 06 25 AM

New Screenshot 2021-04-24 at 11 06 46 AM

New Screenshot 2021-04-24 at 11 06 50 AM

THIS MAY BE AN ISSUE WITH THE APP AND NOT THE PLUGIN

The issue may occur here:

const template = async (app, { name, type, action }) => {
    console.log("template button");
    const templatesEnabled = app.internalPlugins.plugins.templates.enabled;
    // only run if templates plugin is enabled
    if (templatesEnabled) {
    /* nothing runs because templatesEnabled = false  */
    
   else {
        new obsidian.Notice("You need to have the Templates plugin enabled",    2000);
    }
}

However, I checked app.internalPlugins.plugins and it seems to be screwed up. I've attached screenshots to show what I mean.

Proof Plugin is installed

New Screenshot 2021-04-24 at 10 46 31 AM

Proof Templates is not enabled.

New Screenshot 2021-04-24 at 10 47 15 AM

Button maker

I detected an issue with the "Button Maker" and I don't know how to solve it.
I have two vaults with the same plugins, css snippets, etc. In one vault everything works fine (open the Button Maker from the command palette), in the other vault the "Button Maker" window does not show up (but the "Insert Inline Button" window works)!
I reinstalled the plugin but the issue remains.
Any idea?
Thank you.

Feature request: Append to end of file?

Thanks for the plugin! I'm trying to append to the end of the current file (or any arbitrary file would be even better).

"append template" expands the template underneath the button, there doesn't appear to be a way to append to the end of the file (unfortunately I can't really place my button at the end of the file).

Thanks.

links not working

Your example:

name To the Forum Batman!
type link
command: https://forum.obsidian.md/

It doesn't perform any action.
Dev tools:

Uncaught (in promise) TypeError: Cannot read property 'trim' of undefined
    at link (eval at <anonymous> (app.js:1), <anonymous>:1040:25)
    at clickHandler (eval at <anonymous> (app.js:1), <anonymous>:1112:25)
    at HTMLButtonElement.eval (eval at <anonymous> (app.js:1), <anonymous>:1143:21)
    at HTMLButtonElement.s (app.js:1)
link @ buttonTypes.ts:115
clickHandler @ index.ts:55
eval @ index.ts:86
s @ app.js:1

An extra question: Is there a command to open another file?
Thanks

[Bug] Uncaught TypeError: Cannot read property 'filter' of null

I opened up the dev console to work on an unrelated plugin, but I quarantined this exception to the buttons plugin. Whenever I start typing in the editor, I get one of two exceptions in the console:

app.js:1 Uncaught TypeError: Cannot read property 'filter' of null
    at removeDuplicates (eval at <anonymous> (app.js:1), <anonymous>:208:16)
    at addButtonToStore (eval at <anonymous> (app.js:1), <anonymous>:174:11)
    at eval (eval at <anonymous> (app.js:1), <anonymous>:216:9)
    at t.e.tryTrigger (app.js:1)
    at t.e.trigger (app.js:1)
    at t.trigger (app.js:1)
    at t.<anonymous> (app.js:1)
    at app.js:1
    at Object.next (app.js:1)
    at s (app.js:1)

and

app.js:1 Uncaught TypeError: store is not iterable
    at addButtonToStore (eval at <anonymous> (app.js:1), <anonymous>:173:44)
    at eval (eval at <anonymous> (app.js:1), <anonymous>:216:9)
    at t.e.tryTrigger (app.js:1)
    at t.e.trigger (app.js:1)
    at t.trigger (app.js:1)
    at t.<anonymous> (app.js:1)
    at app.js:1
    at Object.next (app.js:1)
    at s (app.js:1)

Steps to reproduce:

  1. Open any note (doesn't matter if there's a button code block or not)
  2. Start typing in note
  3. Observe console

I turned off all other plugins as well when testing this. Thank you!

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.