diff --git a/editors/editoria/src/Editoria.js b/editors/editoria/src/Editoria.js index 970df2218367faf71bf95fefabf1151297792909..5ed1bbbde5e7b57928cc448242a01be927514e8a 100644 --- a/editors/editoria/src/Editoria.js +++ b/editors/editoria/src/Editoria.js @@ -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>`; diff --git a/wax-prosemirror-schema/src/EditoriaSchema.js b/wax-prosemirror-schema/src/EditoriaSchema.js index 4aae65897e08b070443fc7306b6b3bfe248ddb2d..7dab05c26da1caf9c76148217dc3ac6910ef27aa 100644 --- a/wax-prosemirror-schema/src/EditoriaSchema.js +++ b/wax-prosemirror-schema/src/EditoriaSchema.js @@ -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: {