md-editor-rt
Version:
Markdown editor for react, developed in jsx and typescript, dark theme、beautify content by prettier、render articles directly、paste or clip the picture and upload it...
3 lines (2 loc) • 854 B
JavaScript
;const a=require("./config.cjs"),l=(e,t="image.png")=>{const r=e.split(","),n=r[0].match(/:(.*?);/);if(n){const i=n[1],o=atob(r[1]);let s=o.length;const c=new Uint8Array(s);for(;s--;)c[s]=o.charCodeAt(s);return new File([c],t,{type:i})}return null},u=(e,t)=>{if(!e)return e;const r=t.split(`
`),n=['<span rn-wrapper aria-hidden="true">'];return r.forEach(()=>{n.push("<span></span>")}),n.push("</span>"),`<span class="${a.prefix}-code-block">${e}</span>${n.join("")}`},p=e=>e.filter(Boolean).join(" "),g=(e,t)=>{if(!e||!t)return 0;const r=e?.getBoundingClientRect();if(t===document.documentElement)return r.top-t.clientTop;const n=t?.getBoundingClientRect();return r.top-n.top},m=(()=>{let e=0;return()=>++e})();exports.base642File=l;exports.classnames=p;exports.generateCodeRowNumber=u;exports.getRelativeTop=g;exports.getZIndexIncrement=m;