| 
									
										
										
										
											2018-03-26 22:29:14 -04:00
										 |  |  | import utils from "./utils.js"; | 
					
						
							|  |  |  | import linkService from "./link.js"; | 
					
						
							| 
									
										
										
										
											2018-06-02 13:02:20 -04:00
										 |  |  | import zoomService from "./zoom.js"; | 
					
						
							| 
									
										
										
										
											2018-05-31 20:00:39 -04:00
										 |  |  | import protectedSessionService from "./protected_session.js"; | 
					
						
							| 
									
										
										
										
											2019-08-20 21:40:47 +02:00
										 |  |  | import searchNotesService from "./search_notes.js"; | 
					
						
							| 
									
										
										
										
											2019-11-10 22:19:22 +01:00
										 |  |  | import treeService from "./tree.js"; | 
					
						
							| 
									
										
										
										
											2019-11-21 21:12:07 +01:00
										 |  |  | import dateNoteService from "./date_notes.js"; | 
					
						
							|  |  |  | import noteDetailService from "./note_detail.js"; | 
					
						
							|  |  |  | import keyboardActionService from "./keyboard_actions.js"; | 
					
						
							| 
									
										
										
										
											2019-11-23 23:06:25 +01:00
										 |  |  | import hoistedNoteService from "./hoisted_note.js"; | 
					
						
							|  |  |  | import treeCache from "./tree_cache.js"; | 
					
						
							| 
									
										
										
										
											2019-08-20 21:40:47 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | const NOTE_REVISIONS = "../dialogs/note_revisions.js"; | 
					
						
							|  |  |  | const OPTIONS = "../dialogs/options.js"; | 
					
						
							|  |  |  | const ADD_LINK = "../dialogs/add_link.js"; | 
					
						
							|  |  |  | const JUMP_TO_NOTE = "../dialogs/jump_to_note.js"; | 
					
						
							|  |  |  | const NOTE_SOURCE = "../dialogs/note_source.js"; | 
					
						
							|  |  |  | const RECENT_CHANGES = "../dialogs/recent_changes.js"; | 
					
						
							|  |  |  | const SQL_CONSOLE = "../dialogs/sql_console.js"; | 
					
						
							| 
									
										
										
										
											2019-12-05 21:25:36 +01:00
										 |  |  | const BACKEND_LOG = "../dialogs/backend_log.js"; | 
					
						
							| 
									
										
										
										
											2019-08-20 21:40:47 +02:00
										 |  |  | const ATTRIBUTES = "../dialogs/attributes.js"; | 
					
						
							|  |  |  | const HELP = "../dialogs/help.js"; | 
					
						
							|  |  |  | const NOTE_INFO = "../dialogs/note_info.js"; | 
					
						
							|  |  |  | const ABOUT = "../dialogs/about.js"; | 
					
						
							|  |  |  | const LINK_MAP = "../dialogs/link_map.js"; | 
					
						
							| 
									
										
										
										
											2019-11-10 22:19:22 +01:00
										 |  |  | const CLONE_TO = "../dialogs/clone_to.js"; | 
					
						
							| 
									
										
										
										
											2019-11-11 22:57:51 +01:00
										 |  |  | const MOVE_TO = "../dialogs/move_to.js"; | 
					
						
							| 
									
										
										
										
											2018-03-26 22:29:14 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | function registerEntrypoints() { | 
					
						
							|  |  |  |     // hot keys are active also inside inputs and content editables
 | 
					
						
							|  |  |  |     jQuery.hotkeys.options.filterInputAcceptingElements = false; | 
					
						
							|  |  |  |     jQuery.hotkeys.options.filterContentEditable = false; | 
					
						
							|  |  |  |     jQuery.hotkeys.options.filterTextInputs = false; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-24 10:40:18 +01:00
										 |  |  |     keyboardActionService.setGlobalActionHandler("AddLinkToText", () => import(ADD_LINK).then(d => d.showDialog())); | 
					
						
							| 
									
										
										
										
											2018-03-26 22:29:14 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-19 23:02:54 +01:00
										 |  |  |     const showJumpToNoteDialog = () => import(JUMP_TO_NOTE).then(d => d.showDialog()); | 
					
						
							|  |  |  |     $("#jump-to-note-dialog-button").on('click', showJumpToNoteDialog); | 
					
						
							| 
									
										
										
										
											2019-11-24 10:40:18 +01:00
										 |  |  |     keyboardActionService.setGlobalActionHandler("JumpToNote", showJumpToNoteDialog); | 
					
						
							| 
									
										
										
										
											2018-03-26 22:29:14 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-19 23:02:54 +01:00
										 |  |  |     const showRecentChanges = () => import(RECENT_CHANGES).then(d => d.showDialog()); | 
					
						
							|  |  |  |     $("#recent-changes-button").on('click', showRecentChanges); | 
					
						
							| 
									
										
										
										
											2019-11-24 10:40:18 +01:00
										 |  |  |     keyboardActionService.setGlobalActionHandler("ShowRecentChanges", showRecentChanges); | 
					
						
							| 
									
										
										
										
											2019-05-05 18:24:59 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-09 17:39:48 +01:00
										 |  |  |     $("#enter-protected-session-button").on('click', protectedSessionService.enterProtectedSession); | 
					
						
							|  |  |  |     $("#leave-protected-session-button").on('click', protectedSessionService.leaveProtectedSession); | 
					
						
							| 
									
										
										
										
											2019-05-05 18:24:59 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-09 17:39:48 +01:00
										 |  |  |     $("#toggle-search-button").on('click', searchNotesService.toggleSearch); | 
					
						
							| 
									
										
										
										
											2019-11-24 10:40:18 +01:00
										 |  |  |     keyboardActionService.setGlobalActionHandler('SearchNotes', searchNotesService.toggleSearch); | 
					
						
							| 
									
										
										
										
											2019-05-05 18:24:59 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     const $noteTabContainer = $("#note-tab-container"); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-19 23:02:54 +01:00
										 |  |  |     const showAttributesDialog = () => import(ATTRIBUTES).then(d => d.showDialog()); | 
					
						
							|  |  |  |     $noteTabContainer.on("click", ".show-attributes-button", showAttributesDialog); | 
					
						
							| 
									
										
										
										
											2019-11-24 10:40:18 +01:00
										 |  |  |     keyboardActionService.setGlobalActionHandler("ShowAttributes", showAttributesDialog); | 
					
						
							| 
									
										
										
										
											2019-05-05 18:24:59 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-19 23:02:54 +01:00
										 |  |  |     const showNoteInfoDialog = () => import(NOTE_INFO).then(d => d.showDialog()); | 
					
						
							|  |  |  |     $noteTabContainer.on("click", ".show-note-info-button", showNoteInfoDialog); | 
					
						
							| 
									
										
										
										
											2019-11-24 10:40:18 +01:00
										 |  |  |     keyboardActionService.setGlobalActionHandler("ShowNoteInfo", showNoteInfoDialog); | 
					
						
							| 
									
										
										
										
											2019-11-19 23:02:54 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     const showNoteRevisionsDialog = function() { | 
					
						
							| 
									
										
										
										
											2018-11-19 09:54:33 +01:00
										 |  |  |         if ($(this).hasClass("disabled")) { | 
					
						
							|  |  |  |             return; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2018-03-26 22:29:14 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-02 19:56:52 +02:00
										 |  |  |         import(NOTE_REVISIONS).then(d => d.showCurrentNoteRevisions()); | 
					
						
							| 
									
										
										
										
											2019-11-19 23:02:54 +01:00
										 |  |  |     }; | 
					
						
							| 
									
										
										
										
											2018-11-19 09:54:33 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-19 23:02:54 +01:00
										 |  |  |     $noteTabContainer.on("click", ".show-note-revisions-button", showNoteRevisionsDialog); | 
					
						
							| 
									
										
										
										
											2019-11-24 10:40:18 +01:00
										 |  |  |     keyboardActionService.setGlobalActionHandler("ShowNoteRevisions", showNoteRevisionsDialog); | 
					
						
							| 
									
										
										
										
											2019-11-19 23:02:54 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     const showNoteSourceDialog = function() { | 
					
						
							| 
									
										
										
										
											2018-11-19 09:54:33 +01:00
										 |  |  |         if ($(this).hasClass("disabled")) { | 
					
						
							|  |  |  |             return; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-30 21:22:52 +02:00
										 |  |  |         import(NOTE_SOURCE).then(d => d.showDialog()); | 
					
						
							| 
									
										
										
										
											2019-11-19 23:02:54 +01:00
										 |  |  |     }; | 
					
						
							| 
									
										
										
										
											2018-03-26 22:29:14 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-19 23:02:54 +01:00
										 |  |  |     $noteTabContainer.on("click", ".show-source-button", showNoteSourceDialog); | 
					
						
							| 
									
										
										
										
											2019-11-24 10:40:18 +01:00
										 |  |  |     keyboardActionService.setGlobalActionHandler("ShowNoteSource", showNoteSourceDialog); | 
					
						
							| 
									
										
										
										
											2019-11-19 23:02:54 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     const showLinkMapDialog = () => import(LINK_MAP).then(d => d.showDialog()); | 
					
						
							|  |  |  |     $noteTabContainer.on("click", ".show-link-map-button", showLinkMapDialog); | 
					
						
							| 
									
										
										
										
											2019-11-24 10:40:18 +01:00
										 |  |  |     keyboardActionService.setGlobalActionHandler("ShowLinkMap", showLinkMapDialog); | 
					
						
							| 
									
										
										
										
											2019-06-02 15:35:57 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-19 23:02:54 +01:00
										 |  |  |     const showOptionsDialog = () => import(OPTIONS).then(d => d.showDialog()); | 
					
						
							|  |  |  |     $("#options-button").on('click', showOptionsDialog); | 
					
						
							| 
									
										
										
										
											2019-11-24 10:40:18 +01:00
										 |  |  |     keyboardActionService.setGlobalActionHandler("ShowOptions", showOptionsDialog); | 
					
						
							| 
									
										
										
										
											2018-03-26 22:29:14 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-19 23:02:54 +01:00
										 |  |  |     const showHelpDialog = () => import(HELP).then(d => d.showDialog()); | 
					
						
							|  |  |  |     $("#show-help-button").on('click', showHelpDialog); | 
					
						
							| 
									
										
										
										
											2019-11-24 10:40:18 +01:00
										 |  |  |     keyboardActionService.setGlobalActionHandler("ShowHelp", showHelpDialog); | 
					
						
							| 
									
										
										
										
											2019-02-10 10:38:18 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-19 23:02:54 +01:00
										 |  |  |     const showSqlConsoleDialog = () => import(SQL_CONSOLE).then(d => d.showDialog()); | 
					
						
							|  |  |  |     $("#open-sql-console-button").on('click', showSqlConsoleDialog); | 
					
						
							| 
									
										
										
										
											2019-11-24 10:40:18 +01:00
										 |  |  |     keyboardActionService.setGlobalActionHandler("ShowSQLConsole", showSqlConsoleDialog); | 
					
						
							| 
									
										
										
										
											2018-03-26 22:29:14 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-05 21:25:36 +01:00
										 |  |  |     const showBackendLogDialog = () => import(BACKEND_LOG).then(d => d.showDialog()); | 
					
						
							|  |  |  |     $("#show-backend-log-button").on('click', showBackendLogDialog); | 
					
						
							|  |  |  |     keyboardActionService.setGlobalActionHandler("ShowBackendLog", showBackendLogDialog); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-09 17:39:48 +01:00
										 |  |  |     $("#show-about-dialog-button").on('click', () => import(ABOUT).then(d => d.showDialog())); | 
					
						
							| 
									
										
										
										
											2019-03-24 23:01:33 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-26 22:29:14 -04:00
										 |  |  |     if (utils.isElectron()) { | 
					
						
							| 
									
										
										
										
											2018-05-26 22:54:06 -04:00
										 |  |  |         $("#history-navigation").show(); | 
					
						
							| 
									
										
										
										
											2019-11-09 17:39:48 +01:00
										 |  |  |         $("#history-back-button").on('click', window.history.back); | 
					
						
							| 
									
										
										
										
											2019-11-24 10:40:18 +01:00
										 |  |  |         keyboardActionService.setGlobalActionHandler("BackInNoteHistory", window.history.back); | 
					
						
							| 
									
										
										
										
											2018-05-26 22:54:06 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-19 23:02:54 +01:00
										 |  |  |         $("#history-forward-button").on('click', window.history.forward); | 
					
						
							| 
									
										
										
										
											2019-11-24 10:40:18 +01:00
										 |  |  |         keyboardActionService.setGlobalActionHandler("ForwardInNoteHistory", window.history.forward); | 
					
						
							| 
									
										
										
										
											2018-03-26 22:29:14 -04:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-18 19:32:27 +01:00
										 |  |  |     // hide (toggle) everything except for the note content for zen mode
 | 
					
						
							| 
									
										
										
										
											2019-11-19 23:02:54 +01:00
										 |  |  |     const toggleZenMode = () => { | 
					
						
							| 
									
										
										
										
											2019-11-18 19:32:27 +01:00
										 |  |  |         $(".hide-in-zen-mode").toggle(); | 
					
						
							|  |  |  |         $("#container").toggleClass("zen-mode"); | 
					
						
							| 
									
										
										
										
											2019-11-19 23:02:54 +01:00
										 |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-19 23:33:07 +01:00
										 |  |  |     $("#toggle-zen-mode-button").on('click', toggleZenMode); | 
					
						
							| 
									
										
										
										
											2019-11-24 10:40:18 +01:00
										 |  |  |     keyboardActionService.setGlobalActionHandler("ToggleZenMode", toggleZenMode); | 
					
						
							| 
									
										
										
										
											2018-03-26 22:29:14 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-24 10:40:18 +01:00
										 |  |  |     keyboardActionService.setGlobalActionHandler("InsertDateTimeToText", () => { | 
					
						
							| 
									
										
										
										
											2018-03-26 22:29:14 -04:00
										 |  |  |         const date = new Date(); | 
					
						
							|  |  |  |         const dateString = utils.formatDateTime(date); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         linkService.addTextToEditor(dateString); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-09 17:39:48 +01:00
										 |  |  |     $("#reload-frontend-button").on('click', utils.reloadApp); | 
					
						
							| 
									
										
										
										
											2019-11-24 10:40:18 +01:00
										 |  |  |     keyboardActionService.setGlobalActionHandler("ReloadFrontendApp", utils.reloadApp); | 
					
						
							| 
									
										
										
										
											2018-03-26 22:29:14 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-09 19:25:55 +01:00
										 |  |  |     $("#open-dev-tools-button").toggle(utils.isElectron()); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (utils.isElectron()) { | 
					
						
							|  |  |  |         const openDevTools = () => { | 
					
						
							| 
									
										
										
										
											2018-03-26 22:29:14 -04:00
										 |  |  |             require('electron').remote.getCurrentWindow().toggleDevTools(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             return false; | 
					
						
							| 
									
										
										
										
											2019-02-09 19:25:55 +01:00
										 |  |  |         }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-09 17:39:48 +01:00
										 |  |  |         $("#open-dev-tools-button").on('click', openDevTools); | 
					
						
							| 
									
										
										
										
											2019-11-24 10:40:18 +01:00
										 |  |  |         keyboardActionService.setGlobalActionHandler("OpenDevTools", openDevTools); | 
					
						
							| 
									
										
										
										
											2019-02-09 19:25:55 +01:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2018-03-26 22:29:14 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-02 21:44:56 +02:00
										 |  |  |     let findInPage; | 
					
						
							| 
									
										
										
										
											2018-11-21 23:39:19 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-02 21:44:56 +02:00
										 |  |  |     if (utils.isElectron()) { | 
					
						
							|  |  |  |         const { remote } = require('electron'); | 
					
						
							|  |  |  |         const { FindInPage } = require('electron-find'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         findInPage = new FindInPage(remote.getCurrentWebContents(), { | 
					
						
							|  |  |  |             offsetTop: 10, | 
					
						
							|  |  |  |             offsetRight: 10, | 
					
						
							|  |  |  |             boxBgColor: 'var(--main-background-color)', | 
					
						
							|  |  |  |             boxShadowColor: '#000', | 
					
						
							|  |  |  |             inputColor: 'var(--input-text-color)', | 
					
						
							|  |  |  |             inputBgColor: 'var(--input-background-color)', | 
					
						
							|  |  |  |             inputFocusColor: '#555', | 
					
						
							|  |  |  |             textColor: 'var(--main-text-color)', | 
					
						
							|  |  |  |             textHoverBgColor: '#555', | 
					
						
							|  |  |  |             caseSelectedColor: 'var(--main-border-color)' | 
					
						
							|  |  |  |         }); | 
					
						
							| 
									
										
										
										
											2018-03-26 22:29:14 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-24 10:40:18 +01:00
										 |  |  |         keyboardActionService.setGlobalActionHandler("FindInText", () => { | 
					
						
							| 
									
										
										
										
											2019-11-20 22:48:32 +01:00
										 |  |  |             if (!glob.activeDialog || !glob.activeDialog.is(":visible")) { | 
					
						
							|  |  |  |                 findInPage.openFindWindow(); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         }); | 
					
						
							| 
									
										
										
										
											2018-12-10 20:44:50 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-28 21:52:25 +02:00
										 |  |  |     if (utils.isElectron()) { | 
					
						
							| 
									
										
										
										
											2019-11-19 23:02:54 +01:00
										 |  |  |         const toggleFullscreen = () => { | 
					
						
							| 
									
										
										
										
											2019-04-28 21:52:25 +02:00
										 |  |  |             const win = require('electron').remote.getCurrentWindow(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             if (win.isFullScreenable()) { | 
					
						
							|  |  |  |                 win.setFullScreen(!win.isFullScreen()); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             return false; | 
					
						
							| 
									
										
										
										
											2019-04-28 21:59:29 +02:00
										 |  |  |         }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-09 17:39:48 +01:00
										 |  |  |         $("#toggle-fullscreen-button").on('click', toggleFullscreen); | 
					
						
							| 
									
										
										
										
											2019-04-28 21:59:29 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-24 10:40:18 +01:00
										 |  |  |         keyboardActionService.setGlobalActionHandler("ToggleFullscreen", toggleFullscreen); | 
					
						
							| 
									
										
										
										
											2019-04-28 21:59:29 +02:00
										 |  |  |     } | 
					
						
							|  |  |  |     else { | 
					
						
							|  |  |  |         // outside of electron this is handled by the browser
 | 
					
						
							|  |  |  |         $("#toggle-fullscreen-button").hide(); | 
					
						
							| 
									
										
										
										
											2019-04-28 21:52:25 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-02 13:02:20 -04:00
										 |  |  |     if (utils.isElectron()) { | 
					
						
							| 
									
										
										
										
											2019-11-24 10:40:18 +01:00
										 |  |  |         keyboardActionService.setGlobalActionHandler("ZoomOut", zoomService.decreaseZoomFactor); | 
					
						
							|  |  |  |         keyboardActionService.setGlobalActionHandler("ZoomIn", zoomService.increaseZoomFactor); | 
					
						
							| 
									
										
										
										
											2018-06-02 13:02:20 -04:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-10-10 20:00:06 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     $(document).on('click', "a[data-action='note-revision']", async event => { | 
					
						
							|  |  |  |         const linkEl = $(event.target); | 
					
						
							|  |  |  |         const noteId = linkEl.attr('data-note-path'); | 
					
						
							|  |  |  |         const noteRevisionId = linkEl.attr('data-note-revision-id'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         const attributesDialog = await import("../dialogs/note_revisions.js"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         attributesDialog.showNoteRevisionsDialog(noteId, noteRevisionId); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         return false; | 
					
						
							|  |  |  |     }); | 
					
						
							| 
									
										
										
										
											2019-11-10 22:19:22 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-24 10:40:18 +01:00
										 |  |  |     keyboardActionService.setGlobalActionHandler("CloneNotesTo", () => import(CLONE_TO).then(d => { | 
					
						
							| 
									
										
										
										
											2019-11-10 22:19:22 +01:00
										 |  |  |         const activeNode = treeService.getActiveNode(); | 
					
						
							| 
									
										
										
										
											2019-11-11 22:57:51 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-10 22:19:22 +01:00
										 |  |  |         const selectedOrActiveNodes = treeService.getSelectedOrActiveNodes(activeNode); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         const noteIds = selectedOrActiveNodes.map(node => node.data.noteId); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         d.showDialog(noteIds); | 
					
						
							|  |  |  |     })); | 
					
						
							| 
									
										
										
										
											2019-11-11 22:57:51 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-24 10:40:18 +01:00
										 |  |  |     keyboardActionService.setGlobalActionHandler("MoveNotesTo", () => import(MOVE_TO).then(d => { | 
					
						
							| 
									
										
										
										
											2019-11-11 22:57:51 +01:00
										 |  |  |         const activeNode = treeService.getActiveNode(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         const selectedOrActiveNodes = treeService.getSelectedOrActiveNodes(activeNode); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         d.showDialog(selectedOrActiveNodes); | 
					
						
							|  |  |  |     })); | 
					
						
							| 
									
										
										
										
											2019-11-21 21:12:07 +01:00
										 |  |  |      | 
					
						
							| 
									
										
										
										
											2019-11-24 10:40:18 +01:00
										 |  |  |     keyboardActionService.setGlobalActionHandler("CreateNoteIntoDayNote", async () => { | 
					
						
							| 
									
										
										
										
											2019-11-24 21:40:50 +01:00
										 |  |  |         const todayNote = await dateNoteService.getTodayNote(); | 
					
						
							| 
									
										
										
										
											2019-11-21 21:12:07 +01:00
										 |  |  |         const notePath = await treeService.getSomeNotePath(todayNote); | 
					
						
							| 
									
										
										
										
											2019-11-19 20:53:04 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-21 21:12:07 +01:00
										 |  |  |         const node = await treeService.expandToNote(notePath); | 
					
						
							| 
									
										
										
										
											2019-11-19 20:53:04 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-24 21:40:50 +01:00
										 |  |  |         const {note} = await treeService.createNote(node, todayNote.noteId, 'into', { | 
					
						
							| 
									
										
										
										
											2019-11-21 21:12:07 +01:00
										 |  |  |             type: "text", | 
					
						
							|  |  |  |             isProtected: node.data.isProtected | 
					
						
							|  |  |  |         }); | 
					
						
							| 
									
										
										
										
											2019-11-24 21:40:50 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |         await noteDetailService.openInTab(note.noteId, true); | 
					
						
							| 
									
										
										
										
											2019-11-19 23:02:54 +01:00
										 |  |  |     }); | 
					
						
							| 
									
										
										
										
											2019-11-23 23:06:25 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-24 10:40:18 +01:00
										 |  |  |     keyboardActionService.setGlobalActionHandler("EditBranchPrefix", async () => { | 
					
						
							| 
									
										
										
										
											2019-11-23 23:06:25 +01:00
										 |  |  |         const node = treeService.getActiveNode(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         const editBranchPrefixDialog = await import("../dialogs/branch_prefix.js"); | 
					
						
							|  |  |  |         editBranchPrefixDialog.showDialog(node); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-24 10:40:18 +01:00
										 |  |  |     keyboardActionService.setGlobalActionHandler("ToggleNoteHoisting", async () => { | 
					
						
							| 
									
										
										
										
											2019-11-23 23:06:25 +01:00
										 |  |  |         const node = treeService.getActiveNode(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         hoistedNoteService.getHoistedNoteId().then(async hoistedNoteId => { | 
					
						
							|  |  |  |             if (node.data.noteId === hoistedNoteId) { | 
					
						
							|  |  |  |                 hoistedNoteService.unhoist(); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |             else { | 
					
						
							|  |  |  |                 const note = await treeCache.getNote(node.data.noteId); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 if (note.type !== 'search') { | 
					
						
							|  |  |  |                     hoistedNoteService.setHoistedNoteId(node.data.noteId); | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         }); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-24 10:40:18 +01:00
										 |  |  |     keyboardActionService.setGlobalActionHandler("SearchInSubtree",  () => { | 
					
						
							| 
									
										
										
										
											2019-11-23 23:06:25 +01:00
										 |  |  |         const node = treeService.getActiveNode(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         searchNotesService.searchInSubtree(node.data.noteId); | 
					
						
							|  |  |  |     }); | 
					
						
							| 
									
										
										
										
											2019-11-19 23:02:54 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-26 22:29:14 -04:00
										 |  |  | export default { | 
					
						
							|  |  |  |     registerEntrypoints | 
					
						
							|  |  |  | } |