@kungal/editor-vue 0.38.1 → 0.38.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,49 @@
|
|
|
1
1
|
# @kungal/editor-vue
|
|
2
2
|
|
|
3
|
+
## 0.38.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 4dbe38b: 删 @提及 / #楼层 引用块时光标不再跳行,手机键盘不再收起又弹出
|
|
8
|
+
|
|
9
|
+
下游报的问题:回复里 `@anjila #3 ` 这样的引用标记,按退格时光标先掉到下一行、再回来,
|
|
10
|
+
删两个块要抖两次;手机端每抖一次,键盘就收起再弹出一次。原因此前一直没查明。
|
|
11
|
+
|
|
12
|
+
根因有两层,都在「段落以一个不可编辑的行内原子节点结尾」这一刻:
|
|
13
|
+
|
|
14
|
+
1. **视觉跳行(桌面 + 手机都有)。** 尾随空格删掉后,段落最后一个节点是
|
|
15
|
+
`contenteditable="false"` 的芯片。ProseMirror 为了让 Chrome / Safari 能在芯片后面画光标,
|
|
16
|
+
会补一个 `<img class="ProseMirror-separator">` 和一个尾随 `<br>`。这个 img 本该是 0×0 的
|
|
17
|
+
行内空元素,但宿主的通用 `img` 规则(Tailwind preflight 让所有 img `display:block`,
|
|
18
|
+
论坛的 `.milkdown img` 又加了 `my-8` 外边距和边框)把它变成了块级盒子 —— `<br>` 连同光标
|
|
19
|
+
被挤到下一行,段落高度翻倍(实测 24px → 48px),下一次退格删掉芯片后又缩回去,这就是抖动。
|
|
20
|
+
ProseMirror 自己的样式表里有一条 "Protect against generic img rules" 的守卫,Milkdown
|
|
21
|
+
不带那份样式表,`editor.css` 也一直没补 —— 现在补上了,`!important`,压过宿主的 prose 层。
|
|
22
|
+
2. **键盘闪烁(Android)。** 光标紧挨芯片时,基础 keymap 的退格命令全都不适用,ProseMirror 交给
|
|
23
|
+
浏览器原生删;桌面上真实的 keydown 会触发 prosemirror-view 自己的兜底(`captureKeyDown`)
|
|
24
|
+
用事务删掉节点,但虚拟键盘发的是 keyCode 229,兜底不会跑,浏览器原生删不可编辑元素
|
|
25
|
+
「有时会失败」(prosemirror-view 原话),它对这种情况的回退是 **`view.dom.blur(); view.focus()`**
|
|
26
|
+
再粗暴删一格 —— 那一对 blur/focus 就是键盘收起又弹出。
|
|
27
|
+
|
|
28
|
+
修法:
|
|
29
|
+
|
|
30
|
+
- `@kungal/editor-nuxt/editor.css` 新增结构性规则 `.kun-editor__wysiwyg img.ProseMirror-separator`
|
|
31
|
+
(display:inline、0×0、无外边距无边框)。写自己样式表的宿主请把它一并带上 —— 文档「样式」页
|
|
32
|
+
的结构性规则清单已加入。
|
|
33
|
+
- `@kungal/editor-core` 新增 `createInlineAtomPlugin()`(预设默认启用,纯逻辑):在 `beforeinput`
|
|
34
|
+
的 `deleteContentBackward` / `deleteContentForward` 上,只要光标紧挨(或选中的就是)一个行内原子
|
|
35
|
+
节点,就 `preventDefault` 并用**一个事务**删掉它 —— 硬件键盘、IME、虚拟键盘、右键菜单删除走的
|
|
36
|
+
都是这一个事件,浏览器再也碰不到那个 `contenteditable=false` 元素,prosemirror-view 的
|
|
37
|
+
blur/focus 回退没有机会触发。任何 `atom: true` 的行内节点(提及、引用、行内公式、以后的自定义
|
|
38
|
+
芯片)自动享有;块级原子节点仍交给基础 keymap 的 `selectNodeBackward`。输入规则刚触发时的退格
|
|
39
|
+
照旧先撤销规则(与基础 keymap 的顺序一致);IME 组合中不介入。
|
|
40
|
+
|
|
41
|
+
行为:`@anjila #3 ` 仍是 4 次退格(空格、芯片、空格、芯片 —— 空格是真实字符,与 Slack / Notion /
|
|
42
|
+
Google Docs 一致),但每一次都精确删一个单位,光标全程留在同一行。无破坏性变更。
|
|
43
|
+
|
|
44
|
+
- Updated dependencies [4dbe38b]
|
|
45
|
+
- @kungal/editor-core@0.38.2
|
|
46
|
+
|
|
3
47
|
## 0.38.1
|
|
4
48
|
|
|
5
49
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kungal/editor-vue",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.2",
|
|
4
4
|
"description": "KunEditor Vue 3 layer — the headless <KunEditor> component (dual WYSIWYG / markdown-source), toolbar and plugin views. Ships zero CSS and no UI-kit dependency; consumes @kungal/editor-core, and pairs with @kungal/editor-nuxt for optional KunUI chrome.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@prosemirror-adapter/vue": "^0.4.6",
|
|
43
|
-
"@kungal/editor-core": "0.38.
|
|
43
|
+
"@kungal/editor-core": "0.38.2"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"@codemirror/lang-markdown": "^6.0.0",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"vite": "^8.0.16",
|
|
81
81
|
"vue": "^3.5.35",
|
|
82
82
|
"vue-tsc": "^3.3.3",
|
|
83
|
-
"@kungal/editor-core": "0.38.
|
|
83
|
+
"@kungal/editor-core": "0.38.2"
|
|
84
84
|
},
|
|
85
85
|
"scripts": {
|
|
86
86
|
"build": "vite build && vue-tsc -p tsconfig.build.json",
|