1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-30 04:23:11 +03:00

Split marks and nodes into their own files

This commit is contained in:
Dan Brown
2022-01-11 16:26:12 +00:00
parent c3595b1807
commit 34db138a64
4 changed files with 92 additions and 83 deletions

View File

@ -0,0 +1,30 @@
import {schema as basicSchema} from "prosemirror-schema-basic";
import {addListNodes} from "prosemirror-schema-list";
const baseNodes = addListNodes(basicSchema.spec.nodes, "paragraph block*", "block");
const callout = {
attrs: {
type: {default: 'info'},
},
content: "inline*",
group: "block",
defining: true,
parseDOM: [
{tag: 'p.callout.info', attrs: {type: 'info'}, priority: 75,},
{tag: 'p.callout.success', attrs: {type: 'success'}, priority: 75,},
{tag: 'p.callout.danger', attrs: {type: 'danger'}, priority: 75,},
{tag: 'p.callout.warning', attrs: {type: 'warning'}, priority: 75,},
{tag: 'p.callout', attrs: {type: 'info'}, priority: 75},
],
toDOM(node) {
const type = node.attrs.type || 'info';
return ['p', {class: 'callout ' + type}, 0];
}
};
const nodes = baseNodes.append({
callout,
});
export default nodes;