Commit c68573a7 authored by chris's avatar chris

schema

parent 4b8b9593
......@@ -112,9 +112,9 @@ const renderImage = file => {
});
};
const text = `<h1> this is a title</h1><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
const text = `<h1> this is a title</h1><p class="author">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</p><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</p><p class="paragraph">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</p>`;
......
......@@ -48,7 +48,9 @@ const parseTracks = str => {
const blockLevelToDOM = node => {
const attrs = node.attrs.track.length
? { "data-track": JSON.stringify(node.attrs.track) }
? {
"data-track": JSON.stringify(node.attrs.track)
}
: {};
return attrs;
};
......@@ -102,15 +104,17 @@ const EditoriaSchema = {
group: "block",
content: "inline*",
attrs: {
class: { default: "paragraph" },
track: {
default: []
}
},
parseDOM: [
{
tag: "p",
tag: "p.paragraph",
getAttrs(dom) {
return {
class: dom.getAttribute("class"),
track: parseTracks(dom.dataset.track)
};
}
......@@ -127,20 +131,25 @@ const EditoriaSchema = {
priority: 0,
defining: true,
attrs: {
class: { default: "author" }
class: { default: "author" },
track: {
default: []
}
},
parseDOM: [
{
tag: "p",
tag: "p.author",
getAttrs(dom) {
return {
class: dom.getAttribute("class")
class: dom.getAttribute("class"),
track: parseTracks(dom.dataset.track)
};
}
}
],
toDOM(node) {
return ["p", node.attrs, 0];
const attrs = blockLevelToDOM(node);
return ["p", attrs, 0];
}
},
epigraphProse: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment