suchnsuch / Tangent

The publicly-available modules of the Tangent project.
65 stars 5 forks source link

Be able to click on wiki links from the query editor. #28

Open taylorhadden opened 5 months ago

taylorhadden commented 5 months ago

When writing a query, wiki links can be used to reference a particular file by name: e.g. Notes with [[Some Note]] will find all notes that link to a file called "Some Note". It would be a nice quality-of-life improvement if [[Some Note]] could be clicked on in the query editor to go to that file, just as you would normally in a note.


This issue is marked as "good first issue", more because it crosses a number of aspects of the code base than because it is simple.

The query editor is defined in QueryTextEditor.svelte and QueryEditor.ts. It is used in QuerySettingsView.svelte. We want clicking behavior similar to the functionality defined in NoteEditor.svelte and MarkdownEditor.ts.

The actual wiki links are rendered out separately. We're going to need to create a custom handler that wraps tokens marked as wikilink by the query parser. That will need to be done in QueryEditor/editorModule.ts and queryModel/typewriterTypes. If done correctly, we can probably use the same t-linkModule.ts module used in MarkdownEditor.ts.

qunm00 commented 1 month ago

I am playing around with Tangent's code base and working on this issue. I need to clarify a few things regarding the query editor.

Below are the screenshots of the view that I think it's a query editor. I think wiki links are the links to the notes in the result.

Query editor displays results in a list of cards in the first screenshot. Query editor displays results as a feed in the second screenshot.

As a list of cards, when I use Ctrl+Click on the wiki link. Tangent opens the result note instead of the linked note. Since it's a card, I think this behavior is expected. As a feed, Tangent opens the linked note instead.

I am not sure what else needs to be done unless I misunderstood query editor and wiki links.

Screenshot from 2024-05-11 18-07-33

Screenshot from 2024-05-11 18-07-18

taylorhadden commented 1 month ago

Hi qunm00! The behavior you're describing is intended, but not the subject of this issue. This issue is about being able to click on wiki links within the query editor itself.

e.g. In Notes with [[Another Note]] with 'some line', you should be able to click on [[Another Note]] to go to that note.

If I'm going to mark this as "good first issue", I should probably leave a better description and breadcrumbs! I'll do that.