@kungal/editor-nuxt 0.13.0 → 0.14.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 +33 -0
- package/nuxt.config.ts +10 -4
- package/package.json +3 -3
- package/runtime/KunEditorViewSwitch.vue +36 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# @kungal/editor-nuxt
|
|
2
2
|
|
|
3
|
+
## 0.14.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 506813b: Add a `#view-switch` slot and a KunUI view switch — the Preview/Markdown tabs are
|
|
8
|
+
now a swappable layer too.
|
|
9
|
+
|
|
10
|
+
`<KunEditor>` exposes a `#view-switch` scoped slot whose props are
|
|
11
|
+
`KunEditorViewSwitchApi` (`mode` / `setMode` / `labels`). The hand-rolled tabs
|
|
12
|
+
are the slot's fallback — omit the slot and nothing changes. This lets a host
|
|
13
|
+
render a real component (or anything) for the view switch and drive the editor
|
|
14
|
+
via `setMode`, without reaching into internals.
|
|
15
|
+
|
|
16
|
+
`@kungal/editor-nuxt` ships `<KunEditorViewSwitch>` (auto-imported): the tabs as a
|
|
17
|
+
real `<KunTab variant="underlined">` (keyboard nav, sliding indicator, a11y):
|
|
18
|
+
|
|
19
|
+
```vue
|
|
20
|
+
<KunEditor v-model="md">
|
|
21
|
+
<template #view-switch="s"><KunEditorViewSwitch v-bind="s" /></template>
|
|
22
|
+
<template #toolbar="api"><KunEditorToolbar v-bind="api" /></template>
|
|
23
|
+
</KunEditor>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Same "headless core + optional KunUI layer" pattern as `#toolbar` /
|
|
27
|
+
`<KunEditorToolbar>`: `@kungal/editor-vue` stays UI-kit-free (default tabs), the
|
|
28
|
+
KunUI ecosystem gets native chrome. Exports `KunEditorViewSwitchApi`.
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- Updated dependencies [506813b]
|
|
33
|
+
- @kungal/editor-vue@0.14.0
|
|
34
|
+
- @kungal/editor-core@0.14.0
|
|
35
|
+
|
|
3
36
|
## 0.13.0
|
|
4
37
|
|
|
5
38
|
### Minor Changes
|
package/nuxt.config.ts
CHANGED
|
@@ -5,10 +5,12 @@ import { defineNuxtModule, addComponent, createResolver } from '@nuxt/kit'
|
|
|
5
5
|
// downstream templates use `<KunEditor>` with no import (and Nuxt generates its
|
|
6
6
|
// types, keeping the tag type-checked in consumer templates).
|
|
7
7
|
//
|
|
8
|
-
// It also ships
|
|
9
|
-
// #toolbar
|
|
10
|
-
//
|
|
11
|
-
//
|
|
8
|
+
// It also ships the KunUI chrome for <KunEditor>'s slots — <KunEditorToolbar>
|
|
9
|
+
// (#toolbar) and <KunEditorViewSwitch> (#view-switch, the Preview/Markdown tabs
|
|
10
|
+
// as a real <KunTab>). They belong HERE (this layer already assumes
|
|
11
|
+
// @kungal/ui-nuxt), not in headless @kungal/editor-vue — so editor-vue stays
|
|
12
|
+
// UI-kit-free while the KunUI ecosystem gets native chrome. Same shape as
|
|
13
|
+
// TipTap's optional UI package.
|
|
12
14
|
export default defineNuxtConfig({
|
|
13
15
|
modules: [
|
|
14
16
|
defineNuxtModule({
|
|
@@ -24,6 +26,10 @@ export default defineNuxtConfig({
|
|
|
24
26
|
name: 'KunEditorToolbar',
|
|
25
27
|
filePath: resolve('./runtime/KunEditorToolbar.vue')
|
|
26
28
|
})
|
|
29
|
+
addComponent({
|
|
30
|
+
name: 'KunEditorViewSwitch',
|
|
31
|
+
filePath: resolve('./runtime/KunEditorViewSwitch.vue')
|
|
32
|
+
})
|
|
27
33
|
}
|
|
28
34
|
})
|
|
29
35
|
],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kungal/editor-nuxt",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.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": [
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"nuxt.config.ts"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@kungal/editor-core": "0.
|
|
34
|
-
"@kungal/editor-vue": "0.
|
|
33
|
+
"@kungal/editor-core": "0.14.0",
|
|
34
|
+
"@kungal/editor-vue": "0.14.0"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"@kungal/ui-vue": "^2.7.0",
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
// KunUI view switch for <KunEditor>'s #view-switch slot — the Preview/Markdown
|
|
3
|
+
// tabs as a real <KunTab variant="underlined"> (keyboard nav, sliding indicator,
|
|
4
|
+
// a11y). Same pattern as <KunEditorToolbar>: it lives in this ui-nuxt-assuming
|
|
5
|
+
// layer (not headless editor-vue) and is driven purely by the slot API.
|
|
6
|
+
//
|
|
7
|
+
// <KunEditor v-model="md">
|
|
8
|
+
// <template #view-switch="s"><KunEditorViewSwitch v-bind="s" /></template>
|
|
9
|
+
// </KunEditor>
|
|
10
|
+
//
|
|
11
|
+
// KunTab is auto-imported by @kungal/ui-nuxt in the consuming app.
|
|
12
|
+
import { computed } from 'vue'
|
|
13
|
+
import type { KunEditorViewSwitchApi } from '@kungal/editor-vue'
|
|
14
|
+
|
|
15
|
+
const props = defineProps<KunEditorViewSwitchApi>()
|
|
16
|
+
|
|
17
|
+
const items = computed(() => [
|
|
18
|
+
{ value: 'wysiwyg', textValue: props.labels.wysiwyg },
|
|
19
|
+
{ value: 'source', textValue: props.labels.source }
|
|
20
|
+
])
|
|
21
|
+
|
|
22
|
+
const onChange = (value: string) => {
|
|
23
|
+
props.setMode(value === 'source' ? 'source' : 'wysiwyg')
|
|
24
|
+
}
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<template>
|
|
28
|
+
<KunTab
|
|
29
|
+
:model-value="mode"
|
|
30
|
+
:items="items"
|
|
31
|
+
variant="underlined"
|
|
32
|
+
color="primary"
|
|
33
|
+
size="sm"
|
|
34
|
+
@update:model-value="onChange"
|
|
35
|
+
/>
|
|
36
|
+
</template>
|