mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 21:11:30 +08:00 
			
		
		
		
	add keyboard shortcut for the edit button, #2036
This commit is contained in:
		
							parent
							
								
									d9ec8bba80
								
							
						
					
					
						commit
						f1a36f6cea
					
				| @ -35,6 +35,13 @@ export default class RootCommandExecutor extends Component { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     editReadOnlyNoteCommand() { | ||||||
|  |         const noteContext = appContext.tabManager.getActiveContext(); | ||||||
|  |         noteContext.readOnlyTemporarilyDisabled = true; | ||||||
|  | 
 | ||||||
|  |         appContext.triggerEvent("readOnlyTemporarilyDisabled", { noteContext }); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     async cloneNoteIdsToCommand({noteIds}) { |     async cloneNoteIdsToCommand({noteIds}) { | ||||||
|         const d = await import("../dialogs/clone_to.js"); |         const d = await import("../dialogs/clone_to.js"); | ||||||
|         d.showDialog(noteIds); |         d.showDialog(noteIds); | ||||||
|  | |||||||
| @ -24,8 +24,6 @@ export default class EditButton extends ButtonWidget { | |||||||
|         // can't do this in isEnabled() since isReadOnly is async
 |         // can't do this in isEnabled() since isReadOnly is async
 | ||||||
|         this.toggleInt(await this.noteContext.isReadOnly()); |         this.toggleInt(await this.noteContext.isReadOnly()); | ||||||
| 
 | 
 | ||||||
|         console.log("await this.noteContext.isReadOnly()", await this.noteContext.isReadOnly()); |  | ||||||
| 
 |  | ||||||
|         await super.refreshWithNote(note); |         await super.refreshWithNote(note); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -41,15 +41,11 @@ export default class TypeWidget extends NoteContextAwareWidget { | |||||||
| 
 | 
 | ||||||
|     focus() {} |     focus() {} | ||||||
| 
 | 
 | ||||||
|     readOnlyTemporarilyDisabledEvent({noteContext}) { |     async readOnlyTemporarilyDisabledEvent({noteContext}) { | ||||||
|         if (this.isNoteContext(noteContext.ntxId)) { |         if (this.isNoteContext(noteContext.ntxId)) { | ||||||
|             this.refresh(); |             await this.refresh(); | ||||||
|         } |  | ||||||
|     } |  | ||||||
| 
 | 
 | ||||||
|     readOnlyTemporarilyDisabledEvent({noteContext}) { |             this.focus(); | ||||||
|         if (this.isNoteContext(noteContext.ntxId)) { |  | ||||||
|             this.refresh(); |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -313,6 +313,12 @@ const DEFAULT_KEYBOARD_ACTIONS = [ | |||||||
|         description: "Opens the dialog to include a note", |         description: "Opens the dialog to include a note", | ||||||
|         scope: "text-detail" |         scope: "text-detail" | ||||||
|     }, |     }, | ||||||
|  |     { | ||||||
|  |         actionName: "editReadOnlyNote", | ||||||
|  |         defaultShortcuts: [], | ||||||
|  |         description: "Edit a read-only note", | ||||||
|  |         scope: "window" | ||||||
|  |     }, | ||||||
| 
 | 
 | ||||||
|     { |     { | ||||||
|         separator: "Attributes (labels & relations)" |         separator: "Attributes (labels & relations)" | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 zadam
						zadam