renew text editor

This commit is contained in:
2024-06-11 19:32:43 +08:00
parent 854aad1f43
commit 30a3609838
4 changed files with 56 additions and 24 deletions

View File

@@ -422,26 +422,30 @@ watch([fromExistingTags, newTags], (tags) => {
/>
</n-form-item>
</n-form>
<n-tabs
type="line"
default-value="C"
class="template box"
v-if="needTemplate"
v-model:value="currentActiveTemplate"
>
<n-tab-pane
v-for="(lang, index) in problem.languages"
:key="index"
:name="lang"
>
<CodeEditor
v-model="template[lang]"
:language="lang"
:font-size="16"
height="200px"
/>
</n-tab-pane>
</n-tabs>
<n-form v-if="needTemplate">
<n-form-item label="编写代码模板">
<n-tabs
type="segment"
default-value="C"
class="template box"
v-model:value="currentActiveTemplate"
>
<n-tab-pane
v-for="(lang, index) in problem.languages"
:key="index"
:name="lang"
>
<CodeEditor
v-model="template[lang]"
:language="lang"
:font-size="16"
height="200px"
/>
</n-tab-pane>
</n-tabs>
</n-form-item>
</n-form>
<n-alert
class="box"
v-if="problem.test_case_score.length"

View File

@@ -65,7 +65,7 @@ onBeforeUnmount(() => {
>
<n-gi :span="isDesktop ? 1 : 2" v-show="onlyDetail">
<n-scrollbar v-if="isDesktop" style="max-height: calc(100vh - 92px)">
<n-tabs default-value="content" type="line">
<n-tabs default-value="content" type="segment">
<n-tab-pane name="content" tab="题目描述">
<ProblemContent />
</n-tab-pane>
@@ -77,7 +77,7 @@ onBeforeUnmount(() => {
</n-tab-pane>
</n-tabs>
</n-scrollbar>
<n-tabs v-else default-value="content" type="line">
<n-tabs v-else default-value="content" type="segment">
<n-tab-pane name="content" tab="题目描述">
<ProblemContent />
</n-tab-pane>

View File

@@ -24,7 +24,35 @@ watch(rawHtml, () => emit("update:value", rawHtml.value))
const editorRef = shallowRef<IDomEditor>()
const toolbarConfig: Partial<IToolbarConfig> = {
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<IEditorConfig> = {

View File

@@ -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,