@powerduck/md-editor 0.8.3 → 0.8.5

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/README.md CHANGED
@@ -247,6 +247,11 @@ npm run build # vite build + d.ts generation
247
247
 
248
248
  ## Changelog
249
249
 
250
+ ### v0.8.4
251
+
252
+ - **Fixed**: React component `MarkdownEditorReact` now passes through all extra props (`mention`, `docLink`, `toolbar`, `onImageUpload`, `includeCommonHeaders`, `includeCookies`, `placeholder`, etc.) to the underlying `MarkdownEditor` instance. Previously only a subset of props were forwarded, so `mention` and `docLink` configs were silently ignored.
253
+ - **Test**: 311 tests, all passing, zero unhandled errors.
254
+
250
255
  ### v0.8.3
251
256
 
252
257
  - **Changed**: Task list checkbox semantics inverted per project convention. `- [ ]` now renders as **checked** (green checkmark); `- [x]` / `- [X]` renders as **unchecked** (empty box). `toggleTaskList()` and all tests updated accordingly.
package/dist/index.d.ts CHANGED
@@ -128,3 +128,5 @@ export { icons, type IconName } from './icons.js';
128
128
  export { Popup, type PopupConfig, type PopupField } from './plugins/popup.js';
129
129
  export { extractYouTubeId, youTubeEmbedMarkdown, imageMarkdown, videoMarkdown, isVideoFile } from './plugins/media.js';
130
130
  export { DEFAULT_SHORTCUTS, matchShortcut, formatShortcut, formatShortcutHtml, type ShortcutDef } from './plugins/keyboard.js';
