diff --git a/priv/static/js/dom.js b/priv/static/js/dom.js
index 64fc95c..75d392a 100644
--- a/priv/static/js/dom.js
+++ b/priv/static/js/dom.js
@@ -13,7 +13,17 @@ export function html(strings, ...values) {
return stringToHTML(String.raw({ raw: strings }));
}
+// Taken from https://stackoverflow.com/a/8943487
+const urlRegex =
+ /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gi;
+
+function linkify(text) {
+ return text.replace(urlRegex, function (url) {
+ return '' + url + "";
+ });
+}
+
export function renderText(text) {
- const content = text.replace(/(?:\r\n|\r|\n)/g, "
") + "
";
+ const content = linkify(text).replace(/(?:\r\n|\r|\n)/g, "
") + "
";
return stringToHTML(content, true);
}
diff --git a/priv/static/js/jenot.js b/priv/static/js/jenot.js
index bf6cc25..be51c06 100644
--- a/priv/static/js/jenot.js
+++ b/priv/static/js/jenot.js
@@ -253,9 +253,11 @@ function renderNote(note) {
}
container.addEventListener("click", async (e) => {
- const note = await Notes.get(container.id);
- editNote.load(structuredClone(note));
- editNoteDialog.showModal();
+ if (e.target.tagName !== "A") {
+ const note = await Notes.get(container.id);
+ editNote.load(structuredClone(note));
+ editNoteDialog.showModal();
+ }
});
return container;