vditor
Version:
♏ 易于使用的 Markdown 编辑器,为适配不同的应用场景而生
13 lines (11 loc) • 496 B
text/typescript
import {code160to32} from "../util/code160to32";
export const getMarkdown = (vditor: IVditor) => {
if (vditor.currentMode === "sv") {
return code160to32(`${vditor.sv.element.textContent}\n`.replace(/\n\n$/, "\n"));
} else if (vditor.currentMode === "wysiwyg") {
return vditor.lute.VditorDOM2Md(vditor.wysiwyg.element.innerHTML);
} else if (vditor.currentMode === "ir") {
return vditor.lute.VditorIRDOM2Md(vditor.ir.element.innerHTML);
}
return "";
};