@kungal/editor-nuxt 0.16.0 → 0.18.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 +44 -0
- package/package.json +3 -3
- package/runtime/KunEditorToolbar.vue +8 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,49 @@
|
|
|
1
1
|
# @kungal/editor-nuxt
|
|
2
2
|
|
|
3
|
+
## 0.18.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 6545866: Toolbar image upload now shows an in-document "uploading…" placeholder.
|
|
8
|
+
|
|
9
|
+
Previously only paste/drop showed the in-flight placeholder (Milkdown's `upload`
|
|
10
|
+
plugin); the toolbar image button uploaded silently — the image just popped in
|
|
11
|
+
when the adapter resolved. Now the toolbar path uses the same placeholder UX
|
|
12
|
+
(ProseMirror's official upload-example pattern).
|
|
13
|
+
|
|
14
|
+
- **editor-core**: `startImageUpload(view, file, { uploadImage, notify, locale })`
|
|
15
|
+
- the `imageUploadPlaceholder` decoration plugin (exported from `/preset`;
|
|
16
|
+
wired by the preset when `uploadImage` is present). Inserts a
|
|
17
|
+
`.kun-editor__uploading` widget at the caret, uploads, then replaces it with the
|
|
18
|
+
image (or removes it + notifies on failure); not an undo step. The paste/drop
|
|
19
|
+
placeholder now uses the same `.kun-editor__uploading` class so both look
|
|
20
|
+
identical.
|
|
21
|
+
- **editor-vue**: `KunEditorToolbarApi` gains `uploadImage(file)`; both the
|
|
22
|
+
headless `EditorToolbar` and the `#toolbar` slot API route uploads through
|
|
23
|
+
`startImageUpload`.
|
|
24
|
+
- **editor-nuxt**: `<KunEditorToolbar>`'s image button uses it.
|
|
25
|
+
- **Headless kept**: the placeholder is a class + widget hook only; style it via
|
|
26
|
+
`.kun-editor__uploading` in the reference `kun-editor.css` (primary-colored).
|
|
27
|
+
|
|
28
|
+
Customizable: style the placeholder via `.kun-editor__uploading`; the text is
|
|
29
|
+
localized (zh/en). Verified in the docs production build: uploading via either
|
|
30
|
+
toolbar inserts the image; the unit tests confirm the placeholder shows during a
|
|
31
|
+
pending upload and is replaced on success / removed on failure.
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- Updated dependencies [6545866]
|
|
36
|
+
- @kungal/editor-core@0.18.0
|
|
37
|
+
- @kungal/editor-vue@0.18.0
|
|
38
|
+
|
|
39
|
+
## 0.17.0
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- Updated dependencies [59abbc8]
|
|
44
|
+
- @kungal/editor-core@0.17.0
|
|
45
|
+
- @kungal/editor-vue@0.17.0
|
|
46
|
+
|
|
3
47
|
## 0.16.0
|
|
4
48
|
|
|
5
49
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kungal/editor-nuxt",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.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-
|
|
35
|
-
"@kungal/editor-
|
|
34
|
+
"@kungal/editor-core": "0.18.0",
|
|
35
|
+
"@kungal/editor-vue": "0.18.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@kungal/ui-vue": "^2.7.0",
|
|
@@ -106,22 +106,18 @@ const groups = computed<Tool[][]>(() => [
|
|
|
106
106
|
]
|
|
107
107
|
])
|
|
108
108
|
|
|
109
|
-
// Image upload — only when the host supplies uploadImage.
|
|
110
|
-
//
|
|
111
|
-
|
|
109
|
+
// Image upload button — shown only when the host supplies uploadImage. The
|
|
110
|
+
// upload itself goes through api.uploadImage, which shows an in-document
|
|
111
|
+
// "uploading…" placeholder at the caret (same UX as paste/drop).
|
|
112
|
+
const canUpload = computed(() => !!props.adapters.uploadImage)
|
|
112
113
|
const fileInput = ref<HTMLInputElement | null>(null)
|
|
113
114
|
const pickImage = () => fileInput.value?.click()
|
|
114
|
-
const onFileChange =
|
|
115
|
+
const onFileChange = (e: Event) => {
|
|
115
116
|
const input = e.target as HTMLInputElement
|
|
116
117
|
const file = input.files?.[0]
|
|
117
118
|
input.value = ''
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
try {
|
|
121
|
-
const src = await upload(file)
|
|
122
|
-
props.run(insertImageCommand.key, { src, title: file.name, alt: file.name })
|
|
123
|
-
} catch {
|
|
124
|
-
props.adapters.notify?.(en.value ? 'Image upload failed' : '图片上传失败', 'error')
|
|
119
|
+
if (file) {
|
|
120
|
+
props.uploadImage(file)
|
|
125
121
|
}
|
|
126
122
|
}
|
|
127
123
|
|
|
@@ -183,7 +179,7 @@ const insertSticker = (src: string, name: string) =>
|
|
|
183
179
|
</KunTooltip>
|
|
184
180
|
</template>
|
|
185
181
|
|
|
186
|
-
<template v-if="
|
|
182
|
+
<template v-if="canUpload">
|
|
187
183
|
<span class="bg-default-200 mx-1 h-5 w-px" aria-hidden="true" />
|
|
188
184
|
<KunTooltip :text="t.image" :delay-show="300">
|
|
189
185
|
<KunButton
|