Skip to content

Build your personal knowledge base with Trilium Notes

clipper now creates notes with image attachments instead of image notes

zadamfefb059564f1
diff --git a/src/routes/api/clipper.js b/src/routes/api/clipper.js
index 9452c08c52..523a7a4fb4 100644
--- a/src/routes/api/clipper.js
+++ b/src/routes/api/clipper.js
@@ -152,20 +152,9 @@ function processContent(images, note, content) {
const buffer = Buffer.from(dataUrl.split(",")[1], 'base64');
- const {note: imageNote, url} = imageService.saveImage(note.noteId, buffer, filename, true);
-
- new BAttribute({
- noteId: imageNote.noteId,
- type: 'label',
- name: 'archived'
- }).save(); // so that these image notes don't show up in search / autocomplete
-
- new BAttribute({
- noteId: note.noteId,
- type: 'relation',
- name: 'imageLink',
- value: imageNote.noteId
- }).save();
+ const attachment = imageService.saveImageToAttachment(note.noteId, buffer, filename, true);
+ const sanitizedTitle = attachment.title.replace(/[^a-z0-9-.]/gi, "");
+ const url = `<img src="api/attachments/${attachment.attachmentId}/image/${sanitizedTitle}"/>`;
log.info(`Replacing '${imageId}' with '${url}' in note '${note.noteId}'`);