From 02bd19490cdcc8464b1ab295cbac3f49bfb229f4 Mon Sep 17 00:00:00 2001 From: Khushvendra Date: Wed, 8 Apr 2026 14:51:26 +0530 Subject: [PATCH] refactor: align room mention labels with link rendering --- src/app/components/ContentLinkBlock.svelte | 52 +++++++++++++++------ src/app/components/ContentLinkInline.svelte | 51 ++++++++++++++------ src/app/core/state.ts | 2 + src/app/editor/RoomReferenceNodeView.ts | 3 +- src/app/editor/RoomSuggestion.svelte | 7 +-- src/app/editor/index.ts | 17 +++---- 6 files changed, 94 insertions(+), 38 deletions(-) diff --git a/src/app/components/ContentLinkBlock.svelte b/src/app/components/ContentLinkBlock.svelte index d73c3047..9d79e203 100644 --- a/src/app/components/ContentLinkBlock.svelte +++ b/src/app/components/ContentLinkBlock.svelte @@ -1,6 +1,6 @@ -
-
~{$room.name || h}
-
{displayRelayUrl(url)}'{h}
+
+ {label}
diff --git a/src/app/editor/index.ts b/src/app/editor/index.ts index 46432657..69f3e5c6 100644 --- a/src/app/editor/index.ts +++ b/src/app/editor/index.ts @@ -27,7 +27,13 @@ import ProfileSuggestion from "@app/editor/ProfileSuggestion.svelte" import {RoomReferenceExtension} from "@app/editor/RoomReferenceExtension" import RoomSuggestion from "@app/editor/RoomSuggestion.svelte" import {uploadFile} from "@app/core/commands" -import {deriveSpaceMembers, splitRoomId, userSpaceUrls, roomsByUrl} from "@app/core/state" +import { + deriveSpaceMembers, + splitRoomId, + userSpaceUrls, + roomsByUrl, + type Room, +} from "@app/core/state" import {pushToast} from "@app/util/toast" export const makeEditor = async ({ @@ -93,16 +99,11 @@ export const makeEditor = async ({ const roomReferenceSearch = derived( [throttled(800, userSpaceUrls), throttled(800, roomsByUrl)], ([$userSpaceUrls, $roomsByUrl]) => { - const options: Array<{id: string; name: string; h: string; url: string}> = [] + const options: Room[] = [] for (const roomUrl of $userSpaceUrls) { for (const room of $roomsByUrl.get(roomUrl) || []) { - options.push({ - id: room.id, - name: room.name || "", - h: room.h, - url: roomUrl, - }) + options.push(room) } }