From 31410fe4ef0b9b159d2d3453a20c703a49dbe905 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 14 Oct 2025 15:31:42 +0100 Subject: [PATCH] Add actual module api bits --- src/modules/Api.ts | 2 ++ src/modules/Navigation.ts | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/modules/Api.ts b/src/modules/Api.ts index 1f72784bd6..66aed73583 100644 --- a/src/modules/Api.ts +++ b/src/modules/Api.ts @@ -26,6 +26,7 @@ import { WatchableProfile } from "./Profile.ts"; import { NavigationApi } from "./Navigation.ts"; import { openDialog } from "./Dialog.tsx"; import { overwriteAccountAuth } from "./Auth.ts"; +import { ElementWebExtrasApi } from "./ExtrasApi.ts"; const legacyCustomisationsFactory = (baseCustomisations: T) => { let used = false; @@ -69,6 +70,7 @@ class ModuleApi implements Api { public readonly config = new ConfigApi(); public readonly i18n = new I18nApi(); public readonly customComponents = new CustomComponentsApi(); + public readonly extras = new ElementWebExtrasApi(); public readonly rootNode = document.getElementById("matrixchat")!; public createRoot(element: Element): Root { diff --git a/src/modules/Navigation.ts b/src/modules/Navigation.ts index 0e7724727d..52bdb5aee9 100644 --- a/src/modules/Navigation.ts +++ b/src/modules/Navigation.ts @@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Com Please see LICENSE files in the repository root for full details. */ -import { type NavigationApi as INavigationApi } from "@element-hq/element-web-module-api"; +import { type LocationRenderFunction, type NavigationApi as INavigationApi } from "@element-hq/element-web-module-api"; import { navigateToPermalink } from "../utils/permalinks/navigator.ts"; import { parsePermalink } from "../utils/permalinks/Permalinks.ts"; @@ -14,6 +14,8 @@ import { Action } from "../dispatcher/actions.ts"; import type { ViewRoomPayload } from "../dispatcher/payloads/ViewRoomPayload.ts"; export class NavigationApi implements INavigationApi { + public locationRenderers = new Map(); + public async toMatrixToLink(link: string, join = false): Promise { navigateToPermalink(link); @@ -38,4 +40,8 @@ export class NavigationApi implements INavigationApi { } } } + + public registerLocationRenderer(path: string, renderer: LocationRenderFunction): void { + this.locationRenderers.set(path, renderer); + } }