Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: fix links in report issue dialog (#7071)

01zulfifea9c4e42b04
diff --git a/apps/web/src/dialogs/issue-dialog.tsx b/apps/web/src/dialogs/issue-dialog.tsx
index 8e3a2a091..9827bb2a4 100644
--- a/apps/web/src/dialogs/issue-dialog.tsx
+++ b/apps/web/src/dialogs/issue-dialog.tsx
@@ -127,12 +127,19 @@ export const IssueDialog = DialogManager.register(function IssueDialog(
<Link
href="https://github.com/streetwriters/notesnook/issues"
title="github.com/streetwriters/notesnook/issues"
- />{" "}
+ target="_blank"
+ >
+ github.com/streetwriters/notesnook/issues
+ </Link>
{strings.issueNotice[1]()}{" "}
<Link
href="https://discord.gg/zQBK97EE22"
title={strings.issueNotice[2]()}
- />
+ target="_blank"
+ >
+ {strings.issueNotice[2]()}
+ </Link>
+ /
</Text>
<Text variant="subBody" mt={1}>
{getDeviceInfo([`Pro: ${isUserPremium()}`])
diff --git a/apps/web/src/utils/md.ts b/apps/web/src/utils/md.ts
index bddabdb9a..e1d16a083 100644
--- a/apps/web/src/utils/md.ts
+++ b/apps/web/src/utils/md.ts
@@ -19,6 +19,22 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import snarkdown from "snarkdown";
+function addAttributes(
+ html: string,
+ tag: keyof HTMLElementTagNameMap,
+ attributes: Record<string, string>
+) {
+ const temp = document.createElement("div");
+ temp.innerHTML = html;
+ const elements = temp.querySelectorAll(tag);
+ elements.forEach((element) => {
+ Object.entries(attributes).forEach(([key, value]) => {
+ element.setAttribute(key, value);
+ });
+ });
+ return temp.innerHTML;
+}
+
export function mdToHtml(markdown: string) {
- return snarkdown(markdown);
+ return addAttributes(snarkdown(markdown), "a", { target: "_blank" });
}