@kungal/editor-nuxt 0.27.0 → 0.28.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 +36 -0
- package/package.json +3 -3
- package/runtime/KunEditorToolbar.vue +28 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# @kungal/editor-nuxt
|
|
2
2
|
|
|
3
|
+
## 0.28.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 8d278e5: Make the insert-link URL entry customizable via a `linkPrompt` adapter.
|
|
8
|
+
|
|
9
|
+
The headless toolbar and the selection bubble asked for the link URL with the
|
|
10
|
+
native `window.prompt` (the KunUI toolbar used an inline popover). Hosts can now
|
|
11
|
+
supply their own UI instead — a modal, an article picker, etc.:
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
const adapters = {
|
|
15
|
+
// …uploadImage, notify…
|
|
16
|
+
linkPrompt: async ({ text }) => await openLinkModal(text), // return the URL, or null to cancel
|
|
17
|
+
};
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
- **editor-core**: new `LinkPrompt` type + `linkPrompt?` on `KunEditorAdapters`.
|
|
21
|
+
It receives the selected text (to prefill / search).
|
|
22
|
+
- **editor-vue**: the default toolbar and the selection bubble use `linkPrompt`
|
|
23
|
+
when supplied, else fall back to `window.prompt`.
|
|
24
|
+
- **editor-nuxt**: when `linkPrompt` is set, `<KunEditorToolbar>`'s link button
|
|
25
|
+
uses it instead of its inline popover — so one override covers every link entry
|
|
26
|
+
point (toolbar, default toolbar, bubble).
|
|
27
|
+
|
|
28
|
+
Verified in the docs production build: with a `linkPrompt` that derives a URL from
|
|
29
|
+
the selected text, the selection bubble inserts
|
|
30
|
+
`[…](https://example.com/search?q=…)` with no native dialog, and the KunUI
|
|
31
|
+
toolbar link becomes a plain button (no popover); 0 console errors.
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- Updated dependencies [8d278e5]
|
|
36
|
+
- @kungal/editor-core@0.28.0
|
|
37
|
+
- @kungal/editor-vue@0.28.0
|
|
38
|
+
|
|
3
39
|
## 0.27.0
|
|
4
40
|
|
|
5
41
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kungal/editor-nuxt",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.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.28.0",
|
|
35
|
+
"@kungal/editor-vue": "0.28.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@kungal/ui-vue": "^2.7.0",
|
|
@@ -195,6 +195,18 @@ const applyLink = () => {
|
|
|
195
195
|
linkPopoverEl?.close()
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
+
// When the host supplies a `linkPrompt` adapter, the link button uses THAT (its
|
|
199
|
+
// own modal) instead of the inline popover — so one override covers the toolbar,
|
|
200
|
+
// the default toolbar, and the selection bubble alike.
|
|
201
|
+
const useLinkAdapter = computed(() => !!props.adapters.linkPrompt)
|
|
202
|
+
const applyLinkFromAdapter = async () => {
|
|
203
|
+
const raw = await props.adapters.linkPrompt?.({ text: '' })
|
|
204
|
+
const href = raw?.trim()
|
|
205
|
+
if (href) {
|
|
206
|
+
props.insertLink({ href })
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
198
210
|
// Image upload — via api.uploadImage (shows the in-document "uploading…"
|
|
199
211
|
// placeholder). Only rendered when the host supplies uploadImage.
|
|
200
212
|
const canUpload = computed(() => !!props.adapters.uploadImage)
|
|
@@ -268,6 +280,22 @@ const insertSticker = (src: string, name: string) =>
|
|
|
268
280
|
</button>
|
|
269
281
|
</KunPopover>
|
|
270
282
|
|
|
283
|
+
<KunTooltip
|
|
284
|
+
v-else-if="item.kind === 'link' && useLinkAdapter"
|
|
285
|
+
:text="t.link"
|
|
286
|
+
:delay-show="300"
|
|
287
|
+
>
|
|
288
|
+
<KunButton
|
|
289
|
+
variant="light"
|
|
290
|
+
size="sm"
|
|
291
|
+
:is-icon-only="true"
|
|
292
|
+
:aria-label="t.link"
|
|
293
|
+
@click="applyLinkFromAdapter"
|
|
294
|
+
>
|
|
295
|
+
<KunIcon name="lucide:link" />
|
|
296
|
+
</KunButton>
|
|
297
|
+
</KunTooltip>
|
|
298
|
+
|
|
271
299
|
<KunPopover
|
|
272
300
|
v-else-if="item.kind === 'link'"
|
|
273
301
|
:ref="setLinkPopover"
|