Commit 176853f9 authored by chris's avatar chris

link mark

parent 584fab70
...@@ -78,24 +78,28 @@ const EditoriaSchema = { ...@@ -78,24 +78,28 @@ const EditoriaSchema = {
marks: { marks: {
link: { link: {
attrs: { attrs: {
href: {}, href: { default: null },
rel: { default: "" },
target: { default: "blank" },
title: { default: null } title: { default: null }
}, },
inclusive: false, inclusive: false,
parseDOM: [ parseDOM: [
{ {
tag: "a[href]", tag: "a[href]",
getAttrs(dom) { getAttrs: dom => {
const href = dom.getAttribute("href");
const target = href && href.indexOf("#") === 0 ? "" : "blank";
return { return {
href: dom.getAttribute("href"), href: dom.getAttribute("href"),
title: dom.getAttribute("title") title: dom.getAttribute("title"),
target
}; };
} }
} }
], ],
toDOM(node) { toDOM(node) {
let { href, title } = node.attrs; return ["a", node.attrs, 0];
return ["a", { href, title }, 0];
} }
}, },
em: { em: {
......
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