@kungal/editor-nuxt 0.31.1 → 0.32.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,28 @@
1
1
  # @kungal/editor-nuxt
2
2
 
3
+ ## 0.32.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 7dd7f71: Show an active state on the toolbar's toggle marks (bold / italic /
8
+ strikethrough / inline code).
9
+
10
+ The toolbar buttons ran the toggle commands but never reflected whether the
11
+ mark was on, so a user could not tell if bold (etc.) was engaged. The
12
+ `#toolbar` slot API now exposes a reactive `activeMarks` map (bold / italic /
13
+ strike / code), recomputed from the ProseMirror selection on selection and doc
14
+ changes and immediately after each command. `<KunEditorToolbar>` renders the
15
+ pressed buttons with the primary "active" look (same as hover) and sets
16
+ `aria-pressed`; the headless `EditorToolbar` sets `data-active` for the
17
+ `.kun-editor__tool[data-active='true']` style.
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies [7dd7f71]
22
+ - Updated dependencies [35bc140]
23
+ - @kungal/editor-vue@0.32.0
24
+ - @kungal/editor-core@0.32.0
25
+
3
26
  ## 0.31.1
4
27
 
5
28
  ### Patch Changes
package/editor.css CHANGED
@@ -229,6 +229,15 @@
229
229
  background: var(--color-default-100);
230
230
  }
231
231
 
232
+ .kun-editor__tool[data-active='true'] {
233
+ background: var(--color-primary);
234
+ color: var(--color-primary-contrast, #fff);
235
+ }
236
+
237
+ .kun-editor__tool[data-active='true']:hover {
238
+ background: var(--color-primary);
239
+ }
240
+
232
241
  .kun-editor__icon {
233
242
  display: inline-flex;
234
243
  }
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.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.31.1",
36
- "@kungal/editor-vue": "0.31.1"
35
+ "@kungal/editor-core": "0.32.0",
36
+ "@kungal/editor-vue": "0.32.0"
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" />