mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 18:36:30 +01:00 
			
		
		
		
	Doubleclick on the image will take you to that image note, closes #236
This commit is contained in:
		| @@ -1,5 +1,6 @@ | |||||||
| import libraryLoader from "./library_loader.js"; | import libraryLoader from "./library_loader.js"; | ||||||
| import noteDetailService from './note_detail.js'; | import noteDetailService from './note_detail.js'; | ||||||
|  | import treeService from './tree.js'; | ||||||
|  |  | ||||||
| const $component = $('#note-detail-text'); | const $component = $('#note-detail-text'); | ||||||
|  |  | ||||||
| @@ -47,6 +48,22 @@ function onNoteChange(func) { | |||||||
|     textEditor.model.document.on('change:data', func); |     textEditor.model.document.on('change:data', func); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | $component.on("dblclick", "img", e => { | ||||||
|  |     const $img = $(e.target); | ||||||
|  |     const src = $img.prop("src"); | ||||||
|  |  | ||||||
|  |     const match = src.match(/\/api\/images\/([A-Za-z0-9]+)\//); | ||||||
|  |  | ||||||
|  |     if (match) { | ||||||
|  |         const noteId = match[1]; | ||||||
|  |  | ||||||
|  |         treeService.activateNote(noteId); | ||||||
|  |     } | ||||||
|  |     else { | ||||||
|  |         window.open(src, '_blank'); | ||||||
|  |     } | ||||||
|  | }); | ||||||
|  |  | ||||||
| export default { | export default { | ||||||
|     show, |     show, | ||||||
|     getEditor, |     getEditor, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user