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