diff --git a/src/components/CodemirrorEditor/EditorHeader/StyleDropdown.vue b/src/components/CodemirrorEditor/EditorHeader/StyleDropdown.vue index 9d2a9a4..54ab741 100644 --- a/src/components/CodemirrorEditor/EditorHeader/StyleDropdown.vue +++ b/src/components/CodemirrorEditor/EditorHeader/StyleDropdown.vue @@ -52,11 +52,6 @@ function showPicker() { // 自定义CSS样式 function customStyle() { toggleShowCssEditor() - nextTick(() => { - if (!cssEditor.value) { - cssEditor.value!.refresh() - } - }) setTimeout(() => { cssEditor.value!.refresh() }, 50) diff --git a/src/components/CodemirrorEditor/EditorHeader/index.vue b/src/components/CodemirrorEditor/EditorHeader/index.vue index 51b7f01..14b1d57 100644 --- a/src/components/CodemirrorEditor/EditorHeader/index.vue +++ b/src/components/CodemirrorEditor/EditorHeader/index.vue @@ -43,7 +43,7 @@ import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover import { Button } from '@/components/ui/button' import { mergeCss, solveWeChatImage } from '@/utils' -import { useStore } from '@/stores' +import { useDisplayStore, useStore } from '@/stores' const emit = defineEmits([`addFormat`, `formatContent`, `startCopy`, `endCopy`]) @@ -81,6 +81,7 @@ const formatItems = [ ] as const const store = useStore() +const displayStore = useDisplayStore() const { isDark, isCiteStatus, output, primaryColor } = storeToRefs(store) @@ -153,6 +154,13 @@ function copy() { }) }, 350) } + +function customStyle() { + displayStore.toggleShowCssEditor() + setTimeout(() => { + store.cssEditor!.refresh() + }, 50) +}