@kungal/editor-nuxt 0.21.0 → 0.23.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 +42 -0
- package/package.json +3 -3
- package/runtime/KunEditorViewSwitch.vue +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,47 @@
|
|
|
1
1
|
# @kungal/editor-nuxt
|
|
2
2
|
|
|
3
|
+
## 0.23.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 78e637e: `<KunEditor>` gains a `views` prop to control which view modes the switch offers.
|
|
8
|
+
|
|
9
|
+
The split view is great on a full editor but heavy in a small reply/comment box —
|
|
10
|
+
and there was no way to opt out per-editor (all or nothing). Now pass `views`:
|
|
11
|
+
|
|
12
|
+
```vue
|
|
13
|
+
<!-- edit page: all three (default) -->
|
|
14
|
+
<KunEditor v-model="md" />
|
|
15
|
+
<!-- reply / comment: no split -->
|
|
16
|
+
<KunEditor v-model="md" :views="['wysiwyg', 'source']" />
|
|
17
|
+
<!-- just WYSIWYG: the switch bar is hidden entirely -->
|
|
18
|
+
<KunEditor v-model="md" :views="['wysiwyg']" />
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
- Default `['wysiwyg', 'source', 'split']`. The view switch renders only the
|
|
22
|
+
offered modes, and disappears when a single mode is offered. If `views` changes
|
|
23
|
+
to exclude the active mode, it falls back to the first offered.
|
|
24
|
+
- `KunEditorViewSwitchApi` gains `views`; the default view switch and
|
|
25
|
+
`<KunEditorViewSwitch>` (editor-nuxt) both render from it.
|
|
26
|
+
|
|
27
|
+
Verified in the docs production build: an editor with `:views="['wysiwyg','source']"`
|
|
28
|
+
shows only 预览/Markdown (no 分栏), while default editors still show all three; 0
|
|
29
|
+
console errors.
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- Updated dependencies [78e637e]
|
|
34
|
+
- @kungal/editor-vue@0.23.0
|
|
35
|
+
- @kungal/editor-core@0.23.0
|
|
36
|
+
|
|
37
|
+
## 0.22.0
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- Updated dependencies [fbbb761]
|
|
42
|
+
- @kungal/editor-vue@0.22.0
|
|
43
|
+
- @kungal/editor-core@0.22.0
|
|
44
|
+
|
|
3
45
|
## 0.21.0
|
|
4
46
|
|
|
5
47
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kungal/editor-nuxt",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.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": [
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"nuxt.config.ts"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@kungal/editor-core": "0.
|
|
35
|
-
"@kungal/editor-vue": "0.
|
|
34
|
+
"@kungal/editor-core": "0.23.0",
|
|
35
|
+
"@kungal/editor-vue": "0.23.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@kungal/ui-vue": "^2.7.0",
|
|
@@ -15,11 +15,10 @@ import type { KunEditorViewSwitchApi } from '@kungal/editor-vue'
|
|
|
15
15
|
|
|
16
16
|
const props = defineProps<KunEditorViewSwitchApi>()
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
{ value:
|
|
21
|
-
|
|
22
|
-
])
|
|
18
|
+
// Only the offered views (from the `views` prop). Hidden entirely for one view.
|
|
19
|
+
const items = computed(() =>
|
|
20
|
+
props.views.map((v) => ({ value: v, textValue: props.labels[v] }))
|
|
21
|
+
)
|
|
23
22
|
|
|
24
23
|
const onChange = (value: string) => {
|
|
25
24
|
props.setMode(
|
|
@@ -29,7 +28,8 @@ const onChange = (value: string) => {
|
|
|
29
28
|
</script>
|
|
30
29
|
|
|
31
30
|
<template>
|
|
32
|
-
|
|
31
|
+
<!-- Hidden entirely when only one view is offered (e.g. a reply box). -->
|
|
32
|
+
<div v-if="views.length > 1" class="flex items-center gap-1">
|
|
33
33
|
<KunTab
|
|
34
34
|
:model-value="mode"
|
|
35
35
|
:items="items"
|