fixes to link parsing and tweaks

This commit is contained in:
zadam 2019-08-29 23:08:30 +02:00
parent 10d089240a
commit 1c0b55e422
4 changed files with 27 additions and 3 deletions

View File

@ -65,7 +65,7 @@ export default class LinkMap {
graph,
// param explanation here: https://github.com/dhotson/springy/issues/58
400.0, // Spring stiffness
400.0, // Node repulsion
200.0, // Node repulsion
0.15 // Damping
);
@ -79,6 +79,10 @@ export default class LinkMap {
const note = notes.find(n => n.noteId === noteId);
if (!note) {
return null;
}
const $noteBox = $("<div>")
.addClass("note-box")
.prop("id", noteBoxId);

View File

@ -43,6 +43,16 @@ class LinkMapWidget extends StandardWidget {
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;

View File

@ -9,6 +9,16 @@ const TPL = `
class NoteRevisionsWidget extends StandardWidget {
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() {
const revisionItems = await server.get(`notes/${this.ctx.note.noteId}/revisions`);

View File

@ -214,7 +214,7 @@ function findImageLinks(content, foundLinks) {
while (match = re.exec(content)) {
foundLinks.push({
type: 'image-link',
name: 'image-link',
value: match[1]
});
}
@ -244,7 +244,7 @@ function findRelationMapLinks(content, foundLinks) {
for (const note of obj.notes) {
foundLinks.push({
type: 'relation-map-link',
name: 'relation-map-link',
value: note.noteId
})
}