fix note type selection

This commit is contained in:
zadam 2019-09-06 22:18:03 +02:00
parent 0226b1e9a8
commit 50a0400616
2 changed files with 15 additions and 9 deletions

View file

@ -203,16 +203,18 @@ export default class LinkMap {
this.renderer.stop(); this.renderer.stop();
} }
// delete all endpoints and connections if (this.jsPlumbInstance) {
// this is done at this point (after async operations) to reduce flicker to the minimum // delete all endpoints and connections
this.jsPlumbInstance.deleteEveryEndpoint(); // this is done at this point (after async operations) to reduce flicker to the minimum
this.jsPlumbInstance.deleteEveryEndpoint();
// without this we still end up with note boxes remaining in the canvas // without this we still end up with note boxes remaining in the canvas
this.$linkMapContainer.empty(); this.$linkMapContainer.empty();
// reset zoom/pan // reset zoom/pan
this.pzInstance.zoomAbs(0, 0, this.options.zoom); this.pzInstance.zoomAbs(0, 0, this.options.zoom);
this.pzInstance.moveTo(0, 0); this.pzInstance.moveTo(0, 0);
}
} }
initJsPlumbInstance() { initJsPlumbInstance() {

View file

@ -73,7 +73,11 @@ export default class NoteTypeContext {
.attr("data-mime-type", mimeType.mime) .attr("data-mime-type", mimeType.mime)
.append('<span class="check">&check;</span> ') .append('<span class="check">&check;</span> ')
.append($('<span>').text(mimeType.title)) .append($('<span>').text(mimeType.title))
.click(e => this.save('code', $(e.target).attr('data-mime-type'))); .click(e => {
const $link = $(e.target).closest('.dropdown-item');
this.save('code', $link.attr('data-mime-type'))
});
if (this.ctx.note.type === 'code' && this.ctx.note.mime === mimeType.mime) { if (this.ctx.note.type === 'code' && this.ctx.note.mime === mimeType.mime) {
$mimeLink.addClass("selected"); $mimeLink.addClass("selected");