Skip to content

Build your personal knowledge base with Trilium Notes

check the attachment after conversion

zadamcea54aecad76
diff --git a/src/becca/entities/battachment.js b/src/becca/entities/battachment.js
index 6772710c2c..9da0835f92 100644
--- a/src/becca/entities/battachment.js
+++ b/src/becca/entities/battachment.js
@@ -124,9 +124,7 @@ class BAttachment extends AbstractBeccaEntity {
this._setContent(content, opts);
}
- /**
- * @returns {{note: BNote, branch: BBranch}}
- */
+ /** @returns {{note: BNote, branch: BBranch}} */
convertToNote() {
if (this.type === 'search') {
throw new Error(`Note of type search cannot have child notes`);
diff --git a/src/becca/entities/bnote.js b/src/becca/entities/bnote.js
index c21ecc8436..4225908a9e 100644
--- a/src/becca/entities/bnote.js
+++ b/src/becca/entities/bnote.js
@@ -1495,6 +1495,9 @@ class BNote extends AbstractBeccaEntity {
parentNote.setContent(fixedContent);
+ const noteService = require("../../services/notes");
+ noteService.asyncPostProcessContent(parentNote, fixedContent);
+
this.deleteNote();
return attachment;
diff --git a/src/public/app/widgets/attachment_detail.js b/src/public/app/widgets/attachment_detail.js
index 8c68ebac72..8c034b8cdb 100644
--- a/src/public/app/widgets/attachment_detail.js
+++ b/src/public/app/widgets/attachment_detail.js
@@ -153,12 +153,12 @@ export default class AttachmentDetailWidget extends BasicWidget {
$deletionWarning.show();
if (willBeDeletedInMs >= 60000) {
- $deletionWarning.text(`This attachment will be deleted in ${utils.formatTimeInterval(willBeDeletedInMs)}`);
+ $deletionWarning.text(`This attachment will be automatically deleted in ${utils.formatTimeInterval(willBeDeletedInMs)}`);
} else {
- $deletionWarning.text(`This attachment will be deleted soon`);
+ $deletionWarning.text(`This attachment will be automatically deleted soon`);
}
- $deletionWarning.append(", because the attachment is not linked in the note's content. To prevent deletion, add the attachment link back into the content.");
+ $deletionWarning.append(", because the attachment is not linked in the note's content. To prevent deletion, add the attachment link back into the content or convert the attachment into note.");
} else {
this.$wrapper.removeClass("scheduled-for-deletion");
$deletionWarning.hide();
@@ -185,11 +185,11 @@ export default class AttachmentDetailWidget extends BasicWidget {
});
utils.copyHtmlToClipboard($link[0].outerHTML);
+
+ toastService.showMessage("Attachment link copied to clipboard.");
} else {
throw new Error(`Unrecognized attachment role '${this.attachment.role}'.`);
}
-
- toastService.showMessage("Attachment link copied to clipboard.");
}
async entitiesReloadedEvent({loadResults}) {