@kungal/editor-nuxt 0.27.0 → 0.29.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,49 @@
1
1
  # @kungal/editor-nuxt
2
2
 
3
+ ## 0.29.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [8609e53]
8
+ - @kungal/editor-vue@0.29.0
9
+ - @kungal/editor-core@0.29.0
10
+
11
+ ## 0.28.0
12
+
13
+ ### Minor Changes
14
+
15
+ - 8d278e5: Make the insert-link URL entry customizable via a `linkPrompt` adapter.
16
+
17
+ The headless toolbar and the selection bubble asked for the link URL with the
18
+ native `window.prompt` (the KunUI toolbar used an inline popover). Hosts can now
19
+ supply their own UI instead — a modal, an article picker, etc.:
20
+
21
+ ```ts
22
+ const adapters = {
23
+ // …uploadImage, notify…
24
+ linkPrompt: async ({ text }) => await openLinkModal(text), // return the URL, or null to cancel
25
+ };
26
+ ```
27
+
28
+ - **editor-core**: new `LinkPrompt` type + `linkPrompt?` on `KunEditorAdapters`.
29
+ It receives the selected text (to prefill / search).
30
+ - **editor-vue**: the default toolbar and the selection bubble use `linkPrompt`
31
+ when supplied, else fall back to `window.prompt`.
32
+ - **editor-nuxt**: when `linkPrompt` is set, `<KunEditorToolbar>`'s link button
33
+ uses it instead of its inline popover — so one override covers every link entry
34
+ point (toolbar, default toolbar, bubble).
35
+
36
+ Verified in the docs production build: with a `linkPrompt` that derives a URL from
37
+ the selected text, the selection bubble inserts
38
+ `[…](https://example.com/search?q=…)` with no native dialog, and the KunUI
39
+ toolbar link becomes a plain button (no popover); 0 console errors.
40
+
41
+ ### Patch Changes
42
+
43
+ - Updated dependencies [8d278e5]
44
+ - @kungal/editor-core@0.28.0
45
+ - @kungal/editor-vue@0.28.0
46
+
3
47
  ## 0.27.0
4
48
 
5
49
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kungal/editor-nuxt",
3
- "version": "0.27.0",
3
+ "version": "0.29.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.27.0",
35
- "@kungal/editor-vue": "0.27.0"
34
+ "@kungal/editor-core": "0.29.0",
35
+ "@kungal/editor-vue": "0.29.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"