| 
									
										
										
										
											2020-01-20 22:35:52 +01:00
										 |  |  | import Component from "../widgets/component.js"; | 
					
						
							| 
									
										
										
										
											2020-02-17 22:14:39 +01:00
										 |  |  | import appContext from "./app_context.js"; | 
					
						
							| 
									
										
										
										
											2020-05-08 23:39:46 +02:00
										 |  |  | import dateNoteService from "../services/date_notes.js"; | 
					
						
							| 
									
										
										
										
											2020-12-05 23:00:28 +01:00
										 |  |  | import treeService from "../services/tree.js"; | 
					
						
							| 
									
										
										
										
											2021-04-24 22:18:25 +02:00
										 |  |  | import openService from "./open.js"; | 
					
						
							| 
									
										
										
										
											2021-05-18 22:14:35 +02:00
										 |  |  | import protectedSessionService from "./protected_session.js"; | 
					
						
							| 
									
										
										
										
											2021-10-12 19:29:42 +02:00
										 |  |  | import options from "./options.js"; | 
					
						
							| 
									
										
										
										
											2020-01-20 22:35:52 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-24 22:18:25 +02:00
										 |  |  | export default class RootCommandExecutor extends Component { | 
					
						
							| 
									
										
										
										
											2020-02-15 10:41:21 +01:00
										 |  |  |     jumpToNoteCommand() { | 
					
						
							| 
									
										
										
										
											2020-01-20 22:35:52 +01:00
										 |  |  |         import("../dialogs/jump_to_note.js").then(d => d.showDialog()); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-15 10:41:21 +01:00
										 |  |  |     showRecentChangesCommand() { | 
					
						
							| 
									
										
										
										
											2020-01-20 22:35:52 +01:00
										 |  |  |         import("../dialogs/recent_changes.js").then(d => d.showDialog()); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-15 10:41:21 +01:00
										 |  |  |     showNoteRevisionsCommand() { | 
					
						
							| 
									
										
										
										
											2020-01-20 22:35:52 +01:00
										 |  |  |         import("../dialogs/note_revisions.js").then(d => d.showCurrentNoteRevisions()); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-15 10:41:21 +01:00
										 |  |  |     showNoteSourceCommand() { | 
					
						
							| 
									
										
										
										
											2020-01-20 22:35:52 +01:00
										 |  |  |         import("../dialogs/note_source.js").then(d => d.showDialog()); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-15 10:41:21 +01:00
										 |  |  |     pasteMarkdownIntoTextCommand() { | 
					
						
							| 
									
										
										
										
											2020-01-20 22:35:52 +01:00
										 |  |  |         import("../dialogs/markdown_import.js").then(d => d.importMarkdownInline()); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-15 10:41:21 +01:00
										 |  |  |     async editBranchPrefixCommand() { | 
					
						
							| 
									
										
										
										
											2021-05-22 12:35:41 +02:00
										 |  |  |         const notePath = appContext.tabManager.getActiveContextNotePath(); | 
					
						
							| 
									
										
										
										
											2020-01-20 22:35:52 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-14 21:21:47 +01:00
										 |  |  |         if (notePath) { | 
					
						
							|  |  |  |             const editBranchPrefixDialog = await import("../dialogs/branch_prefix.js"); | 
					
						
							|  |  |  |             editBranchPrefixDialog.showDialog(notePath); | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2020-01-20 22:35:52 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-24 20:27:04 +02:00
										 |  |  |     editReadOnlyNoteCommand() { | 
					
						
							|  |  |  |         const noteContext = appContext.tabManager.getActiveContext(); | 
					
						
							|  |  |  |         noteContext.readOnlyTemporarilyDisabled = true; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         appContext.triggerEvent("readOnlyTemporarilyDisabled", { noteContext }); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-15 18:41:32 +01:00
										 |  |  |     async cloneNoteIdsToCommand({noteIds}) { | 
					
						
							|  |  |  |         const d = await import("../dialogs/clone_to.js"); | 
					
						
							|  |  |  |         d.showDialog(noteIds); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-15 10:41:21 +01:00
										 |  |  |     async moveBranchIdsToCommand({branchIds}) { | 
					
						
							|  |  |  |         const d = await import("../dialogs/move_to.js"); | 
					
						
							|  |  |  |         d.showDialog(branchIds); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2020-02-16 19:54:11 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     showOptionsCommand() { | 
					
						
							| 
									
										
										
										
											2020-05-08 23:39:46 +02:00
										 |  |  |         import("../dialogs/options.js").then(d => d.showDialog()); | 
					
						
							| 
									
										
										
										
											2020-02-16 19:54:11 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     showHelpCommand() { | 
					
						
							| 
									
										
										
										
											2020-05-08 23:39:46 +02:00
										 |  |  |         import("../dialogs/help.js").then(d => d.showDialog()); | 
					
						
							| 
									
										
										
										
											2020-02-16 19:54:11 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-08 23:39:46 +02:00
										 |  |  |     async showSQLConsoleCommand() { | 
					
						
							|  |  |  |         const sqlConsoleNote = await dateNoteService.createSqlConsole(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-22 12:35:41 +02:00
										 |  |  |         const noteContext = await appContext.tabManager.openContextWithNote(sqlConsoleNote.noteId, true); | 
					
						
							| 
									
										
										
										
											2020-05-08 23:39:46 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-22 12:26:45 +02:00
										 |  |  |         appContext.triggerEvent('focusOnDetail', {ntxId: noteContext.ntxId}); | 
					
						
							| 
									
										
										
										
											2020-02-16 19:54:11 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-18 22:52:07 +01:00
										 |  |  |     async searchNotesCommand({searchString, ancestorNoteId}) { | 
					
						
							|  |  |  |         const searchNote = await dateNoteService.createSearchNote({searchString, ancestorNoteId}); | 
					
						
							| 
									
										
										
										
											2020-10-25 23:02:12 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-22 12:35:41 +02:00
										 |  |  |         const noteContext = await appContext.tabManager.openContextWithNote(searchNote.noteId, true); | 
					
						
							| 
									
										
										
										
											2020-10-25 23:02:12 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-22 12:26:45 +02:00
										 |  |  |         appContext.triggerCommand('focusOnSearchDefinition', {ntxId: noteContext.ntxId}); | 
					
						
							| 
									
										
										
										
											2020-10-25 23:02:12 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-05 23:00:28 +01:00
										 |  |  |     async searchInSubtreeCommand({notePath}) { | 
					
						
							|  |  |  |         const noteId = treeService.getNoteIdFromNotePath(notePath); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-18 22:52:07 +01:00
										 |  |  |         this.searchNotesCommand({ancestorNoteId: noteId}); | 
					
						
							| 
									
										
										
										
											2020-12-05 23:00:28 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-16 19:54:11 +01:00
										 |  |  |     showBackendLogCommand() { | 
					
						
							| 
									
										
										
										
											2020-05-08 23:39:46 +02:00
										 |  |  |         import("../dialogs/backend_log.js").then(d => d.showDialog()); | 
					
						
							| 
									
										
										
										
											2020-02-16 19:54:11 +01:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2021-04-24 22:18:25 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     openNoteExternallyCommand() { | 
					
						
							| 
									
										
										
										
											2021-05-22 12:35:41 +02:00
										 |  |  |         const noteId = appContext.tabManager.getActiveContextNoteId(); | 
					
						
							| 
									
										
										
										
											2021-04-24 22:18:25 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |         if (noteId) { | 
					
						
							|  |  |  |             openService.openNoteExternally(noteId); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2021-05-18 22:14:35 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     enterProtectedSessionCommand() { | 
					
						
							|  |  |  |         protectedSessionService.enterProtectedSession(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     leaveProtectedSessionCommand() { | 
					
						
							|  |  |  |         protectedSessionService.leaveProtectedSession(); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2021-10-12 19:29:42 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     hideLeftPaneCommand() { | 
					
						
							|  |  |  |         options.save(`leftPaneVisible`, "false"); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     showLeftPaneCommand() { | 
					
						
							|  |  |  |         options.save(`leftPaneVisible`, "true"); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     toggleLeftPaneCommand() { | 
					
						
							|  |  |  |         options.toggle('leftPaneVisible'); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2020-07-04 10:18:01 +02:00
										 |  |  | } |