mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-07-28 17:02:04 +03:00
Split marks and nodes into their own files
This commit is contained in:
40
resources/js/editor/schema-marks.js
Normal file
40
resources/js/editor/schema-marks.js
Normal file
@ -0,0 +1,40 @@
|
||||
import {schema as basicSchema} from "prosemirror-schema-basic";
|
||||
|
||||
const baseMarks = basicSchema.spec.marks;
|
||||
|
||||
const underline = {
|
||||
parseDOM: [{tag: "u"}, {style: "text-decoration=underline"}],
|
||||
toDOM() {
|
||||
return ["span", {style: "text-decoration: underline;"}, 0];
|
||||
}
|
||||
};
|
||||
|
||||
const strike = {
|
||||
parseDOM: [{tag: "s"}, {tag: "strike"}, {style: "text-decoration=line-through"}],
|
||||
toDOM() {
|
||||
return ["span", {style: "text-decoration: line-through;"}, 0];
|
||||
}
|
||||
};
|
||||
|
||||
const superscript = {
|
||||
parseDOM: [{tag: "sup"}],
|
||||
toDOM() {
|
||||
return ["sup", 0];
|
||||
}
|
||||
};
|
||||
|
||||
const subscript = {
|
||||
parseDOM: [{tag: "sub"}],
|
||||
toDOM() {
|
||||
return ["sub", 0];
|
||||
}
|
||||
};
|
||||
|
||||
const marks = baseMarks.append({
|
||||
underline,
|
||||
strike,
|
||||
superscript,
|
||||
subscript,
|
||||
});
|
||||
|
||||
export default marks;
|
Reference in New Issue
Block a user