web: create a note directly from the internal link picker#10050
Open
the0s1s wants to merge 5 commits into
Open
web: create a note directly from the internal link picker#10050the0s1s wants to merge 5 commits into
the0s1s wants to merge 5 commits into
Conversation
The internal-link picker only searched existing notes, so typing the name of a note that does not exist left an empty list with no way forward. When the typed name matches no existing note (exact, case-insensitive title check against non-trashed notes), show a "Create note" action that creates the note via db.notes.add and inserts the nn://note link in one step. Signed-off-by: Dru Banks <dru.l.banks@pm.me>
Typing a name that matches no existing note in the internal link dialog now offers to create that note and link to it in a single step. These end-to-end tests cover that path: the first checks the create action appears, creates the note, and inserts an nn://note link into the current note; the second verifies the action is not offered when a note with that title already exists. To support the tests, this adds a few hooks to the note-linking dialog (a testId on the dialog plus ids on the search field and create button) and a small openNoteLinkDialog() helper on the editor model. Signed-off-by: Dru Banks <dru.l.banks@pm.me>
Author
|
Related to issue #10045 |
01zulfi
requested changes
Jul 3, 2026
Signed-off-by: Dru Banks <dru.l.banks@pm.me>
thecodrr
requested changes
Jul 7, 2026
Address review feedback on the note-linking dialog: drop the raw db.sql()
LIKE query used to detect an existing note and replace it with the core
collection API, db.notes.all.find((eb) => eb("notes.title", "==", query)).
The notes.title column is COLLATE NOCASE, so "==" is a case-insensitive
full-string match (no LIKE wildcard hazard) and db.notes.all excludes
trashed/archived notes.
Also scope the picker's list search to titles via
db.lookup.notes("title: <query>") instead of the default title+content
full-text search.
Signed-off-by: Dru Banks <dru.l.banks@pm.me>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The internal-link picker only searched existing notes, so typing the name of a
note that does not exist left an empty list with no way forward.
This adds a "Create note" action to the picker. When the typed name matches no
existing note (an exact, case-insensitive title check against non-trashed
notes), the picker offers to create that note and insert the
nn://notelinkin a single step.
Implementation notes:
LIKEmatch (no wildcards), which is acase-insensitive full-string comparison, filtered to exclude trashed notes.
The fuzzy full-text lookup that populates the list cannot answer "does an
exact note with this title exist", so the check is a separate query.
db.notes.add({ title }), refreshes the notestore, and closes the dialog with the new note's
nn://notelink.Type of Change
Visuals
Testing
If tests were not added, explain why
Tests were added:
apps/web/__e2e__/note-linking.test.tscovers both paths:one test types a title matching no note, asserts the create action appears,
creates the note, and confirms an
nn://notelink is inserted into the currentnote and the new note appears in the list; the second types an existing note's
title and asserts the create action is not offered.
E2E and integration suites were not run to green locally. The web e2e suite
could not load until a separate cross-package Playwright fix (see the
fix/web-e2e-duplicate-playwrightbranch), and the local machine cannot extractPlaywright browser binaries. The suite does load and discover these tests; they
are expected to run in CI where browsers are provisioned.
Platform
Sign-off