From a834470ae339d328092062600926a491b4a35165 Mon Sep 17 00:00:00 2001 From: Medvedeva Valentina Date: Sun, 19 Nov 2023 17:46:06 +0300 Subject: [PATCH] fix: returned previous naming --- src/application/services/useAppState.ts | 11 +++++------ src/presentation/components/editor/Editor.vue | 12 ++++++------ src/presentation/pages/Settings.vue | 4 ++-- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/application/services/useAppState.ts b/src/application/services/useAppState.ts index d311e997..ff14989e 100644 --- a/src/application/services/useAppState.ts +++ b/src/application/services/useAppState.ts @@ -16,8 +16,7 @@ interface UseAppStateComposable { /** * User editor tools that are used in notes creation */ - editorTools: Ref - + userEditorTools: Ref } /** @@ -32,22 +31,22 @@ export const useAppState = createSharedComposable((): UseAppStateComposable => { /** * User editor tools that are used in notes creation */ - const editorTools = ref([]); + const userEditorTools = ref([]); /** * Subscribe to user changes in the App State */ - AppStateController.user((prop: 'user' | 'editorTools', value: User | EditorTool[] | null) => { + AppStateController.user((prop: 'user' | 'editorTools', value: User | EditorTool[] | null) => { if (prop === 'user') { user.value = value as User; } if (prop === 'editorTools') { - editorTools.value = value as EditorTool[]; + userEditorTools.value = value as EditorTool[]; } }); return { user, - editorTools, + userEditorTools, }; }); diff --git a/src/presentation/components/editor/Editor.vue b/src/presentation/components/editor/Editor.vue index 9664754b..f98f0594 100644 --- a/src/presentation/components/editor/Editor.vue +++ b/src/presentation/components/editor/Editor.vue @@ -37,7 +37,7 @@ import EditorTool from '@/domain/entities/EditorTool'; import { useAppState } from '@/application/services/useAppState'; -const { editorTools } = useAppState(); +const { userEditorTools } = useAppState(); /** @@ -132,7 +132,7 @@ const mountEditorOnce = async () => { console.log('mount'); isEditorMounted.value = true; - Promise.allSettled(editorTools.value.map((spec: EditorTool) => { + Promise.allSettled(userEditorTools.value.map((spec: EditorTool) => { if (!spec.source.cdn) { return; } @@ -140,7 +140,7 @@ const mountEditorOnce = async () => { return loadScript(spec.source.cdn); })).then(async () => { // eslint-disable-next-line @typescript-eslint/no-explicit-any - const loadedTools: {[key: string]: any } = editorTools.value.reduce( + const loadedTools: {[key: string]: any } = userEditorTools.value.reduce( (acc, spec: EditorTool) => { // @ts-expect-error: we need to rewrite plugins to TS to get their types const windowPlugin = window[spec.exportName]; @@ -193,10 +193,10 @@ const mountEditorOnce = async () => { }); }; -watch(editorTools, mountEditorOnce); +watch(userEditorTools, mountEditorOnce); onMounted(() => { - console.log('mount', editorTools.value); - if (editorTools.value.length > 0) { + console.log('mount', userEditorTools.value); + if (userEditorTools.value.length > 0) { mountEditorOnce(); } }); diff --git a/src/presentation/pages/Settings.vue b/src/presentation/pages/Settings.vue index ffebfbae..0b95644f 100644 --- a/src/presentation/pages/Settings.vue +++ b/src/presentation/pages/Settings.vue @@ -2,7 +2,7 @@

{{ t("settings.title") }}

{{ t("settings.userEditorTools") }}:

  • @@ -31,7 +31,7 @@ import ThemeButton from '@/presentation/components/theme/ThemeButton.vue'; import { useAppState } from '@/application/services/useAppState'; import { useUserSettings } from '@/application/services/useUserSettings'; -const { editorTools } = useAppState(); +const { userEditorTools } = useAppState(); const { t } = useI18n(); const { addTool: addToolToUser } = useUserSettings();