@kungal/editor-nuxt 0.33.0 → 0.35.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,90 @@
1
1
  # @kungal/editor-nuxt
2
2
 
3
+ ## 0.35.0
4
+
5
+ ### Minor Changes
6
+
7
+ - c90e1b9: fix(link): give a typed URL the scheme it needs, in ONE place
8
+
9
+ Typing `www.kungal.com/topic/1` into any link input produced a **relative**
10
+ href: with no scheme the browser resolves it against the current page, so the
11
+ link went to `<origin>/<current/path>/www.kungal.com/topic/1` — dead, and dead
12
+ in a way the author can't see while writing.
13
+
14
+ `insertLinkCommand` now normalizes its `href`, and since every link entry point
15
+ (the selection bubble's input, the headless toolbar's URL panel, the KunUI
16
+ toolbar's popover, and a host's own `linkPrompt` adapter) dispatches that one
17
+ command, all of them are fixed at once — a host must not re-implement this.
18
+
19
+ - `www.kungal.com/topic/1` → `https://www.kungal.com/topic/1` (https, not http:
20
+ an http-only site redirects, an https-only site doesn't). Ports, queries,
21
+ fragments and bare IPv4 hosts included.
22
+ - `me@kungal.com` → `mailto:me@kungal.com` (`https://` would read the address as
23
+ userinfo and go nowhere).
24
+ - Untouched: anything with a scheme — `kungal-user:` / `kungal-reply:` included
25
+ — and anything explicitly relative (`/x`, `./x`, `../x`, `#x`, `?x`, `//host`).
26
+ - The one ambiguous input is a lone dotted word: `readme.md` looks exactly like
27
+ a hostname (`.md` is a TLD), so it gets `https://`. Write `./readme.md` when a
28
+ relative file is what you mean.
29
+
30
+ The rule is also exported as `normalizeLinkHref(input)` from the light,
31
+ zero-dependency `@kungal/editor-core` entry, so a server can normalize legacy
32
+ content with the exact same logic.
33
+
34
+ Along with it, the three URL inputs move from `type="url"` to `type="text"` +
35
+ `inputmode="url"`. Native URL validation rejects exactly the schemeless input
36
+ this change exists to accept — in the KunUI toolbar's popover, which submits a
37
+ real `<form>`, pressing Enter on `www.kungal.com/topic/1` did nothing at all.
38
+ The mobile keyboard hint is kept.
39
+
40
+ ### Patch Changes
41
+
42
+ - Updated dependencies [c90e1b9]
43
+ - @kungal/editor-core@0.35.0
44
+ - @kungal/editor-vue@0.35.0
45
+
46
+ ## 0.34.0
47
+
48
+ ### Minor Changes
49
+
50
+ - ab7fbc2: No native `prompt` left: the headless toolbar gets a link URL panel too
51
+
52
+ 0.33.0 gave the selection bubble an inline URL input; the fixed (headless)
53
+ toolbar still popped `window.prompt`. It now opens a small panel under the link
54
+ button — Enter applies, Esc cancels, clicking outside closes, and the editor
55
+ gets focus back. Same behaviour as the bubble otherwise: an existing href is
56
+ prefilled (and selected), and with nothing selected the URL is inserted as
57
+ linked text. A panel rather than an in-place swap because a fixed toolbar row
58
+ that rearranges itself is jarring; the bubble is already a floating layer, so
59
+ there the swap is the right shape.
60
+
61
+ **Breaking (CSS hook, one version old):** `.kun-editor__bubble-input` →
62
+ `.kun-editor__link-input`. Both entry points render the same input, so the hook
63
+ is named after the thing, not the place. Hosts importing
64
+ `@kungal/editor-nuxt/editor.css` need no change; a copied stylesheet wants the
65
+ rename plus the two new hooks:
66
+
67
+ ```css
68
+ .kun-editor__link {
69
+ position: relative;
70
+ } /* structural */
71
+ .kun-editor__link-panel {
72
+ position: absolute;
73
+ } /* structural */
74
+ .kun-editor__link-input {
75
+ /* shared by the toolbar panel and the bubble */
76
+ }
77
+ ```
78
+
79
+ `linkPrompt` keeps taking precedence over all three built-in entries (bubble
80
+ input, toolbar panel, KunUI popover), so a host modal is still one override.
81
+
82
+ ### Patch Changes
83
+
84
+ - Updated dependencies [ab7fbc2]
85
+ - @kungal/editor-core@0.34.0
86
+ - @kungal/editor-vue@0.34.0
87
+
3
88
  ## 0.33.0
4
89
 
5
90
  ### Minor Changes
package/editor.css CHANGED
@@ -166,23 +166,6 @@
166
166
  .kun-editor__bubble-btn:hover {
167
167
  background: var(--color-default-100);
168
168
  }
169
- /* Link entry: the bubble swaps its button row for this URL input in place
170
- (data-mode="link"), so no second floating layer is involved. */
171
- .kun-editor__bubble-input {
172
- width: 14rem;
173
- min-width: 0;
174
- padding: 0.25rem 0.5rem;
175
- border: 1px solid var(--color-default-200);
176
- border-radius: 0.375rem;
177
- background: transparent;
178
- color: var(--color-foreground);
179
- font: inherit;
180
- font-size: 0.875rem;
181
- outline: none;
182
- }
183
- .kun-editor__bubble-input:focus {
184
- border-color: var(--color-primary);
185
- }
186
169
 
187
170
  /* ── Loading placeholder (WYSIWYG create/hydrate gap) ───────────────────── */
188
171
  /* Shown while Milkdown hydrates; reserves height so the area doesn't collapse. */
@@ -270,6 +253,50 @@
270
253
  display: inline-flex;
271
254
  }
