DEV: use upload short-url in html to markdown conversion if 'base62-sha1' data attr available.

This commit is contained in:
Vinoth Kannan
2019-07-05 10:06:41 +05:30
parent 65a6f3080e
commit 1bb258ab49
2 changed files with 19 additions and 2 deletions

View File

@@ -206,8 +206,16 @@ export class Tag {
["lightbox", "d-lazyload"].includes(attr.class) &&
hasChild(e, "img")
) {
let href = attr.href;
const img = (e.children || []).find(c => c.name === "img");
const base62SHA1 = img.attributes["data-base62-sha1"];
text = attr.title || "";
return "![" + text + "](" + attr.href + ")";
if (base62SHA1) {
href = `upload://${base62SHA1}`;
}
return "![" + text + "](" + href + ")";
}
if (attr.href && text !== attr.href) {