UNPKG

on-codemerge

Version:

A WYSIWYG editor for on-codemerge is a user-friendly interface that allows users to edit and view their code in real time, exactly as it will appear in the final product

102 lines (101 loc) 2.11 kB
const s = { bold: { name: "Bold", className: "format-bold" }, italic: { name: "Italic", className: "format-italic" }, underline: { name: "Underline", className: "format-underline" }, strikethrough: { name: "Strikethrough", className: "format-strikethrough" }, superscript: { name: "Superscript", className: "format-superscript" }, subscript: { name: "Subscript", className: "format-subscript" }, fontSize: { name: "Font Size", className: "format-font-size" }, fontFamily: { name: "Font Family", className: "format-font-family" }, alignLeft: { name: "Align Left", className: "format-align-left", block: !0 }, alignCenter: { name: "Align Center", className: "format-align-center", block: !0 }, alignRight: { name: "Align Right", className: "format-align-right", block: !0 }, alignJustify: { name: "Align Justify", className: "format-align-justify", block: !0 }, lineHeight: { name: "Line Height", className: "format-line-height" }, letterSpacing: { name: "Letter Spacing", className: "format-letter-spacing" }, textTransform: { name: "Text Transform", className: "format-text-transform" }, textInline: { name: "Text Inline", className: "format-text-inline" }, textBlock: { name: "Text Block", className: "format-text-block" } }; class l { set(a, e) { const t = s[e]; t.block && (a.classList.remove( "format-align-left", "format-align-center", "format-align-right", "format-align-justify" ), a.classList.add("format-text-block")), a.classList.add(t.className); } remove(a, e) { const t = s[e]; a.classList.remove(t.className), t.block && (a.classList.remove( "format-align-left", "format-align-center", "format-align-right", "format-align-justify" ), a.classList.remove("format-text-block")); } has(a, e) { const t = s[e]; return a.classList.contains(t.className); } } export { l as StyleManager };