refactor(frontend): use symbol for di

This commit is contained in:
syuilo 2025-03-29 16:04:01 +09:00
parent e5e4390494
commit 6c2c3f08be
3 changed files with 4 additions and 2 deletions

View File

@ -50,6 +50,7 @@ import { deviceKind } from '@/utility/device-kind.js';
import { focusTrap } from '@/utility/focus-trap.js';
import { focusParent } from '@/utility/focus.js';
import { prefer } from '@/preferences.js';
import { DI } from '@/di.js';
function getFixedContainer(el: Element | null): Element | null {
if (el == null || el.tagName === 'BODY') return null;
@ -94,7 +95,7 @@ const emit = defineEmits<{
(ev: 'closed'): void;
}>();
provide('modal', true);
provide(DI.inModal, true);
const maxHeight = ref<number>();
const fixed = ref(false);

View File

@ -140,7 +140,7 @@ import { DI } from '@/di.js';
const $i = ensureSignin();
const modal = inject('modal');
const modal = inject(DI.inModal, false);
const props = withDefaults(defineProps<PostFormProps & {
fixed?: boolean;

View File

@ -15,4 +15,5 @@ export const DI = {
currentStickyTop: Symbol() as InjectionKey<Ref<number>>,
currentStickyBottom: Symbol() as InjectionKey<Ref<number>>,
mfmEmojiReactCallback: Symbol() as InjectionKey<(emoji: string) => void>,
inModal: Symbol() as InjectionKey<boolean>,
};