mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 18:36:30 +01:00 
			
		
		
		
	small fixes and tweaks
This commit is contained in:
		| @@ -483,21 +483,6 @@ export default class AttributeEditorWidget extends NoteContextAwareWidget { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     async focusOnAttributesEvent({ntxId}) { |  | ||||||
|         if (this.noteContext.ntxId === ntxId) { |  | ||||||
|             if (this.$editor.is(":visible")) { |  | ||||||
|                 this.$editor.trigger('focus'); |  | ||||||
|  |  | ||||||
|                 this.textEditor.model.change(writer => { // put focus to the end of the content |  | ||||||
|                     writer.setSelection(writer.createPositionAt(this.textEditor.model.document.getRoot(), 'end')); |  | ||||||
|                 }); |  | ||||||
|             } |  | ||||||
|             else { |  | ||||||
|                 this.triggerEvent('focusOnDetail', {ntxId: this.noteContext.ntxId}); |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     async createNoteForReferenceLink(title) { |     async createNoteForReferenceLink(title) { | ||||||
|         const {note} = await noteCreateService.createNote(this.notePath, { |         const {note} = await noteCreateService.createNote(this.notePath, { | ||||||
|             activate: false, |             activate: false, | ||||||
|   | |||||||
| @@ -21,13 +21,13 @@ const TPL = `<div class="note-map-widget" style="position: relative;"> | |||||||
|         } |         } | ||||||
|          |          | ||||||
|         .map-type-switcher .bx { |         .map-type-switcher .bx { | ||||||
|             font-size: x-large; |             font-size: 120%; | ||||||
|         } |         } | ||||||
|     </style> |     </style> | ||||||
|      |      | ||||||
|     <div class="btn-group btn-group-sm map-type-switcher" role="group"> |     <div class="btn-group btn-group-sm map-type-switcher floating-button" role="group"> | ||||||
|       <button type="button" class="btn btn-secondary" title="Link Map" data-type="link"><span class="bx bx-network-chart"></span></button> |       <button type="button" class="btn icon-button bx bx-network-chart" title="Link Map" data-type="link"></button> | ||||||
|       <button type="button" class="btn btn-secondary" title="Tree map" data-type="tree"><span class="bx bx-sitemap"></span></button> |       <button type="button" class="btn icon-button bx bx-sitemap" title="Tree map" data-type="tree"></button> | ||||||
|     </div> |     </div> | ||||||
|  |  | ||||||
|     <div class="style-resolver"></div> |     <div class="style-resolver"></div> | ||||||
| @@ -102,7 +102,7 @@ export default class NoteMapWidget extends NoteContextAwareWidget { | |||||||
|             }) |             }) | ||||||
|             .nodeLabel(node => node.name) |             .nodeLabel(node => node.name) | ||||||
|             .maxZoom(7) |             .maxZoom(7) | ||||||
|             .warmupTicks(10) |             .warmupTicks(30) | ||||||
|             .linkDirectionalArrowLength(5) |             .linkDirectionalArrowLength(5) | ||||||
|             .linkDirectionalArrowRelPos(1) |             .linkDirectionalArrowRelPos(1) | ||||||
|             .linkWidth(1) |             .linkWidth(1) | ||||||
| @@ -122,8 +122,8 @@ export default class NoteMapWidget extends NoteContextAwareWidget { | |||||||
|         const nodeLinkRatio = data.nodes.length / data.links.length; |         const nodeLinkRatio = data.nodes.length / data.links.length; | ||||||
|  |  | ||||||
|         this.graph.d3Force('link').distance(40); |         this.graph.d3Force('link').distance(40); | ||||||
|         this.graph.d3Force('center').strength(0.01); |         this.graph.d3Force('center').strength(0.2); | ||||||
|         this.graph.d3Force('charge').strength(-20 / nodeLinkRatio); |         this.graph.d3Force('charge').strength(-20 / Math.pow(nodeLinkRatio, 1.5)); | ||||||
|         this.graph.d3Force('charge').distanceMax(1000); |         this.graph.d3Force('charge').distanceMax(1000); | ||||||
|  |  | ||||||
|         this.renderData(data); |         this.renderData(data); | ||||||
|   | |||||||
| @@ -61,7 +61,7 @@ export default class NoteTitleWidget extends NoteContextAwareWidget { | |||||||
|         }); |         }); | ||||||
|  |  | ||||||
|         utils.bindElShortcut(this.$noteTitle, 'return', () => { |         utils.bindElShortcut(this.$noteTitle, 'return', () => { | ||||||
|             this.triggerCommand('focusOnAttributes', {ntxId: this.noteContext.ntxId}); |             this.triggerCommand('focusOnDetail', {ntxId: this.noteContext.ntxId}); | ||||||
|         }); |         }); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -55,6 +55,9 @@ export default class TypeWidget extends NoteContextAwareWidget { | |||||||
|             // won't trigger .refresh(); |             // won't trigger .refresh(); | ||||||
|             return super.handleEventInChildren('setNoteContext', data); |             return super.handleEventInChildren('setNoteContext', data); | ||||||
|         } |         } | ||||||
|  |         else if (name === 'entitiesReloaded') { | ||||||
|  |             return super.handleEventInChildren(name, data); | ||||||
|  |         } | ||||||
|         else { |         else { | ||||||
|             return Promise.resolve(); |             return Promise.resolve(); | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -70,10 +70,13 @@ function getLinkMap(req) { | |||||||
|  |  | ||||||
| function getTreeMap(req) { | function getTreeMap(req) { | ||||||
|     const mapRootNote = becca.getNote(req.params.noteId); |     const mapRootNote = becca.getNote(req.params.noteId); | ||||||
|  |     // if the map root itself has ignore (journal typically) then there wouldn't be anything to display so | ||||||
|  |     // we'll just ignore it | ||||||
|  |     const ignoreExcludeFromTreeMap = mapRootNote.hasLabel('excludeFromTreeMap'); | ||||||
|     const noteIds = new Set(); |     const noteIds = new Set(); | ||||||
|  |  | ||||||
|     const notes = mapRootNote.getSubtreeNotes(false) |     const notes = mapRootNote.getSubtreeNotes(false) | ||||||
|         .filter(note => !note.hasLabel('excludeFromTreeMap')) |         .filter(note => ignoreExcludeFromTreeMap || !note.hasLabel('excludeFromTreeMap')) | ||||||
|         .filter(note => { |         .filter(note => { | ||||||
|             if (note.type !== 'image' || note.getChildNotes().length > 0) { |             if (note.type !== 'image' || note.getChildNotes().length > 0) { | ||||||
|                 return true; |                 return true; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user