Skip to content

Build your personal knowledge base with Trilium Notes

added new label type URL with open button, fixes #156

azivner44f85224e7a6
diff --git a/src/public/javascripts/dialogs/attributes.js b/src/public/javascripts/dialogs/attributes.js
index dcb1a1b933..7f91472853 100644
--- a/src/public/javascripts/dialogs/attributes.js
+++ b/src/public/javascripts/dialogs/attributes.js
@@ -27,7 +27,8 @@ function AttributesModel() {
{ text: "Text", value: "text" },
{ text: "Number", value: "number" },
{ text: "Boolean", value: "boolean" },
- { text: "Date", value: "date" }
+ { text: "Date", value: "date" },
+ { text: "URL", value: "url"}
];
this.multiplicityTypes = [
diff --git a/src/public/javascripts/services/note_detail.js b/src/public/javascripts/services/note_detail.js
index d69cd2fe2b..ed71e5aabd 100644
--- a/src/public/javascripts/services/note_detail.js
+++ b/src/public/javascripts/services/note_detail.js
@@ -309,6 +309,15 @@ async function loadAttributes() {
$actionCell.append($todayButton);
}
+ else if (definition.labelType === 'url') {
+ $input.prop("placeholder", "http://website...");
+
+ const $openButton = $("<button>").addClass("btn btn-small").text("Open").click(() => {
+ window.open($input.val(), '_blank');
+ });
+
+ $actionCell.append($openButton);
+ }
else {
messagingService.logError("Unknown labelType=" + definitionAttr.labelType);
}