danielo515 / obsidian-modal-form

Define forms for filling data that you will be able to open from anywhere you can run JS
https://danielorodriguez.com/obsidian-modal-form/
MIT License
207 stars 18 forks source link

[Feature request] tag suggest input type #118

Closed danielo515 closed 10 months ago

danielo515 commented 11 months ago

An input type that allows to pick one or more tags. Maybe with an option to filter out tags?

zeltak commented 10 months ago

would also LOVE that option, would make this perfect for me..pretty please with sugar on top? :) :)

danielo515 commented 10 months ago

@zeltak in this initial version, there is no configuration, because I didn't saw the need. Maybe a way to exclude tags would be required, or an option to remove the # prefix on them. Please let me know your thoughts.

zeltak commented 10 months ago

This is SOOOO EPIC :) thank you so much for this , honestly this is the best plugin since ive started using obsidian a few years ago!!

one thing though is that I see it currently does not put the input into the YAML header but rather capture below the title, am I missing something or is YAML not supported yet? since obsidian moved fully to YAML properties I moved my thousand of files to use that

here is an example of the current way the plugin saves

# inbox
- [ ] tag:: "#china","#asia"

VS the way I (and obsidian save in YAML)

---
tags:
  - china
  - asia
status: 
---
# inbox

am I missing something?

thx so much for your epic work @danielo515 !

danielo515 commented 10 months ago

Can you share with me the template you are using so I can look into it better?

El mié, 22 nov 2023, 21:15, zeltak @.***> escribió:

This is SOOOO EPIC :) thank you so much for this , honestly this is the best plugin since ive started using obsidian a few years ago!!

one thing though is that I see it currently does not put the input into the YAML header but rather capture below the title, am I missing something or is YAML not supported yet? since obsidian moved fully to YAML properties I moved my thousand of files to use that

here is an example of the current way the plugin saves

inbox

  • [ ] tag:: "#china","#asia"

VS the way I (and obsidian save in YAML)


tags:

  • china
  • asia status:

    inbox

am I missing something?

thx so much for your epic work @danielo515 https://github.com/danielo515 !

— Reply to this email directly, view it on GitHub https://github.com/danielo515/obsidian-modal-form/issues/118#issuecomment-1823451378, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARKJWKTQ4K4BKIEBFLEWLLYFZMNRAVCNFSM6AAAAAA66N3SDSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRTGQ2TCMZXHA . You are receiving this because you were mentioned.Message ID: @.***>

zeltak commented 10 months ago

sure , im just using the base obsidian YAML header though, but here is an example .md file

---
tags:
  - CQ
  - asia
  - noodle
  - chicken-thigh
status: 5
rating: 4
location: 
counter: 
created: 20220318
url: https://thewoksoflife.com/ginger-scallion-hokkien-noodles/
---
# food.cook.ginger scallion hokkien noodles

[Hokkien Noodles with Chicken, Ginger & Scallion - The Woks of Life](https://thewoksoflife.com/ginger-scallion-hokkien-noodles/)

> [!ABSTRACT]
> For the chicken:
> 8 ounces boneless skinless chicken thighs (cut into thin strips; can substitute boneless skinless chicken breast)
> 1 teaspoon cornstarch
> 1 teaspoon vegetable oil
> 1 teaspoon light soy sauce
> To finish the dish:
> 3 tablespoons vegetable oil
> 6 slices ginger
> 8 scallions (julienned)
> 1 red chili (sliced, optional)
> 1 pound cooked hokkien noodles or fresh lo mein noodles
> 2 tablespoons Shaoxing wine (can substitute clear rice wine or dry sherry)
> 1 1/2 tablespoons light soy sauce
> 2 teaspoons dark soy sauce

thx so much for all your amazing work, its truly appreciated!

danielo515 commented 10 months ago

Hey @zeltak , thank you for your kind words. I was asking for the template where you make use of modal-form to create the output note. The way you report the plugin is saving is only if you tell it to render it like dataview. If you select to render the result as frontmatter, here is an example of what I'm getting:

toggle: false
multi_books: []
select: first
multi_2: []
multi_select_dataview: []
select-fail: ""
tags:
  - "#book"
  - "#person"
  - "#person/Química"

Or you are referring to the # prefix? If so, that is what I was asking you in my first message, about how good or bad it looks

danielo515 commented 10 months ago

In any case, I think the leading # does not look right, so I just removed it in the latest version. Let me know if it is what you expected

zeltak commented 10 months ago

Ahh @danielo515 I see, thx for clarifying.

I agree the # is not needed and glad you removed it :)

I managed to change in the quick add template the JS to asFrontmatterString() (took me a while to figure that part :)) and it now saves in YAML!!

but I think its not in proper obsidian YAML header format :)

here is my current example modal template

{
  "title": "mtest",
  "name": "mtest",
  "customClassname": "mtest",
  "fields": [
    {
      "name": "tag",
      "label": "tag",
      "description": "tags",
      "input": {
        "type": "tag"
      }
    },
    {
      "name": "status",
      "label": "status",
      "description": "status",
      "input": {
        "type": "number"
      }
    },
    {
      "name": "ratings",
      "label": "ratings",
      "description": "ratings",
      "input": {
        "type": "number"
      }
    }
  ],
  "version": "1"
}

and this is the resulting header thats generated

- [ ] tag:
  - task
  - asia
  - food
status: "3"
ratings: "4"

# Untitled

while one would expect the header to look like this


---
tags:
  - CQ
  - asia
  - noodle
  - chicken-thigh
status: 5
rating: 4
---

does that make any sense? (im basing my syntax on This https://help.obsidian.md/Editing+and+formatting/Properties)

also small usability improvement (if you dont mind: )) is that after selecting the first tag it automatically looses focus from the tag section input area, so that when adding multiple tags you need to manually refocus that area. can this area continue being focused until you move to the next form section?

a huge thx again!

Z 
danielo515 commented 10 months ago

You define it in the templater template that's why I was asking for it 😄

Let me know if following this example makes ting works as you expect: https://github.com/danielo515/obsidian-modal-form/blob/master/examples/basic%20template%20example.md?plain=1

As you can see, it adds the result of the form to the frontmatter. Is that similar to what you are doing?

About your other requirement, there is already a feature request for it: #138

zeltak commented 10 months ago

awesome works like a charm with templatar!!

thx so much @danielo515 !!

Z

danielo515 commented 10 months ago

Happy to see that it finally works for you.

El jue, 23 nov 2023, 17:01, zeltak @.***> escribió:

awesome works like a charm with templatar!!

thx so much @danielo515 https://github.com/danielo515 !!

Z

— Reply to this email directly, view it on GitHub https://github.com/danielo515/obsidian-modal-form/issues/118#issuecomment-1824661643, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARKJWP6JGB65XTTM2OJGT3YF5XPFAVCNFSM6AAAAAA66N3SDSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRUGY3DCNRUGM . You are receiving this because you were mentioned.Message ID: @.***>