refactor(编辑器): 去掉 vue-codemirror,代码编辑器、协作编辑器、教程编辑器改用自己的薄外壳

三个编辑器只用到它的 v-model、extensions、只读、缩进、占位文字、尺寸和 ready,
shared/components/CodeMirror.vue 照它的做法写了这几样,功能和手感不变:
- 它默认带的 basicSetup(行号、撤销、折叠、搜索、括号……)照样带上
- 各项配置的先后顺序和它一致;外部改代码仍是一次不带 userEvent 的 changes,
  提交时的编辑过程统计不受影响
- @codemirror/commands 现在直接 import,显式声明进依赖

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
xuyueandClaude Opus 5.5 committed 2026-10-12 20:22:39 +08:00
1 parent 6216e1cf22
commit d2b8a1ce4a
7 files changed
+133 -24

No files matched your search

+1 -1
View File
@@ -11,7 +11,7 @@ import type { SubmissionTrace } from "@oj2/contract"
* 直接失效。计数本身也不需要响应式。
*
* **只数带 userEvent 的事务。** 下面这些都不带,所以天然不会被算进去:
* - `codeStore.setCode()` —— vue-codemirror 的 setDoc 只 dispatch 一个 changes:
* - `codeStore.setCode()` —— shared/components/CodeMirror.vue 同步 v-model 时只 dispatch 一个 changes:
* 提交前的自动格式化、载入草稿 / 模板、切语言都走这条;
* - 课堂协作里对方的改动 —— y-codemirror.next 应用远程更新时只挂 ySyncAnnotation。
*