fix: Flash of external link decoration when creating doc from selected text
This commit is contained in:
@@ -75,6 +75,11 @@ export function isUrl(text: string, options?: { requireHostname: boolean }) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Temporary prefix applied to links in document that are not yet persisted.
|
||||
*/
|
||||
export const creatingUrlPrefix = "creating#";
|
||||
|
||||
/**
|
||||
* Returns true if the given string is a link to outside the application.
|
||||
*
|
||||
@@ -82,7 +87,7 @@ export function isUrl(text: string, options?: { requireHostname: boolean }) {
|
||||
* @returns True if the url is external, false otherwise.
|
||||
*/
|
||||
export function isExternalUrl(url: string) {
|
||||
return !!url && !isInternalUrl(url);
|
||||
return !!url && !isInternalUrl(url) && !url.startsWith(creatingUrlPrefix);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user