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