]> BookStack Code Mirror - bookstack/blob - resources/js/editor/schema-marks.js
d4c546c08eeff35658e8e9fc28e530ab91847868
[bookstack] / resources / js / editor / schema-marks.js
1 import {schema as basicSchema} from "prosemirror-schema-basic";
2
3 const baseMarks = basicSchema.spec.marks;
4
5 const underline = {
6     parseDOM: [{tag: "u"}, {style: "text-decoration=underline"}],
7     toDOM() {
8         return ["span", {style: "text-decoration: underline;"}, 0];
9     }
10 };
11
12 const strike = {
13     parseDOM: [{tag: "s"}, {tag: "strike"}, {style: "text-decoration=line-through"}],
14     toDOM() {
15         return ["span", {style: "text-decoration: line-through;"}, 0];
16     }
17 };
18
19 const superscript = {
20     parseDOM: [{tag: "sup"}],
21     toDOM() {
22         return ["sup", 0];
23     }
24 };
25
26 const subscript = {
27     parseDOM: [{tag: "sub"}],
28     toDOM() {
29         return ["sub", 0];
30     }
31 };
32
33 const marks = baseMarks.append({
34     underline,
35     strike,
36     superscript,
37     subscript,
38 });
39
40 export default marks;