272
255
 
256
+ /* ── Link URL entry ─────────────────────────────────────────────────────── */
257
+ /* Two shapes, one input hook. The selection bubble swaps its button row for the
258
+ input IN PLACE (it is itself a floating tooltip — see `[data-mode='link']`);
259
+ the fixed toolbar, being a static row, opens this small panel under its
260
+ button instead. */
261
+ .kun-editor__link {
262
+ position: relative;
263
+ display: inline-flex;
264
+ }
265
+
266
+ .kun-editor__link-panel {
267
+ position: absolute;
268
+ top: calc(100% + 0.25rem);
269
+ left: 0;
270
+ z-index: 30;
271
+ display: flex;
272
+ align-items: center;
273
+ gap: 0.25rem;
274
+ padding: 0.375rem;
275
+ background: var(--kun-editor-surface);
276
+ border: 1px solid var(--color-default-200);
277
+ border-radius: 0.5rem;
278
+ box-shadow:
279
+ 0 4px 6px -1px rgb(0 0 0 / 0.1),
280
+ 0 2px 4px -2px rgb(0 0 0 / 0.1);
281
+ }
282
+
283
+ .kun-editor__link-input {
284
+ width: 14rem;
285
+ min-width: 0;
286
+ padding: 0.25rem 0.5rem;
287
+ border: 1px solid var(--color-default-200);
288
+ border-radius: 0.375rem;
289
+ background: transparent;
290
+ color: var(--color-foreground);
291
+ font: inherit;
292
+ font-size: 0.875rem;
293
+ outline: none;
294
+ }
295
+
296
+ .kun-editor__link-input:focus {
297
+ border-color: var(--color-primary);
298
+ }
299
+
273
300
  /* ── Markdown source (CodeMirror) ───────────────────────────────────────── */
274
301
  .kun-editor__source .cm-editor {
275
302
  border: 1px solid var(--color-default-200);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kungal/editor-nuxt",
3
- "version": "0.33.0",
3
+ "version": "0.35.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": [
@@ -32,8 +32,8 @@
32
32
  "nuxt.config.ts"
33
33
  ],
34
34
  "dependencies": {
35
- "@kungal/editor-core": "0.33.0",
36
- "@kungal/editor-vue": "0.33.0"
35
+ "@kungal/editor-core": "0.35.0",
36
+ "@kungal/editor-vue": "0.35.0"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "@kungal/ui-vue": "^2.7.0",
@@ -319,10 +319,14 @@ const insertSticker = (src: string, name: string) =>
319
319
  </KunButton>
320
320
  </KunTooltip>
321
321
  </template>
322
+ <!-- `type="text"` + `inputmode="url"`, never `type="url"`: this IS a
323
+ form, so native URL validation would block submit on a schemeless
324
+ `www.a.com/x` — the very input insertLinkCommand normalizes. -->
322
325
  <form class="flex items-center gap-1" @submit.prevent="applyLink">
323
326
  <KunInput
324
327
  v-model="linkUrl"
325
- type="url"
328
+ type="text"
329
+ inputmode="url"
326
330
  size="sm"
327
331
  :placeholder="t.linkPlaceholder"
328
332
  :autofocus="true"