GithubHelp home page GithubHelp logo

chhoumann / quickadd Goto Github PK

View Code? Open in Web Editor NEW
1.4K 14.0 131.0 28.76 MB

QuickAdd for Obsidian

Home Page: https://quickadd.obsidian.guide

License: MIT License

TypeScript 89.57% JavaScript 0.66% Svelte 8.59% CSS 1.18%
obsidian obsidian-md obsidian-plugin

quickadd's Introduction

QuickAdd

QuickAdd is a powerful combination of four tools (called choices): templates, captures, macros, and multis.

A Template is a definition of how to create a new note, and composes with Obsidian's own Templates core plugin or community template plugins. For example, it would allow you to define a quick action to create a new note in a particular location, with a templatized title, and templated content.

A Capture allows you to quickly add content to predefined files. For example, you could set up a quick action to add a link to the open file to your daily note under a specific section.

Macros will allow you to compound these two together into powerful chained workflows. Imagine pressing one hotkey to automatically create a new note to track a chess match with a specific template, while automatically adding a reference to it in your "list of matches" note and in your daily note.

Multi choices are purely organisational: folders of other choices.

Throughout your choices, you can use the QuickAdd format syntax, which is similar to the Obsidian template syntax. You could, for example, use {{DATE}} to insert the current date in a filename.

Demo video

Demo video

Installation

QuickAdd can be installed through the community plugin browser in Obsidian, or through manual installation. See the installation documentation for more information.

Getting Started

For detailed instructions and examples on using QuickAdd, see the QuickAdd documentation.

Support

If you have any questions or encounter any problems while using QuickAdd, you can use the community discussions for support.

quickadd's People

Contributors

aviskase avatar cassian-andor avatar cdloh avatar chhoumann avatar cretezy avatar ctroms avatar danielo515 avatar generic-user avatar joe-moran avatar kawamataryo avatar marcelocajueiro avatar martijnarts avatar mikkovedru avatar mlevison avatar mryanb avatar pivic avatar rviljoen avatar semantic-release-bot avatar tfthacker avatar thomasvs avatar thorlucas avatar yongyizang 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  avatar  avatar  avatar  avatar  avatar

quickadd's Issues

QuickAdd: (ERROR) e.replace is not a function

I have a trouble making a plugin work. I configured a simple template, and this is what I see in the console right after Run quick add > Select choice

VM110:10316 QuickAdd: (ERROR) e.replace is not a function
logError    @   VM110:10316
eval    @   VM110:8253
logError    @   VM110:8253
run @   VM110:10099
async function (async)      
run @   VM110:10068
onChooseTemplateType    @   VM110:10276
onChooseItem    @   VM110:10253
t.onChooseSuggestion    @   app.js:1
t.selectSuggestion  @   app.js:1
e.useSelectedItem   @   app.js:1
(anonymous) @   app.js:1
e.handleKey @   app.js:1
e.onKeyEvent    @   app.js:1

I still see the prompt for filename, but the note isn't created.

quickadd version: 0.1.7
Obsidian version: v0.12.5 (installer version v0.12.3)
Platform: Linux (ubuntu)

Plugin's data.json:

{"choices":[{"id":"6c2f5a21-11cc-4a97-b26b-80652ecc805a","name":"inbox_items","type":"Template","templatePath":"templates/test_temp.md","fileNameFormat":{"enabled":false,"format":""},"folder":{"enabled":false,"folders":[]},"openFileInNewTab":{"enabled":false,"direction":"vertical"},"appendLink":false,"incrementFileName":false,"openFile":true}],"macros":[]}

[BUG?] MACRO CHOICE: Workbench Plug-in Hotkeys (0.2.10)

Hello @chhoumann !!!

First of all, I just wanna thank you for everything that you have done for this community. All of yours plugins are a game-changer.

I'm just getting started with Quickadd and my first road is about the MACRO CHOICE.

  • I'm using MACRO to automate my hotkeys workflow. Every workflow that I use more than one hotkey will be "transferred" to Quickadd.

I found one specific situation using 2 hotkeys from the Workbench plug-in that I wanna share with you.

The HotKeys are:
1 Workbench: Copy the Current Line/Block to your Workbench
2 Workbench: Link the Current Line/Block into your Workbench

-> The first hotkey copy the current line to the workbench note
-> The second create a blockrefence and copy the path into the workbench note

I created a MACRO CHOICE and a MACRO like this:
Screen Shot 2021-06-24 at 15 05 19

