@kungal/editor-vue 0.25.1 → 0.25.2

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-vue
2
2
 
3
+ ## 0.25.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 8e1b8ac: Fix the source pane rewriting raw markdown in split/source mode.
8
+
9
+ Typing `>` turned into `> <br />`, and `~~` / `**` / `[` became `\~\~` / `\*\*` /
10
+ `\[` in the markdown source. Cause: those are Milkdown's WYSIWYG→markdown
11
+ serialization (empty-blockquote → `<br />`, and remark-stringify escaping special
12
+ characters) — correct when Milkdown is the editor, but in split/source mode the
13
+ CodeMirror source owns the raw markdown, and the read-only preview was echoing its
14
+ re-serialized markdown back into the shared `v-model`, clobbering what you typed.
15
+
16
+ Fix: the WYSIWYG editor now emits only when it is the ACTIVE editor (WYSIWYG
17
+ mode). In source/split mode it's a derived preview and never writes back, so the
18
+ source keeps your exact raw markdown. The preview still renders it correctly.
19
+
20
+ Verified in the docs production build (split mode): `> `, `~~strike~~`,
21
+ `**bold**`, and a lone `>` all stay verbatim in the source (no `<br />`, no
22
+ backslash escapes); WYSIWYG-mode editing still updates the value; 0 console errors.
23
+
24
+ - @kungal/editor-core@0.25.2
25
+
3
26
  ## 0.25.1
4
27
 
5
28
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"KunEditor.vue.d.ts","sourceRoot":"","sources":["../../src/components/KunEditor.vue"],"names":[],"mappings":"AAsWA,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EAChB,MAAM,qBAAqB,CAAA;AAM5B,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AASjE,KAAK,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAA;AAE9C,KAAK,WAAW,GAAG;IACf,gCAAgC;IAChC,UAAU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IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,CAAC;AAQhD,QAAA,MAAM,UAAU;;;;;cA1cD,iBAAiB;cAEjB,iBAAiB;YAEnB,eAAe;cAEb,OAAO;iBAEJ,MAAM;qBAMF,KAAK,GAAG,OAAO;sBAgBd,OAAO,GAAG,gBAAgB,EAAE;WAVvC,QAAQ,EAAE;gBAGL,OAAO;6EAwbtB,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"}
@@ -9,6 +9,12 @@ type __VLS_Props = {
9
9
  placeholder: string;
10
10
  placeholderMode: 'doc' | 'block';
11
11
  selectionToolbar: boolean;
12
+ /**
13
+ * Whether this WYSIWYG is the ACTIVE editor (source of truth). False in
14
+ * source/split mode, where the CodeMirror source owns the raw markdown and this
15
+ * is only a derived preview — so it must NOT emit its re-serialized markdown.
16
+ */
17
+ active: boolean;
12
18
  };
13
19
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, KunEditorExpose, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
14
20
  "update:modelValue": (markdown: string) => any;
@@ -1 +1 @@
1
- {"version":3,"file":"MilkdownEditor.vue.d.ts","sourceRoot":"","sources":["../../src/components/MilkdownEditor.vue"],"names":[],"mappings":"AA2NA,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EAChB,MAAM,qBAAqB,CAAA;AAI5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/C,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,MAAM,EAAE,eAAe,CAAA;IACvB,QAAQ,EAAE,OAAO,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,eAAe,EAAE,KAAK,GAAG,OAAO,CAAA;IAChC,gBAAgB,EAAE,OAAO,CAAA;CAC1B,CAAC;AA0KF,QAAA,MAAM,YAAY;;;;kFAIhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"MilkdownEditor.vue.d.ts","sourceRoot":"","sources":["../../src/components/MilkdownEditor.vue"],"names":[],"mappings":"AAsOA,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EAChB,MAAM,qBAAqB,CAAA;AAI5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/C,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,MAAM,EAAE,eAAe,CAAA;IACvB,QAAQ,EAAE,OAAO,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,eAAe,EAAE,KAAK,GAAG,OAAO,CAAA;IAChC,gBAAgB,EAAE,OAAO,CAAA;IACzB;;;;OAIG;IACH,MAAM,EAAE,OAAO,CAAA;CAChB,CAAC;AA+KF,QAAA,MAAM,YAAY;;;;kFAIhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
package/dist/index.js CHANGED
@@ -243,14 +243,15 @@ var X = Symbol("kun-editor-context"), ye = [
243
243
  readonly: { type: Boolean },
244
244
  placeholder: {},
245
245
  placeholderMode: {},
246
- selectionToolbar: { type: Boolean }
246
+ selectionToolbar: { type: Boolean },
247
+ active: { type: Boolean }
247
248
  },
248
249
  emits: ["update:modelValue"],
249
250
  setup(e, { expose: t, emit: r }) {
250
251
  let i = e, a = r, o = i.modelValue, s = !1, c = M(), l = B("kunMention"), u = i.features.mention !== !1 && !!i.adapters.searchMentionUsers && !!c, d = H("kunSelectionTooltip"), f = i.selectionToolbar && !!c, p = O((e) => {
251
252
  let t = N.make().config((t) => {
252
253
  t.set(L, e), t.set(P, i.modelValue), t.get(R).markdownUpdated((e, t, n) => {
253
- s || t === n || (o = t, a("update:modelValue", t));
254
+ !i.active || s || t === n || (o = t, a("update:modelValue", t));
254
255
  }), t.update(I, (e) => ({
255
256
  ...e,
256
257
  editable: () => !i.readonly
@@ -826,6 +827,7 @@ var X = Symbol("kun-editor-context"), ye = [
826
827
  readonly: G.value,
827
828
  placeholder: s.placeholder,
828
829
  "placeholder-mode": s.placeholderMode,
830
+ active: j.value === "wysiwyg" && !s.readonly,
829
831
  "selection-toolbar": k.value,
830
832
  "onUpdate:modelValue": K
831
833
  }, null, 8, [
@@ -836,6 +838,7 @@ var X = Symbol("kun-editor-context"), ye = [
836
838
  "readonly",
837
839
  "placeholder",
838
840
  "placeholder-mode",
841
+ "active",
839
842
  "selection-toolbar"
840
843
  ])], 512), [[x, j.value === "wysiwyg" || j.value === "split"]])], 8, ut)]),
841
844
  _: 3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kungal/editor-vue",
3
- "version": "0.25.1",
3
+ "version": "0.25.2",
4
4
  "description": "KunEditor Vue 3 layer — the headless <KunEditor> component (dual WYSIWYG / markdown-source), toolbar and plugin views. Ships zero CSS and no UI-kit dependency; consumes @kungal/editor-core, and pairs with @kungal/editor-nuxt for optional KunUI chrome.",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -40,7 +40,7 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "@prosemirror-adapter/vue": "^0.4.6",
43
- "@kungal/editor-core": "0.25.1"
43
+ "@kungal/editor-core": "0.25.2"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "@codemirror/lang-markdown": "^6.0.0",
@@ -80,7 +80,7 @@
80
80
  "vite": "^8.0.16",
81
81
  "vue": "^3.5.35",
82
82
  "vue-tsc": "^3.3.3",
83
- "@kungal/editor-core": "0.25.1"
83
+ "@kungal/editor-core": "0.25.2"
84
84
  },
85
85
  "scripts": {
86
86
  "build": "vite build && vue-tsc -p tsconfig.build.json",