mirror of
https://github.com/zadam/trilium.git
synced 2025-01-14 19:19:28 +08:00
make file attachments accessible in revisions dialog
This commit is contained in:
parent
ac9a4b3afc
commit
a748710b01
3 changed files with 7 additions and 3 deletions
|
@ -1594,7 +1594,11 @@ class BNote extends AbstractBeccaEntity {
|
|||
revisionAttachment.setContent(noteAttachment.getContent(), {forceSave: true});
|
||||
|
||||
// content is rewritten to point to the revision attachments
|
||||
noteContent = noteContent.replaceAll(`attachments/${noteAttachment.attachmentId}`, `attachments/${revisionAttachment.attachmentId}`);
|
||||
noteContent = noteContent.replaceAll(`attachments/${noteAttachment.attachmentId}`,
|
||||
`attachments/${revisionAttachment.attachmentId}`);
|
||||
|
||||
noteContent = noteContent.replaceAll(new RegExp(`href="[^"]*attachmentId=${noteAttachment.attachmentId}[^"]*"`, 'gi'),
|
||||
`href="api/attachments/${revisionAttachment.attachmentId}/download"`);
|
||||
}
|
||||
|
||||
revision.setContent(noteContent, {forceSave: true});
|
||||
|
|
|
@ -328,7 +328,7 @@ class Froca {
|
|||
}
|
||||
catch (e) {
|
||||
if (silentNotFoundError) {
|
||||
logInfo(`Attachment '${attachmentId} not found, but silentNotFoundError is enabled: ` + e.message);
|
||||
logInfo(`Attachment '${attachmentId}' not found, but silentNotFoundError is enabled: ` + e.message);
|
||||
return null;
|
||||
} else {
|
||||
throw e;
|
||||
|
|
|
@ -228,7 +228,7 @@ function goToLink(evt) {
|
|||
|| (withinEditLink && (leftClick || middleClick))
|
||||
|| (outsideOfCKEditor && (leftClick || middleClick))
|
||||
) {
|
||||
if (hrefLink.toLowerCase().startsWith('http')) {
|
||||
if (hrefLink.toLowerCase().startsWith('http') || hrefLink.startsWith("api/")) {
|
||||
window.open(hrefLink, '_blank');
|
||||
}
|
||||
else if (hrefLink.toLowerCase().startsWith('file:') && utils.isElectron()) {
|
||||
|
|
Loading…
Reference in a new issue