mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	added readOnly attribute which puts text editor into readonly mode #371
This commit is contained in:
		| @@ -1,6 +1,7 @@ | ||||
| import libraryLoader from "./library_loader.js"; | ||||
| import noteDetailService from './note_detail.js'; | ||||
| import treeService from './tree.js'; | ||||
| import attributeService from "./attributes.js"; | ||||
|  | ||||
| const $component = $('#note-detail-text'); | ||||
|  | ||||
| @@ -19,6 +20,8 @@ async function show() { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     textEditor.isReadOnly = await isReadOnly(); | ||||
|  | ||||
|     textEditor.setData(noteDetailService.getCurrentNote().content); | ||||
|  | ||||
|     $component.show(); | ||||
| @@ -36,6 +39,12 @@ function getContent() { | ||||
|     return content; | ||||
| } | ||||
|  | ||||
| async function isReadOnly() { | ||||
|     const attributes = await attributeService.getAttributes(); | ||||
|  | ||||
|     return attributes.some(attr => attr.type === 'label' && attr.name === 'readOnly'); | ||||
| } | ||||
|  | ||||
| function focus() { | ||||
|     $component.focus(); | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user