@powerduck/md-editor 0.11.7 → 0.11.8

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
@@ -83,7 +83,7 @@ const html = editor.getHtml();
83
83
 
84
84
  - [Official Website](https://www.powerduck.com/opensource/md-editor.html)
85
85
  - [Documentation](https://www.powerduck.com/docs/md-editor/introduction)
86
- - [Live Demo](https://www.powerduck.com/demo/md-editor)
86
+ - [Live Demo](https://www.powerduck.com/demo/)
87
87
  - [GitHub](https://github.com/powerducklab/md-editor)
88
88
  - [npm](https://www.npmjs.com/package/@powerduck/md-editor)
89
89
 
@@ -193,8 +193,9 @@ interface MarkdownEditorHandle {
193
193
  setValue(value: string): void;
194
194
  getHtml(): string;
195
195
  focus(): void;
196
- blur(): void;
197
- clear(): void;
196
+ setMode(mode: EditorMode): void;
197
+ setTheme(theme: EditorTheme): void;
198
+ renderNow(): void;
198
199
  }
199
200
  ```
200
201
 
package/dist/index.cjs CHANGED
@@ -36,7 +36,7 @@ ${r}
36
36
  </div>`).join("")+'</div><div class="md-editor-help-section-title">Syntax</div><div class="md-editor-help-list">'+s.map(o=>`<div class="md-editor-help-row">
37
37
  <span class="md-editor-help-desc">${o.label}</span>
38
38
  <span class="md-editor-help-syntax">${o.hint}</span>
39
- </div>`).join("")+"</div>"}const r=t.el.querySelector(".md-editor-popup-footer");r&&(r.innerHTML='<span class="md-editor-help-brand-text">PowerDuck Markdown Editor</span><a href="https://www.powerduck.com" target="_blank" rel="noopener noreferrer" class="md-editor-help-link">powerduck.com</a>',r.style.justifyContent="space-between",r.style.alignItems="center"),this.activePopup=t,this.activePopup.show()}async handleImageFile(e){if(this.onImageUpload)try{const t=await this.onImageUpload(e);t&&this.codeEditor.insertAtCursor(Re(t,e.name.replace(/\.[^.]+$/,"")||"image"))}catch{}}showTipsPopup(e){var s;(s=this.activePopup)==null||s.destroy();const t=[{key:"notice",label:"Notice",color:"#0969da"},{key:"info",label:"Info",color:"#0969da"},{key:"tip",label:"Tip",color:"#1a7f37"},{key:"success",label:"Success",color:"#1a7f37"},{key:"warning",label:"Warning",color:"#9a6700"},{key:"danger",label:"Danger",color:"#cf222e"}],i=new X(e,{title:"Insert callout",theme:this.theme,fields:[],onSubmit:()=>{}}),r=i.el.querySelector(".md-editor-popup-body");if(r){const o=document.createElement("div");o.className="md-editor-tips-grid";for(const c of t){const l=document.createElement("button");l.type="button",l.className="md-editor-tips-option",l.innerHTML=`<span class="md-editor-tips-dot" style="background:${c.color}"></span><span>${c.label}</span>`,l.addEventListener("click",()=>{this.codeEditor.insertAtCursor(`:::${c.key} ${c.label}
39
+ </div>`).join("")+"</div>"}const r=t.el.querySelector(".md-editor-popup-footer");r&&(r.innerHTML='<span class="md-editor-help-brand-text">Powerduck Markdown Editor</span><a href="https://www.powerduck.com" target="_blank" rel="noopener noreferrer" class="md-editor-help-link">powerduck.com</a>',r.style.justifyContent="space-between",r.style.alignItems="center"),this.activePopup=t,this.activePopup.show()}async handleImageFile(e){if(this.onImageUpload)try{const t=await this.onImageUpload(e);t&&this.codeEditor.insertAtCursor(Re(t,e.name.replace(/\.[^.]+$/,"")||"image"))}catch{}}showTipsPopup(e){var s;(s=this.activePopup)==null||s.destroy();const t=[{key:"notice",label:"Notice",color:"#0969da"},{key:"info",label:"Info",color:"#0969da"},{key:"tip",label:"Tip",color:"#1a7f37"},{key:"success",label:"Success",color:"#1a7f37"},{key:"warning",label:"Warning",color:"#9a6700"},{key:"danger",label:"Danger",color:"#cf222e"}],i=new X(e,{title:"Insert callout",theme:this.theme,fields:[],onSubmit:()=>{}}),r=i.el.querySelector(".md-editor-popup-body");if(r){const o=document.createElement("div");o.className="md-editor-tips-grid";for(const c of t){const l=document.createElement("button");l.type="button",l.className="md-editor-tips-option",l.innerHTML=`<span class="md-editor-tips-dot" style="background:${c.color}"></span><span>${c.label}</span>`,l.addEventListener("click",()=>{this.codeEditor.insertAtCursor(`:::${c.key} ${c.label}
40
40
 
41
41
  Your ${c.key.toLowerCase()} content here.
42
42
 
package/dist/index.mjs CHANGED
@@ -8823,7 +8823,7 @@ ${r}
8823
8823
  ).join("") + "</div>";
8824
8824
  }
8825
8825
  const r = t.el.querySelector(".md-editor-popup-footer");
8826
- r && (r.innerHTML = '<span class="md-editor-help-brand-text">PowerDuck Markdown Editor</span><a href="https://www.powerduck.com" target="_blank" rel="noopener noreferrer" class="md-editor-help-link">powerduck.com</a>', r.style.justifyContent = "space-between", r.style.alignItems = "center"), this.activePopup = t, this.activePopup.show();
8826
+ r && (r.innerHTML = '<span class="md-editor-help-brand-text">Powerduck Markdown Editor</span><a href="https://www.powerduck.com" target="_blank" rel="noopener noreferrer" class="md-editor-help-link">powerduck.com</a>', r.style.justifyContent = "space-between", r.style.alignItems = "center"), this.activePopup = t, this.activePopup.show();
8827
8827
  }
8828
8828
  // ---------- Image upload ----------
8829
8829
  async handleImageFile(e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerduck/md-editor",
3
- "version": "0.11.7",
3
+ "version": "0.11.8",
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",