diff --git a/package-lock.json b/package-lock.json index 8dcd690..e38e7c1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,7 +28,7 @@ "date-fns": "^4.1.0", "fflate": "^0.8.2", "highlight.js": "^11.11.1", - "md-editor-v3": "^6.2.1", + "md-editor-v3": "^6.3.0", "mermaid": "^11.12.2", "naive-ui": "^2.43.2", "nanoid": "^5.1.6", @@ -4530,9 +4530,9 @@ } }, "node_modules/md-editor-v3": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/md-editor-v3/-/md-editor-v3-6.2.1.tgz", - "integrity": "sha512-/9pmLG9qJ1/NmxE5e4aNmGSxWJh4vLVAd0zQ9w52YXe8I7b+xjXAQj7GRZVMxRhB9tXTjY7THiqwrNUy+9r0hQ==", + "version": "6.3.0", + "resolved": "https://registry.npmmirror.com/md-editor-v3/-/md-editor-v3-6.3.0.tgz", + "integrity": "sha512-KvrxFA7YZbrTQ5JH6nTPNnAhfDVAV1uOVUGziyds0+wyCeWL5lbuTXjFmL8/2sILPw2v0VPxCEw7SMTlUQmvzg==", "license": "MIT", "dependencies": { "@codemirror/autocomplete": "^6.18.7", diff --git a/package.json b/package.json index 3a471d2..dbc728a 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "1.8.0", "type": "module", "scripts": { - "start": "rsbuild dev", + "start": "rsbuild dev --env-mode=production", "build": "rsbuild build", "build:staging": "rsbuild build --env-mode=staging", "build:test": "rsbuild build --env-mode=test", @@ -30,7 +30,7 @@ "date-fns": "^4.1.0", "fflate": "^0.8.2", "highlight.js": "^11.11.1", - "md-editor-v3": "^6.2.1", + "md-editor-v3": "^6.3.0", "mermaid": "^11.12.2", "naive-ui": "^2.43.2", "nanoid": "^5.1.6", diff --git a/src/index.css b/src/index.css index ae8973b..3193060 100644 --- a/src/index.css +++ b/src/index.css @@ -1,3 +1,11 @@ body { height: 100vh; } + +.md-editor-dark { + --md-bk-color: var(--n-body-color) !important; +} + +.md-editor-dark div.vuepress-theme { + --md-theme-color: var(--n-text-color) !important; +} \ No newline at end of file diff --git a/src/oj/problem/components/ProblemContent.vue b/src/oj/problem/components/ProblemContent.vue index 0a1b543..f111f9b 100644 --- a/src/oj/problem/components/ProblemContent.vue +++ b/src/oj/problem/components/ProblemContent.vue @@ -7,6 +7,9 @@ import { useProblemStore } from "oj/store/problem" import { createTestSubmission } from "utils/judge" import { Problem, ProblemStatus } from "utils/types" import Copy from "shared/components/Copy.vue" +import { useDark } from "@vueuse/core" +import { MdPreview } from "md-editor-v3" +import "md-editor-v3/lib/preview.css" type Sample = Problem["samples"][number] & { id: number @@ -17,7 +20,7 @@ type Sample = Problem["samples"][number] & { const theme = useThemeVars() const style = computed(() => "color: " + theme.value.primaryColor) - +const isDark = useDark() const route = useRoute() const codeStore = useCodeStore() const problemStore = useProblemStore() @@ -25,10 +28,6 @@ const { problem } = storeToRefs(problemStore) const problemSetId = computed(() => route.params.problemSetId) -// 判断用户是否尝试过但未通过 -// my_status === 0: 已通过 -// my_status !== 0 && my_status !== null: 尝试过但未通过 -// my_status === null: 从未尝试 const hasTriedButNotPassed = computed(() => { return ( problem.value?.my_status !== undefined && @@ -108,7 +107,7 @@ function type(status: ProblemStatus) {