mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01:00 
			
		
		
		
	fix inserting current timestamp into editor
This commit is contained in:
		| @@ -149,7 +149,7 @@ function AttributesModel() { | |||||||
|                 attr.value = attr.labelValue; |                 attr.value = attr.labelValue; | ||||||
|             } |             } | ||||||
|             else if (attr.type === 'relation') { |             else if (attr.type === 'relation') { | ||||||
|                 attr.value = treeUtils.getNoteIdFromNotePath(linkService.getNotePathFromLabel(attr.relationValue)); |                 attr.value = treeUtils.getNoteIdFromNotePath(linkService.getNotePathFromLabel(attr.relationValue)) || ""; | ||||||
|             } |             } | ||||||
|             else if (attr.type === 'label-definition') { |             else if (attr.type === 'label-definition') { | ||||||
|                 attr.value = attr.labelDefinition; |                 attr.value = attr.labelDefinition; | ||||||
|   | |||||||
| @@ -85,9 +85,11 @@ function addLinkToEditor(linkTitle, linkHref) { | |||||||
|  |  | ||||||
| function addTextToEditor(text) { | function addTextToEditor(text) { | ||||||
|     const editor = noteDetailText.getEditor(); |     const editor = noteDetailText.getEditor(); | ||||||
|     const doc = editor.document; |  | ||||||
|  |  | ||||||
|     doc.enqueueChanges(() => editor.data.insertText(text), doc.selection); |     editor.model.change(writer => { | ||||||
|  |         const insertPosition = editor.model.document.selection.getFirstPosition(); | ||||||
|  |         writer.insertText(text, insertPosition); | ||||||
|  |     }); | ||||||
| } | } | ||||||
|  |  | ||||||
| ko.bindingHandlers.noteLink = { | ko.bindingHandlers.noteLink = { | ||||||
|   | |||||||
| @@ -12,6 +12,10 @@ function getNodeByKey(key) { | |||||||
| } | } | ||||||
|  |  | ||||||
| function getNoteIdFromNotePath(notePath) { | function getNoteIdFromNotePath(notePath) { | ||||||
|  |     if (!notePath) { | ||||||
|  |         return null; | ||||||
|  |     } | ||||||
|  |  | ||||||
|     const path = notePath.split("/"); |     const path = notePath.split("/"); | ||||||
|  |  | ||||||
|     return path[path.length - 1]; |     return path[path.length - 1]; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user