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
110 lines (109 loc) • 2.46 kB
JavaScript
/*! on-codemerge v1.3.1 @author Pavel Kuzmin @license MIT @homepage https://s00d.github.io/on-codemerge/ @repository git+https://github.com/s00d/on-codemerge.git Copyright (c) 2026 Pavel Kuzmin - Built on 2026-07-02T13:39:17.947Z */
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 {
getConfig(a) {
return s[a];
}
isBlockStyle(a) {
var t;
return !!((t = s[a]) != null && t.block);
}
set(a, t) {
const e = s[t];
e.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(e.className);
}
remove(a, t) {
const e = s[t];
a.classList.remove(e.className), e.block && (a.classList.remove(
"format-align-left",
"format-align-center",
"format-align-right",
"format-align-justify"
), a.classList.remove("format-text-block"));
}
has(a, t) {
const e = s[t];
return a.classList.contains(e.className);
}
}
export {
l as StyleManager
};