mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 18:36:30 +01:00 
			
		
		
		
	moved all sources to src directory
This commit is contained in:
		
							
								
								
									
										45
									
								
								src/public/javascripts/dialogs/edit_tree_prefix.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								src/public/javascripts/dialogs/edit_tree_prefix.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,45 @@ | ||||
| "use strict"; | ||||
|  | ||||
| const editTreePrefix = (function() { | ||||
|     const dialogEl = $("#edit-tree-prefix-dialog"); | ||||
|     const formEl = $("#edit-tree-prefix-form"); | ||||
|     const treePrefixInputEl = $("#tree-prefix-input"); | ||||
|     const noteTitleEl = $('#tree-prefix-note-title'); | ||||
|  | ||||
|     let noteTreeId; | ||||
|  | ||||
|     async function showDialog() { | ||||
|         glob.activeDialog = dialogEl; | ||||
|  | ||||
|         await dialogEl.dialog({ | ||||
|             modal: true, | ||||
|             width: 500 | ||||
|         }); | ||||
|  | ||||
|         const currentNode = noteTree.getCurrentNode(); | ||||
|  | ||||
|         noteTreeId = currentNode.data.noteTreeId; | ||||
|  | ||||
|         treePrefixInputEl.val(currentNode.data.prefix).focus(); | ||||
|  | ||||
|         const noteTitle = noteTree.getNoteTitle(currentNode.data.noteId); | ||||
|  | ||||
|         noteTitleEl.html(noteTitle); | ||||
|     } | ||||
|  | ||||
|     formEl.submit(() => { | ||||
|         const prefix = treePrefixInputEl.val(); | ||||
|  | ||||
|         server.put('tree/' + noteTreeId + '/set-prefix', { | ||||
|             prefix: prefix | ||||
|         }).then(() => noteTree.setPrefix(noteTreeId, prefix)); | ||||
|  | ||||
|         dialogEl.dialog("close"); | ||||
|  | ||||
|         return false; | ||||
|     }); | ||||
|  | ||||
|     return { | ||||
|         showDialog | ||||
|     }; | ||||
| })(); | ||||
		Reference in New Issue
	
	Block a user