@kungal/editor-nuxt 0.35.0 → 0.36.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 +40 -0
- package/package.json +3 -3
- package/runtime/KunEditorToolbar.vue +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,45 @@
|
|
|
1
1
|
# @kungal/editor-nuxt
|
|
2
2
|
|
|
3
|
+
## 0.36.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- f7c65c2: fix(editor): the spoiler toolbar button hides the selection instead of deleting it
|
|
8
|
+
|
|
9
|
+
`insertKunSpoilerCommand` built an EMPTY `kun-spoiler` node and dropped it over
|
|
10
|
+
the selection with `replaceSelectionWith`, so clicking 隐藏文本 with text selected
|
|
11
|
+
deleted the text and left a bare `||||` — and the next thing typed landed
|
|
12
|
+
outside the node, so nothing was hidden either. The JSDoc said "wraps the
|
|
13
|
+
current selection"; the code never wrapped anything.
|
|
14
|
+
|
|
15
|
+
The command now covers the three cases the `||…||` syntax does:
|
|
16
|
+
|
|
17
|
+
- **a selection** → its text moves inside the node. The schema is `marks: ''`
|
|
18
|
+
(inline formatting cannot round-trip through `||…||`), so bold is what's
|
|
19
|
+
dropped, never the words. Selections spanning paragraphs collapse into one
|
|
20
|
+
spoiler; select-all (an `AllSelection`) works too.
|
|
21
|
+
- **an empty selection** → a new spoiler with the caret INSIDE it: type and it
|
|
22
|
+
is hidden. It holds a zero-width caret anchor, because a caret cannot sit in
|
|
23
|
+
an inline node with no text node in it — the serializer strips anchors, and a
|
|
24
|
+
spoiler holding nothing else serializes to nothing, so a stray click cannot
|
|
25
|
+
leave `||||` behind.
|
|
26
|
+
- **the caret already inside a spoiler** → reveal it, leaving the text selected.
|
|
27
|
+
Nesting would have produced `||||text||||`, which reads back as nothing.
|
|
28
|
+
|
|
29
|
+
The button is therefore a toggle, and both toolbars (the headless one and the
|
|
30
|
+
KunUI one in `@kungal/editor-nuxt`) now show it pressed while the caret is
|
|
31
|
+
inside a spoiler — `KunToggleMark` gains a `'spoiler'` member for that, so
|
|
32
|
+
`activeMarks` carries one more key.
|
|
33
|
+
|
|
34
|
+
It returns `false` — no document change — inside a code block and with a node
|
|
35
|
+
selected (an image is not text; replacing it would delete it).
|
|
36
|
+
|
|
37
|
+
### Patch Changes
|
|
38
|
+
|
|
39
|
+
- Updated dependencies [f7c65c2]
|
|
40
|
+
- @kungal/editor-core@0.36.0
|
|
41
|
+
- @kungal/editor-vue@0.36.0
|
|
42
|
+
|
|
3
43
|
## 0.35.0
|
|
4
44
|
|
|
5
45
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kungal/editor-nuxt",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.36.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.36.0",
|
|
36
|
+
"@kungal/editor-vue": "0.36.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 =
|