Skip to content

Commit

Permalink
fix: missing unHTML func for url
Browse files Browse the repository at this point in the history
  • Loading branch information
igorlogius committed Jun 22, 2024
1 parent 4c7bfa8 commit 4d891ae
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 13 additions & 1 deletion background.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ const toHtmlEntities = (str, showInHtml = false) =>
.map((v) => `${showInHtml ? `&#` : `&#`}${v.codePointAt(0)};`)
.join(``);

function fromHtmlEntities(input) {
const el = document.createElement("div");
el.innerHTML = input;
return el.innerText;
}

function unHTML(input) {
const textArea = document.createElement("textarea");
textArea.innerText = input;
return textArea.innerHTML.split("<br>").join("\n");
}

async function exportJSON(bookmarkId) {
if (typeof bookmarkId !== "string") {
bookmarkId = "root________";
Expand Down Expand Up @@ -39,7 +51,7 @@ function rec2HtmlStr(bmTreeNode, level = 1) {
out +
"\t".repeat(level) +
'<DT><A HREF="' +
htmlEncode(bmTreeNode.url) +
unHTML(bmTreeNode.url) +
'">' +
title +
"</A>" +
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
"description": "Import or export a branch of the bookmark tree as a JSON or HTML file",
"name": "Bookmark Branch Porter",
"permissions": ["menus", "bookmarks"],
"version": "1.4.17"
"version": "1.4.18"
}

0 comments on commit 4d891ae

Please sign in to comment.