131
+ export { type MentionItem, type MentionOptions } from './plugins/mention.js';
132
+ export { type DocItem, type DocMeta, type DocLinkOptions } from './plugins/doclink.js';
package/dist/react.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("react/jsx-runtime"),n=require("react"),y=require("./index.cjs"),k=n.forwardRef(function(g,v){const{value:u,defaultValue:E,onChange:a,className:M,style:V,mode:i,theme:c,math:d,mindmap:l,preview:f,autoPreview:m,renderDebounce:w}=g,s=n.useRef(null),t=n.useRef(null),o=n.useRef(a);return o.current=a,n.useLayoutEffect(()=>{if(!s.current)return;const e=new y.MarkdownEditor(s.current,{value:u??E??"",mode:i,theme:c,math:d,mindmap:l,preview:f,autoPreview:m,renderDebounce:w,onChange:r=>{var R;return(R=o.current)==null?void 0:R.call(o,r)}});return t.current=e,()=>{e.destroy(),t.current=null}},[i,d,l,f,m,w]),n.useEffect(()=>{const e=t.current;!e||u===void 0||e.getValue()!==u&&e.setValue(u)},[u]),n.useEffect(()=>{t.current&&c&&t.current.setTheme(c)},[c]),n.useImperativeHandle(v,()=>({getValue:()=>{var e;return((e=t.current)==null?void 0:e.getValue())??""},setValue:e=>{var r;return(r=t.current)==null?void 0:r.setValue(e)},getHtml:()=>{var e;return((e=t.current)==null?void 0:e.getHtml())??""},focus:()=>{var e;return(e=t.current)==null?void 0:e.focus()},setMode:e=>{var r;return(r=t.current)==null?void 0:r.setMode(e)},setTheme:e=>{var r;return(r=t.current)==null?void 0:r.setTheme(e)},renderNow:()=>{var e;return(e=t.current)==null?void 0:e.renderNow()}}),[]),h.jsx("div",{ref:s,className:M,style:V})});exports.MarkdownEditorReact=k;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react/jsx-runtime"),n=require("react"),k=require("./index.cjs"),p=n.forwardRef(function(g,v){const{value:u,defaultValue:E,onChange:a,className:M,style:V,mode:i,theme:c,math:d,mindmap:l,preview:f,autoPreview:m,renderDebounce:w,...h}=g,o=n.useRef(null),t=n.useRef(null),s=n.useRef(a);return s.current=a,n.useLayoutEffect(()=>{if(!o.current)return;const e=new k.MarkdownEditor(o.current,{value:u??E??"",mode:i,theme:c,math:d,mindmap:l,preview:f,autoPreview:m,renderDebounce:w,onChange:r=>{var R;return(R=s.current)==null?void 0:R.call(s,r)},...h});return t.current=e,()=>{e.destroy(),t.current=null}},[i,d,l,f,m,w]),n.useEffect(()=>{const e=t.current;!e||u===void 0||e.getValue()!==u&&e.setValue(u)},[u]),n.useEffect(()=>{t.current&&c&&t.current.setTheme(c)},[c]),n.useImperativeHandle(v,()=>({getValue:()=>{var e;return((e=t.current)==null?void 0:e.getValue())??""},setValue:e=>{var r;return(r=t.current)==null?void 0:r.setValue(e)},getHtml:()=>{var e;return((e=t.current)==null?void 0:e.getHtml())??""},focus:()=>{var e;return(e=t.current)==null?void 0:e.focus()},setMode:e=>{var r;return(r=t.current)==null?void 0:r.setMode(e)},setTheme:e=>{var r;return(r=t.current)==null?void 0:r.setTheme(e)},renderNow:()=>{var e;return(e=t.current)==null?void 0:e.renderNow()}}),[]),y.jsx("div",{ref:o,className:M,style:V})});exports.MarkdownEditorReact=p;
package/dist/react.mjs CHANGED
@@ -1,12 +1,12 @@
1
- import { jsx as R } from "react/jsx-runtime";
2
- import { forwardRef as k, useRef as a, useLayoutEffect as y, useEffect as v, useImperativeHandle as H } from "react";
3
- import { MarkdownEditor as N } from "./index.mjs";
4
- const C = k(
1
+ import { jsx as k } from "react/jsx-runtime";
2
+ import { forwardRef as y, useRef as s, useLayoutEffect as H, useEffect as v, useImperativeHandle as N } from "react";
3
+ import { MarkdownEditor as T } from "./index.mjs";
4
+ const D = y(
5
5
  function(V, g) {
6
6
  const {
7
7
  value: n,
8
8
  defaultValue: h,
9
- onChange: s,
9
+ onChange: a,
10
10
  className: E,
11
11
  style: M,
12
12
  mode: i,
@@ -15,11 +15,15 @@ const C = k(
15
15
  mindmap: f,
16
16
  preview: d,
17
17
  autoPreview: m,
18
- renderDebounce: w
19
- } = V, o = a(null), r = a(null), c = a(s);
20
- return c.current = s, y(() => {
18
+ renderDebounce: w,
19
+ // All remaining options (mention, docLink, toolbar, onImageUpload,
20
+ // includeCommonHeaders, includeCookies, lineNumbers, placeholder, etc.)
21
+ // are passed through to the underlying MarkdownEditor instance.
22
+ ...R
23
+ } = V, o = s(null), r = s(null), c = s(a);
24
+ return c.current = a, H(() => {
21
25
  if (!o.current) return;
22
- const e = new N(o.current, {
26
+ const e = new T(o.current, {
23
27
  value: n ?? h ?? "",
24
28
  mode: i,
25
29
  theme: u,
@@ -31,7 +35,8 @@ const C = k(
31
35
  onChange: (t) => {
32
36
  var p;
33
37
  return (p = c.current) == null ? void 0 : p.call(c, t);
34
- }
38
+ },
39
+ ...R
35
40
  });
36
41
  return r.current = e, () => {
37
42
  e.destroy(), r.current = null;
@@ -41,7 +46,7 @@ const C = k(
41
46
  !e || n === void 0 || e.getValue() !== n && e.setValue(n);
42
47
  }, [n]), v(() => {
43
48
  r.current && u && r.current.setTheme(u);
44
- }, [u]), H(
49
+ }, [u]), N(
45
50
  g,
46
51
  () => ({
47
52
  getValue: () => {
@@ -74,9 +79,9 @@ const C = k(
74
79
  }
75
80
  }),
76
81
  []
77
- ), /* @__PURE__ */ R("div", { ref: o, className: E, style: M });
82
+ ), /* @__PURE__ */ k("div", { ref: o, className: E, style: M });
78
83
  }
79
84
  );
80
85
  export {
81
- C as MarkdownEditorReact
86
+ D as MarkdownEditorReact
82
87
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerduck/md-editor",
3
- "version": "0.8.3",
3
+ "version": "0.8.5",
4
4
  "description": "High-performance embeddable Markdown editor: KaTeX math, Markmap mindmaps, highlight.js code blocks with copy button, github-markdown-css preview, admonition blocks, rich toolbar with image/video/YouTube/table popups, keyboard shortcuts, configurable toolbar, image upload hook, standalone renderMarkdown API, React component, block-level incremental rendering. Simple and complex modes, light/dark themes.",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",