From cc5b408e79e751d190455002f425432fd5262985 Mon Sep 17 00:00:00 2001 From: biast12 <53872542+biast12@users.noreply.github.com> Date: Sun, 6 Sep 2026 13:52:52 +0200 Subject: [PATCH] Add embed title URL input and preview link Adds a new "Title URL" field to embed editors in the tag modal and KB create/edit pages, wired to `embed.url` with existing URL length limits. Embed previews now render the title as a clickable link (with Discord-like link styling) when a safe URL is provided, while preserving the plain title fallback when no valid URL exists. --- frontend/src/components/EmbedPreview.tsx | 13 ++++++++++++- frontend/src/components/modals/TagEditorModal.tsx | 8 ++++++++ frontend/src/pages/manage/kb/create.tsx | 8 ++++++++ frontend/src/pages/manage/kb/edit.tsx | 8 ++++++++ 4 files changed, 36 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/EmbedPreview.tsx b/frontend/src/components/EmbedPreview.tsx index 1403bb0d..983871de 100644 --- a/frontend/src/components/EmbedPreview.tsx +++ b/frontend/src/components/EmbedPreview.tsx @@ -36,6 +36,7 @@ const EmbedPreview: FC = ({ embed, raw = false }) => { const authorIconUrl = previewAvatarUrl(embed.author?.icon_url); const authorUrl = previewAvatarUrl(embed.author?.url); const footerIconUrl = previewAvatarUrl(embed.footer?.icon_url); + const titleUrl = previewAvatarUrl(embed.url); // Group fields into rows: inline fields share a row (max 3), non-inline get their own const fieldRows: EmbedField[][] = []; @@ -90,7 +91,17 @@ const EmbedPreview: FC = ({ embed, raw = false }) => { {embed.author.name} ) : null} - + {titleUrl && isSafeUrl(titleUrl) && embed.title ? ( + + + + ) : ( + + )} {embed.description && ( )} diff --git a/frontend/src/components/modals/TagEditorModal.tsx b/frontend/src/components/modals/TagEditorModal.tsx index b1fe768e..a55ec935 100644 --- a/frontend/src/components/modals/TagEditorModal.tsx +++ b/frontend/src/components/modals/TagEditorModal.tsx @@ -291,6 +291,14 @@ const TagEditorModal: FC = ({ /> + setEmbed((prev) => ({ ...prev, url: v }))} + maxLength={EMBED_LIMITS.URL} + /> +