check the attachment after conversion

This commit is contained in:
zadam 2023-07-14 21:18:56 +02:00
parent ff6f2a4d44
commit cea54aecad
3 changed files with 9 additions and 8 deletions

View File

@ -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`);

View File

@ -1495,6 +1495,9 @@ class BNote extends AbstractBeccaEntity {
parentNote.setContent(fixedContent);
const noteService = require("../../services/notes");
noteService.asyncPostProcessContent(parentNote, fixedContent);
this.deleteNote();
return attachment;

View File

@ -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}) {