Skip to content

Build your personal knowledge base with Trilium Notes

Allow arbitrary labels to be added via web clipper

J Raofdffc27bb67c
diff --git a/src/routes/api/clipper.js b/src/routes/api/clipper.js
index 60914e9797..e1500c2c0b 100644
--- a/src/routes/api/clipper.js
+++ b/src/routes/api/clipper.js
@@ -75,7 +75,7 @@ function addClipping(req) {
}
function createNote(req) {
- let {title, content, pageUrl, images, clipType} = req.body;
+ let {title, content, pageUrl, images, clipType, labels} = req.body;
if (!title || !title.trim()) {
title = `Clipped note from ${pageUrl}`;
@@ -100,6 +100,13 @@ function createNote(req) {
note.setLabel('pageUrl', pageUrl);
note.setLabel('iconClass', 'bx bx-globe');
}
+
+ if (labels) {
+ for (const labelName in labels) {
+ console.log('set label ' + labelName + ' on the new note!');
+ note.setLabel(labelName, labels[labelName]);
+ }
+ }
const rewrittenContent = processContent(images, note, content);