Skip to content

Build your personal knowledge base with Trilium Notes

fix keyboard shortcut for "open externally"

zadamb9133cb68353
diff --git a/src/public/app/services/app_context.js b/src/public/app/services/app_context.js
index 72050fd07c..17d92b58dd 100644
--- a/src/public/app/services/app_context.js
+++ b/src/public/app/services/app_context.js
@@ -1,6 +1,6 @@
import treeCache from "./tree_cache.js";
import bundleService from "./bundle.js";
-import DialogCommandExecutor from "./dialog_command_executor.js";
+import RootCommandExecutor from "./root_command_executor.js";
import Entrypoints from "./entrypoints.js";
import options from "./options.js";
import utils from "./utils.js";
@@ -57,7 +57,7 @@ class AppContext extends Component {
this.executors = [
this.tabManager,
- new DialogCommandExecutor(),
+ new RootCommandExecutor(),
new Entrypoints(),
new MainTreeExecutors()
];
diff --git a/src/public/app/services/dialog_command_executor.js b/src/public/app/services/root_command_executor.js
similarity index 90%
rename from src/public/app/services/dialog_command_executor.js
rename to src/public/app/services/root_command_executor.js
index 349126532d..b8e3795d14 100644
--- a/src/public/app/services/dialog_command_executor.js
+++ b/src/public/app/services/root_command_executor.js
@@ -2,8 +2,9 @@ import Component from "../widgets/component.js";
import appContext from "./app_context.js";
import dateNoteService from "../services/date_notes.js";
import treeService from "../services/tree.js";
+import openService from "./open.js";
-export default class DialogCommandExecutor extends Component {
+export default class RootCommandExecutor extends Component {
jumpToNoteCommand() {
import("../dialogs/jump_to_note.js").then(d => d.showDialog());
}
@@ -84,4 +85,12 @@ export default class DialogCommandExecutor extends Component {
showBackendLogCommand() {
import("../dialogs/backend_log.js").then(d => d.showDialog());
}
+
+ openNoteExternallyCommand() {
+ const noteId = appContext.tabManager.getActiveTabNoteId();
+
+ if (noteId) {
+ openService.openNoteExternally(noteId);
+ }
+ }
}
diff --git a/src/public/app/widgets/global_menu.js b/src/public/app/widgets/global_menu.js
index 9980961dd2..1aee8fa27f 100644
--- a/src/public/app/widgets/global_menu.js
+++ b/src/public/app/widgets/global_menu.js
@@ -22,6 +22,7 @@ const TPL = `
padding-left: 10px;
padding-right: 10px;
position: relative;
+ top: -2px;
border-radius: 0;
}
diff --git a/src/public/app/widgets/note_actions.js b/src/public/app/widgets/note_actions.js
index 9b8371dfee..88ac752ae6 100644
--- a/src/public/app/widgets/note_actions.js
+++ b/src/public/app/widgets/note_actions.js
@@ -1,6 +1,6 @@
import TabAwareWidget from "./tab_aware_widget.js";
import protectedSessionService from "../services/protected_session.js";
-import openService from "../services/open.js";
+import utils from "../services/utils.js";
const TPL = `
<div class="dropdown note-actions">
@@ -123,7 +123,6 @@ export default class NoteActionsWidget extends TabAwareWidget {
() => this.$widget.find('.dropdown-toggle').dropdown('toggle'));
this.$openNoteExternallyButton = this.$widget.find(".open-note-externally-button");
- this.$openNoteExternallyButton.on('click', () => openService.openNoteExternally(this.noteId));
}
refreshWithNote(note) {
@@ -133,6 +132,8 @@ export default class NoteActionsWidget extends TabAwareWidget {
this.$protectButton.toggle(!note.isProtected);
this.$unprotectButton.toggle(!!note.isProtected);
+
+ this.$openNoteExternallyButton.toggle(utils.isElectron());
}
toggleDisabled($el, enable) {