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) • 896 B
JavaScript
;const i=require("./config.cjs"),a=(t,e="image.png")=>{const s=t.split(","),n=s[0].match(/:(.*?);/);if(n){const u=n[1],o=atob(s[1]);let r=o.length;const c=new Uint8Array(r);for(;r--;)c[r]=o.charCodeAt(r);return new File([c],e,{type:u})}return null},l=(t,e)=>{if(!t)return t;const s=e.split(`
`),n=['<span rn-wrapper aria-hidden="true">'];return s.forEach(()=>{n.push("<span></span>")}),n.push("</span>"),`<span class="${i.prefix}-code-block">${t}</span>${n.join("")}`},p=t=>t.filter(e=>e!==!1&&e!==void 0).join(" "),g=(t,e)=>{if(!t||!e)return 0;const s=t==null?void 0:t.getBoundingClientRect();if(e===document.documentElement)return s.top-e.clientTop;const n=e==null?void 0:e.getBoundingClientRect();return s.top-n.top},d=(()=>{let t=0;return()=>++t})();exports.base642File=a;exports.classnames=p;exports.generateCodeRowNumber=l;exports.getRelativeTop=g;exports.getZIndexIncrement=d;