mirror of
https://github.com/zadam/trilium.git
synced 2025-10-27 16:26:31 +01:00
add api.runOutsideOfSync() to backend script API, #4327
This commit is contained in:
@@ -160,11 +160,17 @@ class BNote extends AbstractBeccaEntity {
|
||||
*/
|
||||
this.contentSize = null;
|
||||
/**
|
||||
* size of the content and note revision contents in bytes
|
||||
* size of the note content, attachment contents in bytes
|
||||
* @type {int|null}
|
||||
* @private
|
||||
*/
|
||||
this.noteSize = null;
|
||||
this.contentAndAttachmentsSize = null;
|
||||
/**
|
||||
* size of the note content, attachment contents and revision contents in bytes
|
||||
* @type {int|null}
|
||||
* @private
|
||||
*/
|
||||
this.contentAndAttachmentsAndRevisionsSize = null;
|
||||
/**
|
||||
* number of note revisions for this note
|
||||
* @type {int|null}
|
||||
@@ -1635,16 +1641,12 @@ class BNote extends AbstractBeccaEntity {
|
||||
|
||||
revision.save(); // to generate revisionId, which is then used to save attachments
|
||||
|
||||
if (this.type === 'text') {
|
||||
for (const noteAttachment of this.getAttachments()) {
|
||||
if (noteAttachment.utcDateScheduledForErasureSince) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const revisionAttachment = noteAttachment.copy();
|
||||
revisionAttachment.ownerId = revision.revisionId;
|
||||
revisionAttachment.setContent(noteAttachment.getContent(), {forceSave: true});
|
||||
for (const noteAttachment of this.getAttachments()) {
|
||||
const revisionAttachment = noteAttachment.copy();
|
||||
revisionAttachment.ownerId = revision.revisionId;
|
||||
revisionAttachment.setContent(noteAttachment.getContent(), {forceSave: true});
|
||||
|
||||
if (this.type === 'text') {
|
||||
// content is rewritten to point to the revision attachments
|
||||
noteContent = noteContent.replaceAll(`attachments/${noteAttachment.attachmentId}`,
|
||||
`attachments/${revisionAttachment.attachmentId}`);
|
||||
|
||||
Reference in New Issue
Block a user