fix3
Some checks failed
Deploy / deploy (build, debian, 22, /root/OJDeploy/data/clientnext) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822, /root/OJ/data/dist) (push) Has been cancelled

This commit is contained in:
2026-05-07 02:27:09 -06:00
parent 73884a075b
commit 4ecd7bb229
2 changed files with 5 additions and 8 deletions

View File

@@ -1,4 +1,3 @@
import path from "node:path"
import { defineConfig, loadEnv } from "@rsbuild/core" import { defineConfig, loadEnv } from "@rsbuild/core"
import { pluginVue } from "@rsbuild/plugin-vue" import { pluginVue } from "@rsbuild/plugin-vue"
import AutoImport from "unplugin-auto-import/rspack" import AutoImport from "unplugin-auto-import/rspack"
@@ -85,11 +84,6 @@ const config: ReturnType<typeof defineConfig> = defineConfig(({ envMode }) => {
oj: "./src/oj", oj: "./src/oj",
admin: "./src/admin", admin: "./src/admin",
shared: "./src/shared", shared: "./src/shared",
// 强制 @wangeditor-next/editor 所有导入ESM/CJS走同一个文件
// 避免 Rspack v2 按 exports conditions 分别解析 .mjs/.js 产生双实例
"@wangeditor-next/editor$": path.resolve(
"./node_modules/@wangeditor-next/editor/dist/index.js"
),
}, },
}, },
server: { server: {

View File

@@ -25,6 +25,7 @@ const props = withDefaults(defineProps<Props>(), {
const message = useMessage() const message = useMessage()
const editorRef = shallowRef<IDomEditor>() const editorRef = shallowRef<IDomEditor>()
const toolbarEditorRef = shallowRef<IDomEditor>()
const toolbarConfig: Partial<IToolbarConfig> = { const toolbarConfig: Partial<IToolbarConfig> = {
toolbarKeys: [ toolbarKeys: [
@@ -91,8 +92,10 @@ function onClick() {
editorRef.value.focus() editorRef.value.focus()
} }
function handleCreated(editor: IDomEditor) { async function handleCreated(editor: IDomEditor) {
editorRef.value = editor editorRef.value = editor
await nextTick()
toolbarEditorRef.value = editor
} }
async function customUpload(file: File, insertFn: InsertFnType) { async function customUpload(file: File, insertFn: InsertFnType) {
@@ -113,7 +116,7 @@ async function customUpload(file: File, insertFn: InsertFnType) {
<div class="editorWrapper"> <div class="editorWrapper">
<Toolbar <Toolbar
class="toolbar" class="toolbar"
:editor="editorRef" :editor="toolbarEditorRef"
:defaultConfig="props.simple ? toolbarConfigSimple : toolbarConfig" :defaultConfig="props.simple ? toolbarConfigSimple : toolbarConfig"
mode="simple" mode="simple"
/> />