fix: chat accepts quotes now
This commit is contained in:
@@ -303,6 +303,18 @@ export function buildSearchResultUrl(
|
||||
/**
|
||||
* Build the full URL with highlight fragment for the selected text.
|
||||
*/
|
||||
/**
|
||||
* The highlight link as an app-relative path ("/books/bg/2/13?hl=…").
|
||||
*
|
||||
* Chat quotes store a path rather than a full URL: the BFF refuses absolute
|
||||
* links there, since a quote renders as trusted in-app content and must not be
|
||||
* able to carry the reader off-site.
|
||||
*/
|
||||
export function buildHighlightPath(selectedText: string): string {
|
||||
const url = new URL(buildHighlightUrl(selectedText));
|
||||
return url.pathname + url.search + url.hash;
|
||||
}
|
||||
|
||||
export function buildHighlightUrl(selectedText: string): string {
|
||||
const fragment = encodeTextFragment(selectedText);
|
||||
if (!fragment) return window.location.href;
|
||||
|
||||
Reference in New Issue
Block a user