From d8a3d063304cef357934de15647706f7bb06386c Mon Sep 17 00:00:00 2001 From: YangFong Date: Tue, 17 Sep 2024 15:58:39 +0800 Subject: [PATCH] feat: add more style option (#414) --- .../EditorHeader/StyleDropdown.vue | 5 -- .../CodemirrorEditor/EditorHeader/index.vue | 46 ++++++++++++++++++- src/utils/index.ts | 2 - 3 files changed, 45 insertions(+), 8 deletions(-) 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) +}