mirror of
https://github.com/zadam/trilium.git
synced 2025-11-17 02:30:42 +01:00
converted relation map buttons to floating pattern
This commit is contained in:
@@ -29,6 +29,10 @@ const TPL = `
|
||||
</div>`;
|
||||
|
||||
export default class RelationMapButtons extends NoteContextAwareWidget {
|
||||
isEnabled() {
|
||||
return super.isEnabled() && this.note?.type === 'relation-map';
|
||||
}
|
||||
|
||||
doRender() {
|
||||
super.doRender();
|
||||
|
||||
@@ -38,31 +42,10 @@ export default class RelationMapButtons extends NoteContextAwareWidget {
|
||||
this.$zoomOutButton = this.$widget.find(".relation-map-zoom-out");
|
||||
this.$resetPanZoomButton = this.$widget.find(".relation-map-reset-pan-zoom");
|
||||
|
||||
this.$createChildNote.on('click', async () => {
|
||||
const title = await dialogService.prompt({ message: "Enter title of new note", defaultValue: "new note" });
|
||||
this.$createChildNote.on('click', () => this.triggerEvent('relationMapCreateChildNote', {ntxId: this.ntxId}));
|
||||
this.$resetPanZoomButton.on('click', () => this.triggerEvent('relationMapResetPanZoom', {ntxId: this.ntxId}));
|
||||
|
||||
if (!title.trim()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const {note} = await server.post(`notes/${this.noteId}/children?target=into`, {
|
||||
title,
|
||||
content: '',
|
||||
type: 'text'
|
||||
});
|
||||
|
||||
toastService.showMessage("Click on canvas to place new note");
|
||||
|
||||
this.clipboard = { noteId: note.noteId, title };
|
||||
});
|
||||
|
||||
this.$resetPanZoomButton.on('click', () => {
|
||||
// reset to initial pan & zoom state
|
||||
this.pzInstance.zoomTo(0, 0, 1 / this.getZoom());
|
||||
this.pzInstance.moveTo(0, 0);
|
||||
});
|
||||
|
||||
this.$zoomInButton.on('click', () => this.pzInstance.zoomTo(0, 0, 1.2));
|
||||
this.$zoomOutButton.on('click', () => this.pzInstance.zoomTo(0, 0, 0.8));
|
||||
this.$zoomInButton.on('click', () => this.triggerEvent('relationMapResetZoomIn', {ntxId: this.ntxId}));
|
||||
this.$zoomOutButton.on('click', () => this.triggerEvent('relationMapResetZoomOut', {ntxId: this.ntxId}));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user