@kungal/editor-nuxt 0.35.0 → 0.37.0
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 +69 -0
- package/package.json +3 -3
- package/runtime/KunEditorToolbar.vue +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,74 @@
|
|
|
1
1
|
# @kungal/editor-nuxt
|
|
2
2
|
|
|
3
|
+
## 0.37.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- a473708: 隐藏文本:选区里的换行不再写出读不回来的 markdown,选区气泡里也有了这颗按钮
|
|
8
|
+
|
|
9
|
+
- **`insertKunSpoilerCommand` 把选区里的换行折成空格。** `||…||` 在每一个读它的地方
|
|
10
|
+
都只在同一行内配对(这里的 remark 转换、共用同一语法的服务端渲染器),而 commonmark 的
|
|
11
|
+
hardbreak 声明了 `leafText: () => '\n'` —— 所以选中跨行的文字点「隐藏文本」,按钮会写出
|
|
12
|
+
`||第一行\n第二行||`:一段它自己都读不回来、渲染出来是两条光秃秃竖线的 markdown。现在
|
|
13
|
+
`textBetween` 的**两个**分隔符都给 `' '`(块级的本来就是),跨行选区并成一个单行 spoiler。
|
|
14
|
+
- **选区里一个字都没有时返回 `false`**,而不是把选中的东西替换掉 —— 单独选中一张图片点
|
|
15
|
+
「隐藏文本」不再删图。(选中的是节点、或在代码块里,原本就已经返回 `false`。)
|
|
16
|
+
- **选区气泡工具栏加入 `spoiler`**:`KunSelectionItem` 多一个成员,默认那一排变成
|
|
17
|
+
`bold / italic / strike / code / spoiler / link`。按下态走已有的 `activeMarks.spoiler`,
|
|
18
|
+
光标在 spoiler 里时按钮点亮、点一下揭示,和固定工具栏完全一致。
|
|
19
|
+
- 顺手把气泡默认按钮表收成**一份** `DEFAULT_SELECTION_ITEMS`(`context.ts`)。原本
|
|
20
|
+
`<KunEditor>` 和气泡各存一份,只改气泡那份等于没改 —— 真实编辑器读的是 context 那份。
|
|
21
|
+
|
|
22
|
+
**跨行剧透不在此列**:`||…||` 是行内语法(schema `inline: true`,mdast 里开闭两个 `||`
|
|
23
|
+
根本落在不同的 text 节点上),要藏整段多行内容需要的是一个块级容器语法,得全生态(渲染器
|
|
24
|
+
先行)另行约定,不是把 `||…||` 拉长。
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- Updated dependencies [a473708]
|
|
29
|
+
- @kungal/editor-core@0.37.0
|
|
30
|
+
- @kungal/editor-vue@0.37.0
|
|
31
|
+
|
|
32
|
+
## 0.36.0
|
|
33
|
+
|
|
34
|
+
### Minor Changes
|
|
35
|
+
|
|
36
|
+
- f7c65c2: fix(editor): the spoiler toolbar button hides the selection instead of deleting it
|
|
37
|
+
|
|
38
|
+
`insertKunSpoilerCommand` built an EMPTY `kun-spoiler` node and dropped it over
|
|
39
|
+
the selection with `replaceSelectionWith`, so clicking 隐藏文本 with text selected
|
|
40
|
+
deleted the text and left a bare `||||` — and the next thing typed landed
|
|
41
|
+
outside the node, so nothing was hidden either. The JSDoc said "wraps the
|
|
42
|
+
current selection"; the code never wrapped anything.
|
|
43
|
+
|
|
44
|
+
The command now covers the three cases the `||…||` syntax does:
|
|
45
|
+
|
|
46
|
+
- **a selection** → its text moves inside the node. The schema is `marks: ''`
|
|
47
|
+
(inline formatting cannot round-trip through `||…||`), so bold is what's
|
|
48
|
+
dropped, never the words. Selections spanning paragraphs collapse into one
|
|
49
|
+
spoiler; select-all (an `AllSelection`) works too.
|
|
50
|
+
- **an empty selection** → a new spoiler with the caret INSIDE it: type and it
|
|
51
|
+
is hidden. It holds a zero-width caret anchor, because a caret cannot sit in
|
|
52
|
+
an inline node with no text node in it — the serializer strips anchors, and a
|
|
53
|
+
spoiler holding nothing else serializes to nothing, so a stray click cannot
|
|
54
|
+
leave `||||` behind.
|
|
55
|
+
- **the caret already inside a spoiler** → reveal it, leaving the text selected.
|
|
56
|
+
Nesting would have produced `||||text||||`, which reads back as nothing.
|
|
57
|
+
|
|
58
|
+
The button is therefore a toggle, and both toolbars (the headless one and the
|
|
59
|
+
KunUI one in `@kungal/editor-nuxt`) now show it pressed while the caret is
|
|
60
|
+
inside a spoiler — `KunToggleMark` gains a `'spoiler'` member for that, so
|
|
61
|
+
`activeMarks` carries one more key.
|
|
62
|
+
|
|
63
|
+
It returns `false` — no document change — inside a code block and with a node
|
|
64
|
+
selected (an image is not text; replacing it would delete it).
|
|
65
|
+
|
|
66
|
+
### Patch Changes
|
|
67
|
+
|
|
68
|
+
- Updated dependencies [f7c65c2]
|
|
69
|
+
- @kungal/editor-core@0.36.0
|
|
70
|
+
- @kungal/editor-vue@0.36.0
|
|
71
|
+
|
|
3
72
|
## 0.35.0
|
|
4
73
|
|
|
5
74
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kungal/editor-nuxt",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.37.0",
|
|
4
4
|
"description": "KunEditor Nuxt Layer — wraps @kungal/editor-vue and auto-imports <KunEditor> so an existing Nuxt app keeps its exact DX (no import needed).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"nuxt.config.ts"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@kungal/editor-core": "0.
|
|
36
|
-
"@kungal/editor-vue": "0.
|
|
35
|
+
"@kungal/editor-core": "0.37.0",
|
|
36
|
+
"@kungal/editor-vue": "0.37.0"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@kungal/ui-vue": "^2.7.0",
|
|
@@ -119,7 +119,7 @@ const commandButtons = computed<Record<string, Tool>>(() => ({
|
|
|
119
119
|
quote: { icon: 'lucide:text-quote', title: t.value.quote, run: () => props.run(wrapInBlockquoteCommand.key) },
|
|
120
120
|
codeBlock: { icon: 'lucide:square-code', title: t.value.codeBlock, run: () => props.run(createCodeBlockCommand.key, '') },
|
|
121
121
|
hr: { icon: 'lucide:minus', title: t.value.hr, run: () => props.run(insertHrCommand.key) },
|
|
122
|
-
spoiler: { icon: 'lucide:eye-off', title: t.value.spoiler, run: () => props.run(insertKunSpoilerCommand.key) }
|
|
122
|
+
spoiler: { icon: 'lucide:eye-off', title: t.value.spoiler, run: () => props.run(insertKunSpoilerCommand.key), mark: 'spoiler' }
|
|
123
123
|
}))
|
|
124
124
|
|
|
125
125
|
type RenderItem =
|