velaris-richtext-editor
Version:
A modern WYSIWYG rich text editor based on tiptap and shadcn ui for React
77 lines (76 loc) • 1.66 kB
JavaScript
import { M as r, m as e } from "./index-Drmyqk9P.js";
const u = r.create({
name: "subscript",
addOptions() {
return {
HTMLAttributes: {}
};
},
parseHTML() {
return [
{
tag: "sub"
},
{
style: "vertical-align",
getAttrs(t) {
return t !== "sub" ? !1 : null;
}
}
];
},
renderHTML({ HTMLAttributes: t }) {
return ["sub", e(this.options.HTMLAttributes, t), 0];
},
addCommands() {
return {
setSubscript: () => ({ commands: t }) => t.setMark(this.name),
toggleSubscript: () => ({ commands: t }) => t.toggleMark(this.name),
unsetSubscript: () => ({ commands: t }) => t.unsetMark(this.name)
};
},
addKeyboardShortcuts() {
return {
"Mod-,": () => this.editor.commands.toggleSubscript()
};
}
}), n = r.create({
name: "superscript",
addOptions() {
return {
HTMLAttributes: {}
};
},
parseHTML() {
return [
{
tag: "sup"
},
{
style: "vertical-align",
getAttrs(t) {
return t !== "super" ? !1 : null;
}
}
];
},
renderHTML({ HTMLAttributes: t }) {
return ["sup", e(this.options.HTMLAttributes, t), 0];
},
addCommands() {
return {
setSuperscript: () => ({ commands: t }) => t.setMark(this.name),
toggleSuperscript: () => ({ commands: t }) => t.toggleMark(this.name),
unsetSuperscript: () => ({ commands: t }) => t.unsetMark(this.name)
};
},
addKeyboardShortcuts() {
return {
"Mod-.": () => this.editor.commands.toggleSuperscript()
};
}
});
export {
u as S,
n as a
};