@kungal/editor-vue 0.31.0 → 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 +64 -0
- package/README.md +4 -4
- package/dist/components/EditorToolbar.vue.d.ts.map +1 -1
- package/dist/components/KunEditor.vue.d.ts +1 -0
- package/dist/components/KunEditor.vue.d.ts.map +1 -1
- package/dist/components/ToolbarHost.vue.d.ts +1 -0
- package/dist/components/ToolbarHost.vue.d.ts.map +1 -1
- package/dist/composables/useActiveMarks.d.ts +10 -0
- package/dist/composables/useActiveMarks.d.ts.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +296 -258
- package/dist/types.d.ts +8 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,69 @@
|
|
|
1
1
|
# @kungal/editor-vue
|
|
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 [35bc140]
|
|
22
|
+
- @kungal/editor-core@0.32.0
|
|
23
|
+
|
|
24
|
+
## 0.31.1
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- b7fe837: Fix a long `placeholder` overflowing the editor, and ship the reference
|
|
29
|
+
stylesheet from the layer.
|
|
30
|
+
|
|
31
|
+
The placeholder is a decoration (`.kun-editor__placeholder` +
|
|
32
|
+
`data-placeholder`) rendered by the host's `::before` rule. That rule was
|
|
33
|
+
absolutely positioned with **no positioned ancestor**, so the browser laid it
|
|
34
|
+
out against the viewport: a long placeholder ran past the editor's right edge —
|
|
35
|
+
and could even paint over the toolbar — instead of wrapping inside it. The
|
|
36
|
+
empty block is now the containing block, and the text wraps (`width: 100%` +
|
|
37
|
+
`overflow-wrap: break-word`):
|
|
38
|
+
|
|
39
|
+
```css
|
|
40
|
+
.kun-editor__placeholder {
|
|
41
|
+
position: relative;
|
|
42
|
+
}
|
|
43
|
+
.kun-editor__placeholder::before {
|
|
44
|
+
content: attr(data-placeholder);
|
|
45
|
+
position: absolute;
|
|
46
|
+
top: 0;
|
|
47
|
+
left: 0;
|
|
48
|
+
width: 100%;
|
|
49
|
+
overflow-wrap: break-word;
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Because that CSS lived only in the docs app, every host had a _copy_ — an
|
|
54
|
+
upstream style fix could never reach them. The reference stylesheet now ships
|
|
55
|
+
with `@kungal/editor-nuxt`, so hosts can import it and get fixes with a version
|
|
56
|
+
bump (copying it still works):
|
|
57
|
+
|
|
58
|
+
```css
|
|
59
|
+
@import "@kungal/editor-nuxt/editor.css";
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`@kungal/editor-vue` is unchanged and still headless (zero CSS).
|
|
63
|
+
|
|
64
|
+
- Updated dependencies [b7fe837]
|
|
65
|
+
- @kungal/editor-core@0.31.1
|
|
66
|
+
|
|
3
67
|
## 0.31.0
|
|
4
68
|
|
|
5
69
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -7,8 +7,8 @@ WYSIWYG preview + markdown-source), its toolbar and the Vue plugin views
|
|
|
7
7
|
|
|
8
8
|
**Headless — ships zero CSS.** The component only renders stable class hooks
|
|
9
9
|
(`.kun-editor__*`, `.kun-mention-dropdown*`) + `data-*` state; you own the look.
|
|
10
|
-
|
|
11
|
-
(themed with KunUI tokens), or write your own. It works in any Vue 3 app;
|
|
10
|
+
Import the reference stylesheet [`@kungal/editor-nuxt/editor.css`](../editor-nuxt/editor.css)
|
|
11
|
+
(themed with KunUI tokens), copy it, or write your own. It works in any Vue 3 app;
|
|
12
12
|
`@kungal/editor-nuxt` adds Nuxt auto-import sugar.
|
|
13
13
|
|
|
14
14
|
## Usage
|
|
@@ -16,8 +16,8 @@ Copy the reference stylesheet [`apps/docs/app/assets/css/kun-editor.css`](../../
|
|
|
16
16
|
```vue
|
|
17
17
|
<script setup lang="ts">
|
|
18
18
|
import { KunEditor, type KunEditorAdapters } from '@kungal/editor-vue'
|
|
19
|
-
// Headless: bring your own styles
|
|
20
|
-
import '
|
|
19
|
+
// Headless: bring your own styles, or use the KunUI-themed reference sheet.
|
|
20
|
+
import '@kungal/editor-nuxt/editor.css'
|
|
21
21
|
|
|
22
22
|
const markdown = ref('')
|
|
23
23
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorToolbar.vue.d.ts","sourceRoot":"","sources":["../../src/components/EditorToolbar.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EditorToolbar.vue.d.ts","sourceRoot":"","sources":["../../src/components/EditorToolbar.vue"],"names":[],"mappings":"AA4gBA,QAAA,MAAM,YAAY,+QAChB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -54,6 +54,7 @@ declare var __VLS_1: {
|
|
|
54
54
|
toggleScrollSync: () => void;
|
|
55
55
|
}, __VLS_22: {
|
|
56
56
|
run: <T>(key: import("@milkdown/kit/core").CmdKey<T>, payload?: T) => void;
|
|
57
|
+
activeMarks: Readonly<Record<import("../types").KunToggleMark, boolean>>;
|
|
57
58
|
insertText: (text: string) => void;
|
|
58
59
|
uploadImage: (file: File) => void;
|
|
59
60
|
insertImage: (payload: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KunEditor.vue.d.ts","sourceRoot":"","sources":["../../src/components/KunEditor.vue"],"names":[],"mappings":"AAsbA,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,UAAU,EACX,MAAM,qBAAqB,CAAA;AAO5B,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAUjE,KAAK,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAA;AAE9C,KAAK,WAAW,GAAG;IACf,gCAAgC;IAChC,UAAU,EAAE,MAAM,CAAA;IAClB,uEAAuE;IACvE,QAAQ,CAAC,EAAE,iBAAiB,CAAA;IAC5B,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,iBAAiB,CAAA;IAC5B,qDAAqD;IACrD,MAAM,CAAC,EAAE,eAAe,CAAA;IACxB,qCAAqC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,0CAA0C;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;;OAIG;IACH,eAAe,CAAC,EAAE,KAAK,GAAG,OAAO,CAAA;IACjC;;;;OAIG;IACH,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAA;IAClB;oEACgE;IAChE,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,OAAO,GAAG,gBAAgB,EAAE,CAAA;CAChD,CAAC;AAgfJ,QAAA,IAAI,OAAO;;iBAzZS,QAAQ;;;;;;;;;;;;;CAyZP,EAAE,QAAQ;iEAtjB/B,
|
|
1
|
+
{"version":3,"file":"KunEditor.vue.d.ts","sourceRoot":"","sources":["../../src/components/KunEditor.vue"],"names":[],"mappings":"AAsbA,OAAO,KAAK,EACV,iB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AAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,CAAC;AAShD,QAAA,MAAM,UAAU;;;;;;;;;cA5hBD,iBAAiB;cAEjB,iBAAiB;YAEnB,eAAe;cAEb,OAAO;iBAEJ,MAAM;qBAMF,KAAK,GAAG,OAAO;sBAgBd,OAAO,GAAG,gBAAgB,EAAE;WAVvC,QAAQ,EAAE;gBAGL,OAAO;6EA0gBtB,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AAWzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CmdKey } from '@milkdown/kit/core';
|
|
2
2
|
declare var __VLS_1: {
|
|
3
3
|
run: <T>(key: CmdKey<T>, payload?: T) => void;
|
|
4
|
+
activeMarks: Readonly<Record<import("..").KunToggleMark, boolean>>;
|
|
4
5
|
insertText: (text: string) => void;
|
|
5
6
|
uploadImage: (file: File) => void;
|
|
6
7
|
insertImage: (payload: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolbarHost.vue.d.ts","sourceRoot":"","sources":["../../src/components/ToolbarHost.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ToolbarHost.vue.d.ts","sourceRoot":"","sources":["../../src/components/ToolbarHost.vue"],"names":[],"mappings":"AAgHA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AA8GhD,QAAA,IAAI,OAAO;oCA/GX,CAzEkC;;;;;;WAyElC,CAjCgC;aAiChC,CA/BM;;;;YA+BN,CAjBI;;;;;;;;;;;;;;CAgIkB,CAAE;AACxB,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AAG/C,QAAA,MAAM,UAAU,+QACd,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AACzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useActiveMarks.d.ts","sourceRoot":"","sources":["../../src/composables/useActiveMarks.ts"],"names":[],"mappings":"AA2BA,eAAO,MAAM,cAAc;;;;;;;mBAUL,IAAI;CA8BzB,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export type { KunEditorExpose } from './types';
|
|
|
5
5
|
export type { KunEditorToolbarApi } from './types';
|
|
6
6
|
export type { KunToolbarItem } from './types';
|
|
7
7
|
export type { KunSelectionItem } from './types';
|
|
8
|
+
export type { KunToggleMark } from './types';
|
|
8
9
|
export type { KunEditorViewSwitchApi } from './types';
|
|
9
10
|
export { EMOJI } from './emoji';
|
|
10
11
|
export type { KunHeading } from '@kungal/editor-core';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAO,MAAM,EAAE,MAAM,KAAK,CAAA;AACtC,OAAO,SAAS,MAAM,4BAA4B,CAAA;AAElD,OAAO,EAAE,SAAS,EAAE,CAAA;AAGpB,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAG9C,YAAY,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAGlD,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAG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