mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 05:28:59 +01:00 
			
		
		
		
	fixes to link parsing and tweaks
This commit is contained in:
		
							parent
							
								
									10d089240a
								
							
						
					
					
						commit
						1c0b55e422
					
				@ -65,7 +65,7 @@ export default class LinkMap {
 | 
				
			|||||||
            graph,
 | 
					            graph,
 | 
				
			||||||
            // param explanation here: https://github.com/dhotson/springy/issues/58
 | 
					            // param explanation here: https://github.com/dhotson/springy/issues/58
 | 
				
			||||||
            400.0, // Spring stiffness
 | 
					            400.0, // Spring stiffness
 | 
				
			||||||
            400.0, // Node repulsion
 | 
					            200.0, // Node repulsion
 | 
				
			||||||
            0.15 // Damping
 | 
					            0.15 // Damping
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -79,6 +79,10 @@ export default class LinkMap {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            const note = notes.find(n => n.noteId === noteId);
 | 
					            const note = notes.find(n => n.noteId === noteId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (!note) {
 | 
				
			||||||
 | 
					                return null;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            const $noteBox = $("<div>")
 | 
					            const $noteBox = $("<div>")
 | 
				
			||||||
                .addClass("note-box")
 | 
					                .addClass("note-box")
 | 
				
			||||||
                .prop("id", noteBoxId);
 | 
					                .prop("id", noteBoxId);
 | 
				
			||||||
 | 
				
			|||||||
@ -43,6 +43,16 @@ class LinkMapWidget extends StandardWidget {
 | 
				
			|||||||
            this.linkMapService.cleanup();
 | 
					            this.linkMapService.cleanup();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    syncDataReceived(syncData) {
 | 
				
			||||||
 | 
					        if (syncData.find(sd => sd.entityName === 'attributes' && sd.noteId === this.ctx.note.noteId)) {
 | 
				
			||||||
 | 
					            // no need to invalidate attributes since the Attribute class listens to this as well
 | 
				
			||||||
 | 
					            // (and is guaranteed to run first)
 | 
				
			||||||
 | 
					            if (this.linkMapService) {
 | 
				
			||||||
 | 
					                this.linkMapService.loadNotesAndRelations();
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default LinkMapWidget;
 | 
					export default LinkMapWidget;
 | 
				
			||||||
@ -9,6 +9,16 @@ const TPL = `
 | 
				
			|||||||
class NoteRevisionsWidget extends StandardWidget {
 | 
					class NoteRevisionsWidget extends StandardWidget {
 | 
				
			||||||
    getWidgetTitle() { return "Note revisions"; }
 | 
					    getWidgetTitle() { return "Note revisions"; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    getHeaderActions() {
 | 
				
			||||||
 | 
					        const $showFullButton = $("<a>").append("show dialog").addClass('widget-header-action');
 | 
				
			||||||
 | 
					        $showFullButton.click(async () => {
 | 
				
			||||||
 | 
					            const attributesDialog = await import("../dialogs/note_revisions.js");
 | 
				
			||||||
 | 
					            attributesDialog.showDialog();
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return [$showFullButton];
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    async doRenderBody() {
 | 
					    async doRenderBody() {
 | 
				
			||||||
        const revisionItems = await server.get(`notes/${this.ctx.note.noteId}/revisions`);
 | 
					        const revisionItems = await server.get(`notes/${this.ctx.note.noteId}/revisions`);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -214,7 +214,7 @@ function findImageLinks(content, foundLinks) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    while (match = re.exec(content)) {
 | 
					    while (match = re.exec(content)) {
 | 
				
			||||||
        foundLinks.push({
 | 
					        foundLinks.push({
 | 
				
			||||||
            type: 'image-link',
 | 
					            name: 'image-link',
 | 
				
			||||||
            value: match[1]
 | 
					            value: match[1]
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -244,7 +244,7 @@ function findRelationMapLinks(content, foundLinks) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    for (const note of obj.notes) {
 | 
					    for (const note of obj.notes) {
 | 
				
			||||||
        foundLinks.push({
 | 
					        foundLinks.push({
 | 
				
			||||||
            type: 'relation-map-link',
 | 
					            name: 'relation-map-link',
 | 
				
			||||||
            value: note.noteId
 | 
					            value: note.noteId
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user