From 035075b23bc884c2ef0700f87f5e4d303efc4a08 Mon Sep 17 00:00:00 2001 From: Ngo Quoc Dat Date: Sun, 29 Sep 2024 00:02:05 +0700 Subject: [PATCH] wip --- framework/core/js/dist-typings/common/Application.d.ts | 1 + .../core/js/src/admin/components/EditGroupModal.tsx | 2 +- framework/core/js/src/common/Application.tsx | 5 +++++ framework/core/js/src/common/references.ts | 10 ++++++++++ 4 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 framework/core/js/src/common/references.ts diff --git a/framework/core/js/dist-typings/common/Application.d.ts b/framework/core/js/dist-typings/common/Application.d.ts index 6197af90b7..0575a6c1d6 100644 --- a/framework/core/js/dist-typings/common/Application.d.ts +++ b/framework/core/js/dist-typings/common/Application.d.ts @@ -192,6 +192,7 @@ export default class Application { pane: any; data: ApplicationData; allowUserColorScheme: boolean; + refs: Record; private _title; private _titleCount; private set title(value); diff --git a/framework/core/js/src/admin/components/EditGroupModal.tsx b/framework/core/js/src/admin/components/EditGroupModal.tsx index 8a0bd4161e..b9be5e7888 100644 --- a/framework/core/js/src/admin/components/EditGroupModal.tsx +++ b/framework/core/js/src/admin/components/EditGroupModal.tsx @@ -89,7 +89,7 @@ export default class EditGroupModal
- {app.translator.trans('core.admin.edit_group.icon_text', { a: })} + {app.translator.trans('core.admin.edit_group.icon_text', { a: })}
, diff --git a/framework/core/js/src/common/Application.tsx b/framework/core/js/src/common/Application.tsx index f607f06f58..b36ff4c56b 100644 --- a/framework/core/js/src/common/Application.tsx +++ b/framework/core/js/src/common/Application.tsx @@ -39,6 +39,7 @@ import IExtender from './extenders/IExtender'; import AccessToken from './models/AccessToken'; import SearchManager from './SearchManager'; import { ColorScheme } from './components/ThemeMode'; +import references from './references'; export type FlarumScreens = 'phone' | 'tablet' | 'desktop' | 'desktop-hd'; @@ -248,6 +249,8 @@ export default class Application { allowUserColorScheme!: boolean; + refs: Record = {}; + private _title: string = ''; private _titleCount: number = 0; @@ -320,6 +323,8 @@ export default class Application { this.initialRoute = window.location.href; caughtInitializationErrors.forEach((handler) => handler()); + + references(this); } protected beforeMount(): void { diff --git a/framework/core/js/src/common/references.ts b/framework/core/js/src/common/references.ts new file mode 100644 index 0000000000..96b4592356 --- /dev/null +++ b/framework/core/js/src/common/references.ts @@ -0,0 +1,10 @@ +import Application from './Application'; + +/** + * The `references` initializer defines references to external resources. + */ +export default function (app: Application) { + app.refs = { + fontawesome: 'https://fontawesome.com/v6/icons?o=r&m=free', + }; +}