@kungal/editor-nuxt 0.31.1 → 0.32.1

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,40 @@
1
1
  # @kungal/editor-nuxt
2
2
 
3
+ ## 0.32.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 814c98f: Drive toolbar and bubble toggle-mark state from one editor plugin view, and keep the orphan-link cleanup out of undo history.
8
+
9
+ The previous Milkdown-listener + per-toolbar `refresh()` pair leaked subscriptions, missed stored-mark toggles for 200ms, and left the selection bubble without a pressed state. A single ProseMirror `view.update` plugin now writes one reactive record that the toolbar, the `#toolbar` slot, and the bubble all read. The leftover stored-link cleanup is marked `addToHistory: false`.
10
+
11
+ - Updated dependencies [814c98f]
12
+ - @kungal/editor-core@0.32.1
13
+ - @kungal/editor-vue@0.32.1
14
+
15
+ ## 0.32.0
16
+
17
+ ### Minor Changes
18
+
19
+ - 7dd7f71: Show an active state on the toolbar's toggle marks (bold / italic /
20
+ strikethrough / inline code).
21
+
22
+ The toolbar buttons ran the toggle commands but never reflected whether the
23
+ mark was on, so a user could not tell if bold (etc.) was engaged. The
24
+ `#toolbar` slot API now exposes a reactive `activeMarks` map (bold / italic /
25
+ strike / code), recomputed from the ProseMirror selection on selection and doc
26
+ changes and immediately after each command. `<KunEditorToolbar>` renders the
27
+ pressed buttons with the primary "active" look (same as hover) and sets
28
+ `aria-pressed`; the headless `EditorToolbar` sets `data-active` for the
29
+ `.kun-editor__tool[data-active='true']` style.
30
+
31
+ ### Patch Changes
32
+
33
+ - Updated dependencies [7dd7f71]
34
+ - Updated dependencies [35bc140]
35
+ - @kungal/editor-vue@0.32.0
36
+ - @kungal/editor-core@0.32.0
37
+
3
38
  ## 0.31.1
4
39
 
5
40
  ### Patch Changes
package/editor.css CHANGED
@@ -229,6 +229,17 @@
229
229
  background: var(--color-default-100);
230
230
  }
231
231
 
232
+ .kun-editor__tool[data-active='true'],
233
+ .kun-editor__bubble-btn[data-active='true'] {
234
+ background: var(--color-primary);
235
+ color: var(--color-primary-contrast, #fff);
236
+ }
237
+
238
+ .kun-editor__tool[data-active='true']:hover,
239
+ .kun-editor__bubble-btn[data-active='true']:hover {
240
+ background: var(--color-primary);
241
+ }
242
+
232
243
  .kun-editor__icon {
233
244
  display: inline-flex;
234
245
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kungal/editor-nuxt",
3
- "version": "0.31.1",
3
+ "version": "0.32.1",
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.31.1",
36
- "@kungal/editor-vue": "0.31.1"
35
+ "@kungal/editor-core": "0.32.1",
36
+ "@kungal/editor-vue": "0.32.1"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "@kungal/ui-vue": "^2.7.0",
@@ -40,6 +40,7 @@ import {
40
40
  import { EMOJI } from '@kungal/editor-vue'
41
41
  import type {
42
42
  KunEditorToolbarApi,
43
+ KunToggleMark,
43
44
  KunToolbarItem,
44
45
  StickerPack
45
46
  } from '@kungal/editor-vue'
@@ -101,15 +102,18 @@ interface Tool {
101
102
  icon: string
102
103
  title: string
103
104
  run: () => void
105
+ // The toggle mark this button flips, when any. Buttons with a mark render a
106
+ // pressed/active state (see the template) driven by `api.activeMarks`.
107
+ mark?: KunToggleMark
104
108
  }
105
109
 
106
110
  // The plain command buttons (everything except heading / image / picker).
107
111
  // `.key` is read at click time via props.run (populated once the editor exists).
108
112
  const commandButtons = computed<Record<string, Tool>>(() => ({
109
- bold: { icon: 'lucide:bold', title: t.value.bold, run: () => props.run(toggleStrongCommand.key) },
110
- italic: { icon: 'lucide:italic', title: t.value.italic, run: () => props.run(toggleEmphasisCommand.key) },
111
- strike: { icon: 'lucide:strikethrough', title: t.value.strike, run: () => props.run(toggleStrikethroughCommand.key) },
112
- code: { icon: 'lucide:code', title: t.value.code, run: () => props.run(toggleInlineCodeCommand.key) },
113
+ bold: { icon: 'lucide:bold', title: t.value.bold, run: () => props.run(toggleStrongCommand.key), mark: 'bold' },
114
+ italic: { icon: 'lucide:italic', title: t.value.italic, run: () => props.run(toggleEmphasisCommand.key), mark: 'italic' },
115
+ strike: { icon: 'lucide:strikethrough', title: t.value.strike, run: () => props.run(toggleStrikethroughCommand.key), mark: 'strike' },
116
+ code: { icon: 'lucide:code', title: t.value.code, run: () => props.run(toggleInlineCodeCommand.key), mark: 'code' },
113
117
  bulletList: { icon: 'lucide:list', title: t.value.bulletList, run: () => props.run(wrapInBulletListCommand.key) },
114
118
  orderedList: { icon: 'lucide:list-ordered', title: t.value.orderedList, run: () => props.run(wrapInOrderedListCommand.key) },
115
119
  quote: { icon: 'lucide:text-quote', title: t.value.quote, run: () => props.run(wrapInBlockquoteCommand.key) },
@@ -427,10 +431,20 @@ const insertSticker = (src: string, name: string) =>
427
431
  :delay-show="300"
428
432
  >
429
433
  <KunButton
430
- variant="light"
434
+ :variant="
435
+ item.tool.mark && props.activeMarks[item.tool.mark]
436
+ ? 'flat'
437
+ : 'light'
438
+ "
439
+ :color="
440
+ item.tool.mark && props.activeMarks[item.tool.mark]
441
+ ? 'primary'
442
+ : 'default'
443
+ "
431
444
  size="sm"
432
445
  :is-icon-only="true"
433
446
  :aria-label="item.tool.title"
447
+ :aria-pressed="item.tool.mark ? props.activeMarks[item.tool.mark] : undefined"
434
448
  @click="item.tool.run()"
435
449
  >
436
450
  <KunIcon :name="item.tool.icon" />