diff --git a/src/components/CodemirrorEditor/CssEditor.vue b/src/components/CodemirrorEditor/CssEditor.vue index 09a6a77..698b9a6 100644 --- a/src/components/CodemirrorEditor/CssEditor.vue +++ b/src/components/CodemirrorEditor/CssEditor.vue @@ -1,69 +1,114 @@ diff --git a/src/components/CodemirrorEditor/EditorHeader/StyleDropdown.vue b/src/components/CodemirrorEditor/EditorHeader/StyleDropdown.vue index b004a5e..d24bcaf 100644 --- a/src/components/CodemirrorEditor/EditorHeader/StyleDropdown.vue +++ b/src/components/CodemirrorEditor/EditorHeader/StyleDropdown.vue @@ -12,7 +12,6 @@ import { legendOptions, themeOptions, } from '@/config' - import { useDisplayStore, useStore } from '@/stores' import { storeToRefs } from 'pinia' import { ref } from 'vue' diff --git a/src/components/CodemirrorEditor/EditorHeader/index.vue b/src/components/CodemirrorEditor/EditorHeader/index.vue index 2a019c5..892dd3c 100644 --- a/src/components/CodemirrorEditor/EditorHeader/index.vue +++ b/src/components/CodemirrorEditor/EditorHeader/index.vue @@ -1,15 +1,4 @@ + + diff --git a/src/components/ui/input/index.ts b/src/components/ui/input/index.ts new file mode 100644 index 0000000..a691dd6 --- /dev/null +++ b/src/components/ui/input/index.ts @@ -0,0 +1 @@ +export { default as Input } from './Input.vue' diff --git a/src/stores/index.ts b/src/stores/index.ts index 6e66447..e315a5f 100644 --- a/src/stores/index.ts +++ b/src/stores/index.ts @@ -265,6 +265,8 @@ export const useStore = defineStore(`store`, () => { updateCss() editorRefresh() + + toast.success(`样式重置成功~`) } // 为函数添加刷新编辑器的功能 @@ -370,25 +372,11 @@ export const useStore = defineStore(`store`, () => { body.removeChild(input) } + const isOpenConfirmDialog = ref(false) + // 重置样式 const resetStyleConfirm = () => { - // ElMessageBox.confirm( - // `此操作将丢失本地自定义样式,是否继续?`, - // `提示`, - // { - // confirmButtonText: `确定`, - // cancelButtonText: `取消`, - // type: `warning`, - // center: true, - // }, - // ) - // .then(() => { - resetStyle() - toast.success(`样式重置成功~`) - // }) - // .catch(() => { - // (editor.value!).focus() - // }) + isOpenConfirmDialog.value = true } return { @@ -430,7 +418,9 @@ export const useStore = defineStore(`store`, () => { importMarkdownContent, + isOpenConfirmDialog, resetStyleConfirm, + resetStyle, editorContent, cssContentConfig, diff --git a/src/views/CodemirrorEditor.vue b/src/views/CodemirrorEditor.vue index db98a72..886e95e 100644 --- a/src/views/CodemirrorEditor.vue +++ b/src/views/CodemirrorEditor.vue @@ -5,6 +5,16 @@ import EditorHeader from '@/components/CodemirrorEditor/EditorHeader/index.vue' import InsertFormDialog from '@/components/CodemirrorEditor/InsertFormDialog.vue' import UploadImgDialog from '@/components/CodemirrorEditor/UploadImgDialog.vue' import RunLoading from '@/components/RunLoading.vue' +import { + AlertDialog, + AlertDialogAction, + AlertDialogCancel, + AlertDialogContent, + AlertDialogDescription, + AlertDialogFooter, + AlertDialogHeader, + AlertDialogTitle, +} from '@/components/ui/alert-dialog' import { ContextMenu, ContextMenuContent, @@ -13,7 +23,6 @@ import { ContextMenuShortcut, ContextMenuTrigger, } from '@/components/ui/context-menu' - import { altKey, altSign, ctrlKey, shiftKey, shiftSign } from '@/config' import { useDisplayStore, useStore } from '@/stores' import { @@ -128,7 +137,7 @@ function beforeUpload(file: File) { // validate image const checkResult = checkImage(file) if (!checkResult.ok) { - toast.error(checkResult.msg) + toast.error(checkResult.msg!) return false } @@ -461,6 +470,23 @@ onMounted(() => { + + + + + 提示 + + 此操作将丢失本地自定义样式,是否继续? + + + + 取消 + + 确认 + + + +