@kungal/editor-vue 0.24.0 → 0.25.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,37 @@
1
1
  # @kungal/editor-vue
2
2
 
3
+ ## 0.25.0
4
+
5
+ ### Minor Changes
6
+
7
+ - a103220: Placeholder: default to `'doc'` mode + expose `placeholderMode`.
8
+
9
+ The placeholder used to appear on **every empty line** (the cursor's empty
10
+ block) — that's the Milkdown/Notion `'block'` behavior, which was the default but
11
+ is surprising for a reply/comment editor. `<KunEditor>` now defaults to `'doc'`:
12
+ the placeholder shows **only while the whole editor is empty** (the conventional
13
+ empty-state hint), and the new `placeholderMode` prop opts back into per-line
14
+ `'block'`:
15
+
16
+ ```vue
17
+ <KunEditor v-model="md" placeholder="写点什么…" />
18
+ <!-- only when empty -->
19
+ <KunEditor v-model="md" placeholder="写点什么…" placeholder-mode="block" />
20
+ <!-- on each empty line -->
21
+ ```
22
+
23
+ (The lower-level `createKunEditorPlugins(..., { placeholderMode })` /
24
+ `createPlaceholderPlugin` still default to `'block'` for parity with Crepe; the
25
+ opinion lives in the `<KunEditor>` component.)
26
+
27
+ Verified in the docs production build: empty editor shows the placeholder; typing
28
+ a line then Enter (an empty line in a non-empty doc) does not; `placeholder-mode="block"`
29
+ brings back the per-line hint. 47 core tests pass (incl. new doc-vs-block cases).
30
+
31
+ ### Patch Changes
32
+
33
+ - @kungal/editor-core@0.25.0
34
+
3
35
  ## 0.24.0
4
36
 
5
37
  ### Minor Changes
@@ -12,8 +12,14 @@ type __VLS_Props = {
12
12
  locale?: KunEditorLocale;
13
13
  /** Read-only render (no editing). */
14
14
  readonly?: boolean;
15
- /** Placeholder text shown while the editor is empty. */
15
+ /** Placeholder text shown while empty. */
16
16
  placeholder?: string;
17
+ /**
18
+ * When the placeholder shows: `'doc'` (default) only while the whole editor
19
+ * is empty (the conventional empty-state hint); `'block'` on any empty block
20
+ * at the cursor (Notion style — a hint on every new empty line).
21
+ */
22
+ placeholderMode?: 'doc' | 'block';
17
23
  /**
18
24
  * Which view modes to offer in the switch. Default all three. Drop `'split'`
19
25
  * (or use just `['wysiwyg']`) for compact editors like a reply/comment box —
@@ -78,6 +84,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, KunEditorEx
78
84
  locale: KunEditorLocale;
79
85
  readonly: boolean;
80
86
  placeholder: string;
87
+ placeholderMode: "doc" | "block";
81
88
  selectionToolbar: boolean | KunSelectionItem[];
82
89
  views: ViewMode[];
83
90
  scrollSync: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"KunEditor.vue.d.ts","sourceRoot":"","sources":["../../src/components/KunEditor.vue"],"names":[],"mappings":"AA8VA,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,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,wDAAwD;IACxD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;;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;AA0ZJ,QAAA,IAAI,OAAO;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  readonly: boolean;
9
9
  placeholder: string;
10
+ placeholderMode: 'doc' | 'block';
10
11
  selectionToolbar: boolean;
11
12
  };
12
13
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, KunEditorExpose, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
@@ -1 +1 @@
1
- {"version":3,"file":"MilkdownEditor.vue.d.ts","sourceRoot":"","sources":["../../src/components/MilkdownEditor.vue"],"names":[],"mappings":"AA4MA,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,gBAAgB,EAAE,OAAO,CAAA;CAC1B,CAAC;AA4JF,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":"AA8MA,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;AA6JF,QAAA,MAAM,YAAY;;;;kFAIhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
package/dist/index.js CHANGED
@@ -242,6 +242,7 @@ var X = Symbol("kun-editor-context"), ve = [
242
242
  locale: {},
243
243
  readonly: { type: Boolean },
244
244
  placeholder: {},
245
+ placeholderMode: {},
245
246
  selectionToolbar: { type: Boolean }
246
247
  },
247
248
  emits: ["update:modelValue"],
@@ -256,7 +257,8 @@ var X = Symbol("kun-editor-context"), ve = [
256
257
  })), l && t.set(c.key, { view: s({ component: Te }) }), d && t.set(u.key, { view: s({ component: ke }) });
257
258
  }).use(G(i.adapters, i.features, {
258
259
  locale: i.locale,
259
- placeholder: i.placeholder
260
+ placeholder: i.placeholder,
261
+ placeholderMode: i.placeholderMode
260
262
  }));
261
263
  return l && t.use(c), d && t.use(u), t;
262
264
  });
@@ -658,6 +660,7 @@ var X = Symbol("kun-editor-context"), ve = [
658
660
  default: !1
659
661
  },
660
662
  placeholder: { default: "" },
663
+ placeholderMode: { default: "doc" },
661
664
  views: { default: () => [
662
665
  "wysiwyg",
663
666
  "source",
@@ -806,6 +809,7 @@ var X = Symbol("kun-editor-context"), ve = [
806
809
  locale: s.locale,
807
810
  readonly: G.value,
808
811
  placeholder: s.placeholder,
812
+ "placeholder-mode": s.placeholderMode,
809
813
  "selection-toolbar": k.value,
810
814
  "onUpdate:modelValue": K
811
815
  }, null, 8, [
@@ -815,6 +819,7 @@ var X = Symbol("kun-editor-context"), ve = [
815
819
  "locale",
816
820
  "readonly",
817
821
  "placeholder",
822
+ "placeholder-mode",
818
823
  "selection-toolbar"
819
824
  ])], 512), [[x, j.value === "wysiwyg" || j.value === "split"]])], 8, lt)]),
820
825
  _: 3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kungal/editor-vue",
3
- "version": "0.24.0",
3
+ "version": "0.25.0",
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.24.0"
43
+ "@kungal/editor-core": "0.25.0"
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.24.0"
83
+ "@kungal/editor-core": "0.25.0"
84
84
  },
85
85
  "scripts": {
86
86
  "build": "vite build && vue-tsc -p tsconfig.build.json",