From f7a9e8203780737f5ddc3a4d007e6cb70b2d48b8 Mon Sep 17 00:00:00 2001 From: Philipinho <16838612+Philipinho@users.noreply.github.com> Date: Tue, 24 Mar 2026 11:43:45 +0000 Subject: [PATCH] fix --- .../src/features/editor/components/link/link-menu.tsx | 2 +- .../src/features/editor/components/link/link-view.tsx | 7 +------ apps/client/src/lib/utils.tsx | 6 ++++++ 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/apps/client/src/features/editor/components/link/link-menu.tsx b/apps/client/src/features/editor/components/link/link-menu.tsx index e61a586c..4517a79d 100644 --- a/apps/client/src/features/editor/components/link/link-menu.tsx +++ b/apps/client/src/features/editor/components/link/link-menu.tsx @@ -5,7 +5,7 @@ import { useAtom } from "jotai"; import { isTextSelected } from "@docmost/editor-ext"; import { showLinkMenuAtom } from "@/features/editor/atoms/editor-atoms"; import { LinkEditorPanel } from "@/features/editor/components/link/link-editor-panel"; -import { normalizeUrl } from "@/features/editor/components/link/link-view"; +import { normalizeUrl } from "@/lib/utils"; import { TextSelection } from "@tiptap/pm/state"; import { Paper } from "@mantine/core"; diff --git a/apps/client/src/features/editor/components/link/link-view.tsx b/apps/client/src/features/editor/components/link/link-view.tsx index 90b89e82..46227ef9 100644 --- a/apps/client/src/features/editor/components/link/link-view.tsx +++ b/apps/client/src/features/editor/components/link/link-view.tsx @@ -29,12 +29,7 @@ import { useSharePageQuery } from "@/features/share/queries/share-query.ts"; import { buildSharedPageUrl } from "@/features/page/page.utils.ts"; import { extractPageSlugId } from "@/lib"; import { sanitizeUrl, copyToClipboard } from "@docmost/editor-ext"; - -export const normalizeUrl = (url: string): string => { - if (!url) return url; - if (url.startsWith("/") || /^(\S+):(\/\/)?\S+$/.test(url)) return url; - return `https://${url}`; -}; +import { normalizeUrl } from "@/lib/utils"; const parseInternalLink = ( href: string, diff --git a/apps/client/src/lib/utils.tsx b/apps/client/src/lib/utils.tsx index e9c39267..b5da9c7a 100644 --- a/apps/client/src/lib/utils.tsx +++ b/apps/client/src/lib/utils.tsx @@ -94,6 +94,12 @@ export function getPageIcon(icon: string, size = 18): string | ReactNode { ); } +export const normalizeUrl = (url: string): string => { + if (!url) return url; + if (url.startsWith("/") || /^(\S+):(\/\/)?\S+$/.test(url)) return url; + return `https://${url}`; +}; + export function castToBoolean(value: unknown): boolean { if (value == null) { return false;