-
Notifications
You must be signed in to change notification settings - Fork 0
Resolve raw Roam UIDs and block references in Manage #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,5 @@ | ||
| # Changelog | ||
|
|
||
| ## Unreleased | ||
|
|
||
| - Allow Manage to resolve raw Roam UIDs and `((block reference))` inputs directly. |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -6,9 +6,9 @@ import { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| buildRoamPageUrl, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| createBookmarkId, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| deriveBlockTitle, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| extractBlockRefUid, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getBookmarkTargetType, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getBookmarkTargetUid, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| parseRoamUid, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| parsePageUidFromUrl, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } from "~/utils/quickSwitcher"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -87,10 +87,10 @@ const isPageUrlInput = ({ entry }: { entry: string }): boolean => | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const getUidFromEntryInput = ({ value }: { value: string }): string => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const normalizedValue = value.trim(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| extractBlockRefUid({ value: normalizedValue }) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| parseRoamUid({ value: normalizedValue }) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (isPageUrlInput({ entry: normalizedValue }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ? parsePageUidFromUrl({ url: normalizedValue }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| : normalizedValue) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| : null) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+90
to
+93
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Adding an entry by a custom-length Roam ID or block reference no longer works Inputs are now only accepted as IDs when they are exactly 9-10 characters long ( How the stricter ID validation removes previously working pathsBefore this change, Now the non-URL branch returns Prompt for agentsWas this helpful? React with 👍 or 👎 to provide feedback. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -245,6 +245,19 @@ export const searchEntries = async ({ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| savedTargetKeys: Set<string>; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| searchApi?: RoamSearchApi; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }): Promise<QuickSwitcherEntrySuggestion[]> => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const directUid = getUidFromEntryInput({ value: query }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (directUid) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const directSuggestion = await resolveUidToSuggestion({ uid: directUid }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| directSuggestion && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| !savedTargetKeys.has( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getSuggestionTargetKey({ suggestion: directSuggestion }), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return [directSuggestion]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+248
to
+259
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Blocks found by pasting an ID are saved without their parent trail A block found directly from a pasted identifier is returned immediately ( Breadcrumb enrichment is skipped on the direct pathThe text-search path ends with
Suggested change
Was this helpful? React with 👍 or 👎 to provide feedback. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const options: RoamSearchOptions = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "hide-code-blocks": false, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| limit: MAX_SEARCH_RESULTS, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The imported
BLOCK_REF_REGEXis global, sovalue.match(BLOCK_REF_REGEX)returns only complete matches rather than capture groups. For a single input such as((acW-i9uMD)),match[1]is therefore undefined, causingparseRoamUidto returnnulland preventing the new direct-resolution path; with multiple references it can even return the second full reference as the UID. Use a non-global regex or extract the capture with an appropriateexec/match-all strategy.Useful? React with 👍 / 👎.