mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	added dialog and read only view of attributes
This commit is contained in:
		
							
								
								
									
										45
									
								
								public/javascripts/dialogs/attributes.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								public/javascripts/dialogs/attributes.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,45 @@ | ||||
| "use strict"; | ||||
|  | ||||
| const attributesDialog = (function() { | ||||
|     const dialogEl = $("#attributes-dialog"); | ||||
|  | ||||
|     function AttributesModel(attributes) { | ||||
|         const model = this; | ||||
|  | ||||
|         this.attributes = ko.observableArray(attributes); | ||||
|  | ||||
|         this.addNewRow = function() { | ||||
|             model.attributes.push({ | ||||
|                 attribute_id: '', | ||||
|                 name: '', | ||||
|                 value: '' | ||||
|             }); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     async function showDialog() { | ||||
|         glob.activeDialog = dialogEl; | ||||
|  | ||||
|         dialogEl.dialog({ | ||||
|             modal: true, | ||||
|             width: 800, | ||||
|             height: 700 | ||||
|         }); | ||||
|  | ||||
|         const noteId = noteEditor.getCurrentNoteId(); | ||||
|  | ||||
|         const attributes = await server.get('notes/' + noteId + '/attributes'); | ||||
|  | ||||
|         ko.applyBindings(new AttributesModel(attributes)); | ||||
|     } | ||||
|  | ||||
|     $(document).bind('keydown', 'alt+a', e => { | ||||
|         showDialog(); | ||||
|  | ||||
|         e.preventDefault(); | ||||
|     }); | ||||
|  | ||||
|     return { | ||||
|         showDialog | ||||
|     }; | ||||
| })(); | ||||
		Reference in New Issue
	
	Block a user