md-editor-v3
Version:
Markdown editor for vue3, developed in jsx and typescript, dark theme、beautify content by prettier、render articles directly、paste or clip the picture and upload it...
39 lines (38 loc) • 933 B
JavaScript
import { p } from "./config.mjs";
const u = (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;
}, l = (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="${p}-code-block">${t}</span>${n.join("")}`;
}, g = (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;
}, m = /* @__PURE__ */ (() => {
let t = 0;
return () => ++t;
})();
export {
g as a,
u as b,
m as c,
l as g
};