1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-28 17:02:04 +03:00

Got link insert/editor working

This commit is contained in:
Dan Brown
2022-01-16 14:37:58 +00:00
parent 7703face52
commit 89194a3f85
6 changed files with 107 additions and 66 deletions

View File

@ -1,19 +1,25 @@
const link = {
attrs: {
href: {},
title: {default: null}
title: {default: null},
target: {default: null}
},
inclusive: false,
parseDOM: [{
tag: "a[href]", getAttrs: function getAttrs(dom) {
return {href: dom.getAttribute("href"), title: dom.getAttribute("title")}
return {
href: dom.getAttribute("href"),
title: dom.getAttribute("title"),
target: dom.getAttribute("target"),
}
}
}],
toDOM: function toDOM(node) {
const ref = node.attrs;
const href = ref.href;
const title = ref.title;
return ["a", {href: href, title: title}, 0]
const target = ref.target;
return ["a", {href, title, target}, 0]
}
};