UNPKG

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...

40 lines (39 loc) 983 B
import { p as i } from "./config.mjs"; const l = (t, e = "image.png") => { const r = t.split(","), n = r[0].match(/:(.*?);/); if (n) { const c = n[1], o = atob(r[1]); let s = o.length; const a = new Uint8Array(s); for (; s--; ) a[s] = o.charCodeAt(s); return new File([a], e, { type: c }); } return null; }, u = (t, e) => { if (!t) return t; const r = e.split(` `), n = ['<span rn-wrapper aria-hidden="true">']; return r.forEach(() => { n.push("<span></span>"); }), n.push("</span>"), `<span class="${i}-code-block">${t}</span>${n.join("")}`; }, g = (t) => t.filter(Boolean).join(" "), m = (t, e) => { if (!t || !e) return 0; const r = t?.getBoundingClientRect(); if (e === document.documentElement) return r.top - e.clientTop; const n = e?.getBoundingClientRect(); return r.top - n.top; }, d = /* @__PURE__ */ (() => { let t = 0; return () => ++t; })(); export { m as a, l as b, g as c, d, u as g };