mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
fix mentions
This commit is contained in:
parent
b7c37fdf58
commit
788841d256
2
libraries/ckeditor/ckeditor.js
vendored
2
libraries/ckeditor/ckeditor.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -247,7 +247,7 @@ class AbstractBeccaEntity {
|
|||||||
throw new Error(`Cannot find content for ${this.constructor.primaryKeyName} '${this[this.constructor.primaryKeyName]}', blobId '${this.blobId}'`);
|
throw new Error(`Cannot find content for ${this.constructor.primaryKeyName} '${this[this.constructor.primaryKeyName]}', blobId '${this.blobId}'`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return blobService.processContent(row.content);
|
return blobService.processContent(row.content, this.isProtected, this.hasStringContent());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1580,23 +1580,25 @@ class BNote extends AbstractBeccaEntity {
|
|||||||
dateCreated: dateUtils.localNowDateTime()
|
dateCreated: dateUtils.localNowDateTime()
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
revision.save(); // to generate revisionId which is then used to save attachments
|
revision.save(); // to generate revisionId, which is then used to save attachments
|
||||||
|
|
||||||
for (const noteAttachment of this.getAttachments()) {
|
if (this.type === 'text') {
|
||||||
if (noteAttachment.utcDateScheduledForErasureSince) {
|
for (const noteAttachment of this.getAttachments()) {
|
||||||
continue;
|
if (noteAttachment.utcDateScheduledForErasureSince) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const revisionAttachment = noteAttachment.copy();
|
||||||
|
revisionAttachment.parentId = revision.revisionId;
|
||||||
|
revisionAttachment.setContent(noteAttachment.getContent(), {forceSave: true});
|
||||||
|
|
||||||
|
// content is rewritten to point to the revision attachments
|
||||||
|
noteContent = noteContent.replaceAll(`attachments/${noteAttachment.attachmentId}`, `attachments/${revisionAttachment.attachmentId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const revisionAttachment = noteAttachment.copy();
|
revision.setContent(noteContent, {forceSave: true});
|
||||||
revisionAttachment.parentId = revision.revisionId;
|
|
||||||
revisionAttachment.setContent(noteAttachment.getContent(), { forceSave: true });
|
|
||||||
|
|
||||||
// content is rewritten to point to the revision attachments
|
|
||||||
noteContent = noteContent.replaceAll(`attachments/${noteAttachment.attachmentId}`, `attachments/${revisionAttachment.attachmentId}`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
revision.setContent(noteContent, { forceSave: true });
|
|
||||||
|
|
||||||
return revision;
|
return revision;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import server from "./server.js";
|
|||||||
import libraryLoader from "./library_loader.js";
|
import libraryLoader from "./library_loader.js";
|
||||||
import ws from "./ws.js";
|
import ws from "./ws.js";
|
||||||
import froca from "./froca.js";
|
import froca from "./froca.js";
|
||||||
|
import linkService from "./link.js";
|
||||||
|
|
||||||
function setupGlobs() {
|
function setupGlobs() {
|
||||||
window.glob.PROFILING_LOG = false;
|
window.glob.PROFILING_LOG = false;
|
||||||
@ -13,6 +14,8 @@ function setupGlobs() {
|
|||||||
|
|
||||||
window.glob.getComponentByEl = el => appContext.getComponentByEl(el);
|
window.glob.getComponentByEl = el => appContext.getComponentByEl(el);
|
||||||
window.glob.getHeaders = server.getHeaders;
|
window.glob.getHeaders = server.getHeaders;
|
||||||
|
window.glob.getReferenceLinkTitle = href => linkService.getReferenceLinkTitle(href);
|
||||||
|
window.glob.getReferenceLinkTitleSync = href => linkService.getReferenceLinkTitleSync(href);
|
||||||
|
|
||||||
// required for ESLint plugin and CKEditor
|
// required for ESLint plugin and CKEditor
|
||||||
window.glob.getActiveContextNote = () => appContext.tabManager.getActiveContextNote();
|
window.glob.getActiveContextNote = () => appContext.tabManager.getActiveContextNote();
|
||||||
|
@ -454,8 +454,8 @@ export default class AttributeEditorWidget extends NoteContextAwareWidget {
|
|||||||
return clickIndex;
|
return clickIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
async loadReferenceLinkTitle($el) {
|
async loadReferenceLinkTitle($el, href) {
|
||||||
const {noteId} = linkService.parseNavigationStateFromUrl($el.find("a").attr("href"));
|
const {noteId} = linkService.parseNavigationStateFromUrl(href);
|
||||||
const note = await froca.getNote(noteId, true);
|
const note = await froca.getNote(noteId, true);
|
||||||
|
|
||||||
const title = note ? note.title : '[missing]';
|
const title = note ? note.title : '[missing]';
|
||||||
@ -468,7 +468,7 @@ export default class AttributeEditorWidget extends NoteContextAwareWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async renderOwnedAttributes(ownedAttributes, saved) {
|
async renderOwnedAttributes(ownedAttributes, saved) {
|
||||||
// attrs are not resorted if position changes after initial load
|
// attrs are not resorted if position changes after the initial load
|
||||||
ownedAttributes.sort((a, b) => a.position < b.position ? -1 : 1);
|
ownedAttributes.sort((a, b) => a.position < b.position ? -1 : 1);
|
||||||
|
|
||||||
let htmlAttrs = (await attributeRenderer.renderAttributes(ownedAttributes, true)).html();
|
let htmlAttrs = (await attributeRenderer.renderAttributes(ownedAttributes, true)).html();
|
||||||
|
@ -101,14 +101,6 @@ export default class AbstractTextTypeWidget extends TypeWidget {
|
|||||||
await linkService.loadReferenceLinkTitle($el, href);
|
await linkService.loadReferenceLinkTitle($el, href);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getReferenceLinkTitle(href) {
|
|
||||||
return await linkService.getReferenceLinkTitle(href);
|
|
||||||
}
|
|
||||||
|
|
||||||
getReferenceLinkTitleSync(href) {
|
|
||||||
return linkService.getReferenceLinkTitleSync(href);
|
|
||||||
}
|
|
||||||
|
|
||||||
refreshIncludedNote($container, noteId) {
|
refreshIncludedNote($container, noteId) {
|
||||||
if ($container) {
|
if ($container) {
|
||||||
$container.find(`section[data-note-id="${noteId}"]`).each((_, el) => {
|
$container.find(`section[data-note-id="${noteId}"]`).each((_, el) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user