foam icon indicating copy to clipboard operation
foam copied to clipboard

Allow users to select the foam template as creating a new note by clicking on the link in the preview popup

Open ansidev opened this issue 3 years ago • 2 comments

Is your feature request related to a problem? Please describe.

Steps to produce:

  1. Open a foam project which contains foam templates, then open a markdown file.
  2. Add a new wiki link, ex. [[wiki-link| Wiki Link]], the associated markdown file was not created.
  3. Hover on the wiki link.
  4. Wait to see the preview popup, then click on Create note for 'wiki-link'.
  5. The file was created without asking user to select the foam template.

Describe the solution you'd like

As a user, I expect I can select the foam template after clicking on the link, similar to the feature Create new note from template.

Describe alternatives you've considered

I have some suggestions: 1 Change behaviour on clicking on the preview popup link. 2. Keep it, but add a new link to allow create a new note from the foam template. 3. Add a setting to allow users to choose the behaviour they want.

Screenshots or Videos

No response

ansidev avatar May 10 '22 01:05 ansidev

I like this suggestion, maybe what could be done is that if a user clicks cmd+alt+click instead of simply cmd+click it gets prompted.

Related, but independent: another idea might be to have a hook that gets called when clicking on a wikilink with a signature along the lines of:

function getTemplateForWikilink(availableTemplates: Template[], souceNote: Resource, link: ResourceLink): Template?

which returns the Template to use, or undefined which would trigger the pop-up for template selection. It requires some additional thinking (e.g. how does it interface with the existing template configuration), but I in general like the "hook" based approach.

riccardoferretti avatar Jul 05 '22 08:07 riccardoferretti

(cc @movermeyer given all the previous work he did around templates)

riccardoferretti avatar Jul 05 '22 08:07 riccardoferretti