mirror of
https://github.com/zadam/trilium.git
synced 2025-10-29 09:16:45 +01:00
keyboard handlers for tabs
This commit is contained in:
@@ -10,9 +10,9 @@ const keyboardActionsLoaded = server.get('keyboard-actions').then(actions => {
|
||||
|
||||
for (const shortcut of action.effectiveShortcuts || []) {
|
||||
if (shortcut && !shortcut.startsWith("global:")) { // global shortcuts should be handled in the electron code
|
||||
const eventName = action.actionName.charAt(0).toUpperCase() + action.actionName.slice(1);
|
||||
const eventName = action.actionName.charAt(0).toLowerCase() + action.actionName.slice(1);
|
||||
|
||||
utils.bindGlobalShortcut(shortcut, appContext.trigger(eventName));
|
||||
utils.bindGlobalShortcut(shortcut, () => appContext.trigger(eventName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -103,34 +103,6 @@ function updateDisplayedShortcuts($container) {
|
||||
|
||||
$(() => updateDisplayedShortcuts($(document)));
|
||||
|
||||
setGlobalActionHandler('OpenNewTab', () => {
|
||||
appContext.openEmptyTab();
|
||||
});
|
||||
|
||||
setGlobalActionHandler('CloseActiveTab', () => {
|
||||
if (this.tabRow.activeTabEl) {
|
||||
this.tabRow.removeTab(this.tabRow.activeTabId);
|
||||
}
|
||||
});
|
||||
|
||||
setGlobalActionHandler('ActivateNextTab', () => {
|
||||
const nextTab = this.tabRow.nextTabEl;
|
||||
|
||||
if (nextTab) {
|
||||
// FIXME
|
||||
this.tabRow.activateTab(nextTab);
|
||||
}
|
||||
});
|
||||
|
||||
setGlobalActionHandler('ActivatePreviousTab', () => {
|
||||
const prevTab = this.tabRow.previousTabEl;
|
||||
|
||||
if (prevTab) {
|
||||
// FIXME
|
||||
this.tabRow.activateTab(prevTab);
|
||||
}
|
||||
});
|
||||
|
||||
export default {
|
||||
setGlobalActionHandler,
|
||||
setElementActionHandler,
|
||||
|
||||
Reference in New Issue
Block a user