Screen Shot 2021-06-24 at 15 08 10

When I activate the Quickadd from the prompt, ONLY the SECOND hotkey of the MACRO is lanched

  • As you can see, the 2 hotkeys are running, but only the second is working
    Screen Shot 2021-06-24 at 15 13 35

  • Doing this same operation without Quickadd works 100% OK (that was my operation before Quickadd)
    Screen Shot 2021-06-24 at 15 18 06

Then I decided to investigate before writing to you. I did the following tests:

  • Quickadd only with hotkey Workbench: Copy the Current Line/Block to your Workbench => 100% worked! 🟒
  • Quickadd only with hotkey Workbench: Link the Current Line/Block into your Workbench => 100% worked!🟒
  • Quickadd with 3 hotkeys Workbench: Copy... + Show Outline Pane + Workbench: Link ... => fail πŸ”΄

I would be extremely grateful if you could take a look if this happens in your end.

Let me know if you need more information.

Thanks for reading this and have a great day!

[BUG] Templater syntax does not work in capture

I have a capture with a Templater template (ie, it has <% tp.file.include() %> in it. These do not resolve when I use it in a capture. I would like to do this because I want to run a macro after inserting the template.

Expected behavior
I would have expected the templater includes to resolve.

Screenshots
Capture setup
image

Result of capture
image

Desktop (please complete the following information):

  • OS: MacOSX

[Bug] Some functions from Templater are called twice on creation

Hello, thanks for the great plugin.

I'm using Templater and tp.system.prompt in my templates and when I try to create new note using QuickAdd prompts to enter are showing 2 times and only last value is used in the final note.

Example of template (test.md):

<% tp.system.prompt('hello templater') %>

Settings for template in QuickAdd:
image

[FEATURE REQUEST] "Move Notes with a Tag to a Folder" but with links

Is your feature request related to a problem? Please describe.
This is not really a feature request, I'd just like to have a version of the "Move Notes with a Tag to a Folder" macro script that works with links (since I use links to tag my notes).

Describe the solution you'd like
When I run the macro, let me select which "tag-link" I want to move, then to which folder. Just like the original macro.
If I have a bunch of notes that all have a link to [[Ideas]], I can run the macro to easily move them all to the "Idea" folder.

PS: this plugin is groundbreaking. thanks for creating it!

[FEATURE REQUEST] Reuse VDATE value with differ formating

I want to create a note in a folder structure:

  • YYYY
    • MM
      • DD
        FILE-YYYY-MM-DD.md

During a creation process I need only enter DATE ones, then I need to use this with many forms:
{{VDATE:data,YYYY}} - for first level of folders
{{VDATE:data,MM}} - for second
{{VDATE:data:DD}} - for last
{{VDATE:data:YYYY-MM-DD}} - for a file name

Now, 'data' is fixed and is formatted as a first usage.
To solve it I need to ask about Year, Month, Day
In this scenario, I can't use a natural language like (next week)

Please provide a capture path for...

Hello,

I have created a capture action in order to test it ; very simple :

  • add in the active file
  • nothing else (no format, no section to add to,...) and it does not work πŸ‘

It gives me the error Please provide a capture path for...

Thank you

[BUG] MACRO - Editing Obsidian Command

Hello again @chhoumann !!!

The following MACRO has 5 Obsidian commands in this order: A - B - C - D - E
Screen Shot 2021-06-24 at 15 34 25

A few days later, I decided to change the order of the same MACRO to: B - C - D - E - A
Screen Shot 2021-06-24 at 15 37 54

I close the window and when I come back, the order is again: A - B - C - D - E
Screen Shot 2021-06-24 at 15 35 03

And the MACRO is respecting the A - B - C - D - E order when running.

I hope you could reproduce on you end.
Have a great day!

[FEATURE REQUEST] Dublicate an Item

Is your feature request related to a problem? Please describe.
I would like to have several similar actions. Now I need to enter them one by one or edit data.json

Describe the solution you'd like
Add an option: "Dublicate an Item" which just copy a configuration and "Copy of xxxx" as a name.
I can easily then edit new rule.

[FEATURE REQUEST] Rename a Item of Multi Type

Is your feature request related to a problem? Please describe.
I can't rename a Multi Item from an interface of obsidian.
I need to open a data.json and do it manually.

Describe the solution you'd like
Add an option to rename this Item

[Feature Request] Calling templates from code

Right now you can call a user script (macro) from a QuickAdd menu.

The other way around could be useful (i.e you're in a user script, and you trigger a QuickAdd template).

My use case is that some of my menus can not be entirely build with QuickAdd. For example I have a "smart context" menu that is a QuickAdd entry that fires a user script (through a hotkey). That user script analyzes the currently open file and offers options relevant to the file. Some of these options are user scripts, so it's all good, but some other are options I've already got setup within QuickAdd (like a Template option).

In this case, some way to refer & fire a QuickAdd menu/option would be ideal. Is that something that you could consider?

cancelling a template add brings up an error

Hi, just started trying out the plugin, and ran into a curious behaviour.

Whenever I press ESC after selecting a template to add, I get this error:

image

And this only happens with the add template function, as far as I've noticed.

[FEATURE REQUEST] Suggested improvements to capture

Observed behavior
I set up a capture workflow based on the daily notes template, but I specified the daily notes template incorrectly - a template name which didn't exist due to incorrect capitalization.

I was able to launch the workflow, but it failed silently (no input box shown), so I was confused.

I looked in the console in developer tools and saw that logs were complaining about template file not found, and was then able to fix.

Describe the solution you'd like
I think the ideal solution would be to have template file name autocomplete / predict in the "template file" input field, but maybe that's not possible in the settings pane?

Alternatively, I think displaying an error to the user would be useful, to avoid the need to dig in to the developer tools console.

Additional context
QuickAdd 0.2.15
Obisidian v0.12.9 (insider build)
MacOS Big Sur 11.4

[Feature Request] Hotkey for multi

With the previous quickadd (the non-plugin version), I simulated the multi item (by making a quickadd script for which each items calls another one), and with the "hotkey for templater" plugin I was able to assign hotkeys to submenus.

For example my main menu is :

  • Add
  • Open
  • XXX
  • YYY

Which I open with ctrl + space (I can do that currently with the plugin)
But in addition to that, I bind the Add menu (which opens a submenu with lots of add possibilities) to ctrl + n to override Obsidian's.

To allow this, I think that ideally the QuickAdd plugin should allow defining hotkeys for any of the items (including Multi) to trigger them independently.

Do you think that would be feasible ? Sorry for the influx of tickets btw, I've been moving my configuration from the old non-plugin version to the plugin version haha

[BUG] checkboxPrompt duplicates values

Describe the bug
When usingcheckboxPrompt with old values, the returned array has duplicate values.

To Reproduce

const values = await checkboxPrompt(['a', 'b', 'c', 'd'], ['a', 'b']);
console.log(values);

If you turn OFF a and b, and turn ON c, you get the correct output: ['c'].
However, if you leave a or b on, they are duplicated in the result: ["a", "b", "a", "b", "c"]

[FEATURE REQUEST] More prompt types

There is a distinct lack of different types of prompts available. I'd like to create more different types of promps such as:

  • sliders
  • numerical inputs (with max and min)
  • anything else

Ideally we should provide composable prompts for people to build their own things.

I think I will begin playing around with this idea and will post updates here.

[Feature request] Add `WAIT` OR `IF ELSE` to execute macros sequence?

It will be nice that we could use Wait OR IF ELSE to make macro more powerful.

Like, I need to run a macro, and it will get some variable by using script. when the variable is lower than 100, run other command.

I drew a sketch that might help you design it.

image

But it seems like tons of job if you do it, please let me know what you think of this!

[FEATURE REQUEST] Open Note after capture

Is your feature request related to a problem? Please describe.
Not a big problem, but a convenience thing. For example, I'd like to add a card to a Kanban-Board and then also open the Kanban Baord. I figured out how to do the former, but I didn't find out how to do the later automatically afterwards.

Describe the solution you'd like
Add a checkbox with "Open Note after capturing to it". Basically the same option that you already have when quickadding a template.

Additional context
I apologize in advance for creating this issue if you can already somehow do it with a Macro. I just did not figure out how.

Problem with Templater template

hi, after Obsidian update 0.12.5 and your last update, all the old template don't go right.
There are Parsing error in template now..
Can you check?

[BUG] Move tagged notes macro doesn't display folder picker

The macro for moving tagged notes to a folder is broken because once you've selected Yes/No on nested tags, the folder chooser just doesn't appear.

Additional context
I thought it might be because I had turned off the File Explorer core plugin, which has the Move Note hotkey bundled, but I tried turning it back on and it didn't fix it.

[BUG] Newlines are inserted between tasks when using Capture choice

Describe the bug
Newlines are inserted between tasks when using Capture choice

To Reproduce
Steps to reproduce the behavior:

  1. Go to QuickAdd settings;
  2. Create new Capture choice;
  3. Select existing Markdown file;
  4. Tick "Task" toggle to format it as task;
  5. Tick "Write to bottom of file";
  6. Trigger this choice, enter "test", and then press Enter;
  7. Repeat step 6;
  8. Observe that there's a newline between the two tasks, breaking the continuity of the checklist, which makes some plugins stop working

Expected behavior
No newline between the two newly added tasks at end of that file.

Screenshots
image

image

Desktop (please complete the following information):

  • OS: [e.g. iOS] Windows
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22] 0.3.14

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
The problem doesn't happen when there's no trailing newline in the file. But after the choice is used, a newline gets inserted.

Can not run Obsidian's command "open today's daily note"

Steps:

  • Created a macro
  • Added the Obsidian command "open today's daily note"
  • Created a Macro item and assigned the new macro to it

When running the item, I get this error in the console:

VM1005:9405 Uncaught (in promise) TypeError: Cannot read property 'commands' of undefined
    at MacroChoiceEngine.run (eval at <anonymous> (app.js:1), <anonymous>:9405:42)
    at ChoiceExecutor.onChooseMacroType (eval at <anonymous> (app.js:1), <anonymous>:11698:27)
    at async ChoiceExecutor.execute (eval at <anonymous> (app.js:1), <anonymous>:11678:17)
    at async ChoiceSuggester.onChooseItem (eval at <anonymous> (app.js:1), <anonymous>:11725:13)

Pass TP to params for macros

I make heavy use of Templater (and thus the tp variable) in my scripts. With macros triggered by QuickAdd, I can't pass the tp variable to the function and have thus no access to Templater.

I know that QuickAddApi offers some equivalents, but they are not 100% equivalent. For example template offers a suggester() overload that allows to do this:

const pickedFile = await params.quickAddApi.suggester(
                (file) => file.basename,
                params.app.vault
                    .getMarkdownFiles()
                    .filter((file) => file.path.startsWith("meetings/"))
            );

Of course I can adapt this to the standard signature that takes 2 arrays, but that makes 2 different but very similar APIs to follow (Templater and QuickAddApi) and if Templater changes in the future, it means the QuickAddApi will either have to quickly follow or further discrepancies will be introduced.

Do you think it would be possible to add the tp variable from Templater to the params object, or would that not be technically possible ?

Template path being appended to file location

It seems that for a template entry, the template path is being appended to the file location. For example, if the template path is utils/templates/Cactus.md (btw the plugin isn't auto suggesting my templates/ folder for some reason, only my templater/ folder), and the file folder location is πŸƒ leafs (the folder name has an emoji in it), and the file name is {{DATE:YYYYMMDDHHMMSS}} {{VALUE}} I get this error when trying to trigger it :

Error: ENOENT: no such file or directory, open 'C:\PathToVault\πŸƒ leafs\202106260936 utils\templates\Cactus.md'

However if for the folder I put /πŸƒ leafs (so as an absolute path with a slash), it seems to solve the issue.

Any clue where the problem might be coming from?

Select which QuickAdd action from script or URL

Maybe I’m just not grokking the docs, but when using Advanced URI with QuickAdd, how can I specify which action I want?

My url is:

obsidian://advanced-uri?vault=Obsidian-iOS-Vault&commandname=QuickAdd:%20Run%20QuickAdd

which when called from Shortcuts will start Obsidian, trigger QuickAdd, but then I have to select the QuickAdd action I want, in my case a Capture I have called β€œQuickNote”.

I have tried a couple of variations, like:

obsidian://advanced-uri?vault=Obsidian-iOS-Vault&commandname=QuickAdd:%20Run%20QuickAdd&QuickNote

But nothing has worked.

Did I miss something?

Typeerror [ERR_INVALID_ARG_TYPE] : data argument

Hello,

I have just installed the plugin. I try to use it with a simple tempate and I have got the error πŸ‘
Quickadd : (error) TypeError [ERR_INVALID_ARG_TYPE]: the "data" argument must be of type string or an instance of buffer,...

Any idea of what I missed ?

Thanks

[FEATURE REQUEST] MACRO - Additional Commands

Hello @chhoumann !

My feature request is an Additional Commands to the MACRO Configuration (between Obsidian Commands and Scripts.
Screen Shot 2021-07-12 at 11 43 43

I was thinking about a new set of commands:

  • a. Copy
  • b. Paste
  • c. Cut
  • d. Select active line (make a selection of the line the text cursor is placed)
  • e. Select internal link (if the text cursor is placed in a internal link [[]] the command will select all the internal link )

User case

One of my main uses for Obsidian is to write. I import parts of books, highlights, articles to Obsidian and create many notes based on these sources.

This way, I have to do much transfer between notes and edit inside the same note

  • I always use internal links to keep the reference. It's very important to know the origin because I mix chunks of different sources inside one single note.

If I could have a set of MACROS to automatically select/cut/copy lines and the internal links and transfer to other predefined files, would be a game-changer for me.

  • The amount of time I spend selecting/Copying/Cutting is a lot.

Example

This is one of my writing workflows:

  • The right side is my sources notes using Obsidian Tabs
  • The left side is my Workbench
  • The left Sidebar is my quick notes notes
    Screen Shot 2021-07-12 at 11 53 13

I extract text and block references from the sources notes and quick notes to Workbench
Then I maximize workbench to "edit" my note: writing my own words, reorder text, using css/html to make beautiful notes
Screen Shot 2021-07-12 at 11 57 28

...

That why I'm requesting these 5 additional commands to the MACRO choice. :)

Thanks for you time and for this powerful plug-in!!!!!!!!!

[FEATURE REQUEST] New Format placeholder to create random code when insert into other document

Is your feature request related to a problem? Please describe.
I need to create a block reference when insert text into excalidraw drawing, You could refer something here: https://github.com/zsviczian/obsidian-excalidraw-plugin/releases/tag/1.2.0-alpha-1

Describe the solution you'd like
A {{random:6}} to create a 6 random alphabet or digital code: like 3YusT5 OR IGaspd.

Like when i use {{value}} ^{{random:6}} to get my text and a random code

Additional context
NO

[BUG] Failed to load user script /scripts/AutomaticBookNotesFromReadwise.js. Default export is not a function.

Describe the bug
When I launch the add book notes macro, an error message displays : "Failed to load user script /scripts/AutomaticBookNotesFromReadwise.js. Default export is not a function.".
Anyway, it creates a file for my book, but with a degraded template.

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'command palette'
  2. Click on 'run QuickAdd'
  3. Click on 'Add book'
  4. Click on a book name
  5. See error

Expected behavior
A file should be created on the model of my template, with every variable filled properly.

Screenshots
Capture-d-e-cran-2021-07-21-a-11-06-17.png

Desktop (please complete the following information):

  • OS: MacOS 11.4
  • Browser Brave V1.26.77 (July 16, 2021)
  • Obsidian Version 0.12.10

QuickAdd and tp.config.template_file

I'm not sure if this is a bug or not, but it seems that files created with QuickAdd overwrite the value of tp.config.template_file so that rather than templater seeing πŸ“„ new uri πŸ”—.md (template file) as the template TFile, templater sees the new file as the template TFile

I use tp.config.template_file.path and tp.config.template_file.stat.mtime as a way to keep track of source template versions for generated files

Is there any way around this so that tp.config.template_file returns the template TFile as it would with templater?

Example:

Source yaml

source  :
    template: "[[<% tp.config.template_file.path %>]]"
    version : <% tp.config.template_file.stat.mtime %>

Insert template via Templater

source  :
    template: "[[πŸ“ templates/πŸ“„ new uri πŸ”—.md]]"
    version : 1627216265391

Create file via QuickAdd (screenshot)

source  :
    template: "[[uri~202107250957.md]]"
    version : 1627219317708

QuickAdd Screenshot

image

[Question] Didn't work when I set a macro?

When I wanted to add a macro , it didn't work correctly but the console has no error messages too.

I created a macro named hcow by pressing this button:

image

And created a macro? by pressing this button:

image

image

image

Then, I made the hcow macro select the Ton macro

image

Finally, I run this hcow macro, and it didn't do anything. Did I do something wrong?

[BUG] User Script don't work on Obsidian for Android

Describe the bug
A clear and concise description of what the bug is.

I found that quickadd's user script does not work on Obsidian for Android. After debugging I got the error message:
Uncaught TypeError: this.app.vault.adapter.getBasePath is not a function

Smartphone:

  • OS: Android 11
  • Obsidian: 1.0.3
  • Version: 0.3.9

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.