mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	make file attachments accessible in revisions dialog
This commit is contained in:
		| @@ -1594,7 +1594,11 @@ class BNote extends AbstractBeccaEntity { | |||||||
|                     revisionAttachment.setContent(noteAttachment.getContent(), {forceSave: true}); |                     revisionAttachment.setContent(noteAttachment.getContent(), {forceSave: true}); | ||||||
|  |  | ||||||
|                     // content is rewritten to point to the revision attachments |                     // 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}); |                 revision.setContent(noteContent, {forceSave: true}); | ||||||
|   | |||||||
| @@ -328,7 +328,7 @@ class Froca { | |||||||
|         } |         } | ||||||
|         catch (e) { |         catch (e) { | ||||||
|             if (silentNotFoundError) { |             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; |                 return null; | ||||||
|             } else { |             } else { | ||||||
|                 throw e; |                 throw e; | ||||||
|   | |||||||
| @@ -228,7 +228,7 @@ function goToLink(evt) { | |||||||
|             || (withinEditLink && (leftClick || middleClick)) |             || (withinEditLink && (leftClick || middleClick)) | ||||||
|             || (outsideOfCKEditor && (leftClick || middleClick)) |             || (outsideOfCKEditor && (leftClick || middleClick)) | ||||||
|         ) { |         ) { | ||||||
|             if (hrefLink.toLowerCase().startsWith('http')) { |             if (hrefLink.toLowerCase().startsWith('http') || hrefLink.startsWith("api/")) { | ||||||
|                 window.open(hrefLink, '_blank'); |                 window.open(hrefLink, '_blank'); | ||||||
|             } |             } | ||||||
|             else if (hrefLink.toLowerCase().startsWith('file:') && utils.isElectron()) { |             else if (hrefLink.toLowerCase().startsWith('file:') && utils.isElectron()) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user