From 30a36098383e29c39c64ae6836ece94dc88be294 Mon Sep 17 00:00:00 2001
From: yuetsh <517252939@qq.com>
Date: Tue, 11 Jun 2024 19:32:43 +0800
Subject: [PATCH] renew text editor
---
src/admin/problem/detail.vue | 44 +++++++++++++++-------------
src/oj/problem/detail.vue | 4 +--
src/shared/components/TextEditor.vue | 30 ++++++++++++++++++-
vite.config.ts | 2 +-
4 files changed, 56 insertions(+), 24 deletions(-)
diff --git a/src/admin/problem/detail.vue b/src/admin/problem/detail.vue
index 090d9a2..a8a8a7e 100644
--- a/src/admin/problem/detail.vue
+++ b/src/admin/problem/detail.vue
@@ -422,26 +422,30 @@ watch([fromExistingTags, newTags], (tags) => {
/>
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
{
>
-
+
@@ -77,7 +77,7 @@ onBeforeUnmount(() => {
-
+
diff --git a/src/shared/components/TextEditor.vue b/src/shared/components/TextEditor.vue
index 82fa10d..5740889 100644
--- a/src/shared/components/TextEditor.vue
+++ b/src/shared/components/TextEditor.vue
@@ -24,7 +24,35 @@ watch(rawHtml, () => emit("update:value", rawHtml.value))
const editorRef = shallowRef()
const toolbarConfig: Partial = {
- excludeKeys: ["todo", "insertVideo", "fullScreen"],
+ toolbarKeys: [
+ "blockquote",
+ "headerSelect",
+ "fontSize",
+ "lineHeight",
+ "|",
+ "bold",
+ "underline",
+ "italic",
+ "through",
+ "color",
+ "bgColor",
+ "|",
+ "bulletedList",
+ "numberedList",
+ "justifyLeft",
+ "justifyCenter",
+ "justifyRight",
+ "|",
+ "uploadImage",
+ "emotion",
+ "insertLink",
+ "insertTable",
+ "divider",
+ "|",
+ "clearStyle",
+ "undo",
+ "redo",
+ ],
}
const editorConfig: Partial = {
diff --git a/vite.config.ts b/vite.config.ts
index 09c5bdb..fe72933 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -6,7 +6,7 @@ import AutoImport from "unplugin-auto-import/vite"
import Components from "unplugin-vue-components/vite"
import { NaiveUiResolver } from "unplugin-vue-components/resolvers"
-const dev = false
+const dev = process.env.NODE_ENV === "development"
const url = dev ? "http://localhost:8080" : "https://oj.xuyue.cc"
const proxyConfig = {
target: url,