mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 09:58:32 +02:00
add toggleLeftPane command/shortcut, closes #2225
This commit is contained in:
parent
23e34e8c02
commit
e2c37a6f8c
@ -50,6 +50,10 @@ class Options {
|
||||
|
||||
await server.put(`options`, payload);
|
||||
}
|
||||
|
||||
async toggle(key) {
|
||||
await this.save(key, (!this.is(key)).toString());
|
||||
}
|
||||
}
|
||||
|
||||
const options = new Options();
|
||||
|
@ -4,6 +4,7 @@ import dateNoteService from "../services/date_notes.js";
|
||||
import treeService from "../services/tree.js";
|
||||
import openService from "./open.js";
|
||||
import protectedSessionService from "./protected_session.js";
|
||||
import options from "./options.js";
|
||||
|
||||
export default class RootCommandExecutor extends Component {
|
||||
jumpToNoteCommand() {
|
||||
@ -101,4 +102,16 @@ export default class RootCommandExecutor extends Component {
|
||||
leaveProtectedSessionCommand() {
|
||||
protectedSessionService.leaveProtectedSession();
|
||||
}
|
||||
|
||||
hideLeftPaneCommand() {
|
||||
options.save(`leftPaneVisible`, "false");
|
||||
}
|
||||
|
||||
showLeftPaneCommand() {
|
||||
options.save(`leftPaneVisible`, "true");
|
||||
}
|
||||
|
||||
toggleLeftPaneCommand() {
|
||||
options.toggle('leftPaneVisible');
|
||||
}
|
||||
}
|
||||
|
@ -11,26 +11,18 @@ export default class LeftPaneToggleWidget extends ButtonWidget {
|
||||
: "bx-chevrons-right";
|
||||
|
||||
this.settings.title = isLeftPaneVisible
|
||||
? "Hide sidebar."
|
||||
: "Open sidebar.";
|
||||
? "Hide panel."
|
||||
: "Open panel.";
|
||||
|
||||
this.settings.command = isLeftPaneVisible
|
||||
? "hideSidebar"
|
||||
: "showSidebar";
|
||||
? "hideLeftPane"
|
||||
: "showLeftPane";
|
||||
|
||||
super.refreshIcon();
|
||||
|
||||
splitService.setupLeftPaneResizer(isLeftPaneVisible);
|
||||
}
|
||||
|
||||
hideSidebarCommand() {
|
||||
options.save(`leftPaneVisible`, "false");
|
||||
}
|
||||
|
||||
showSidebarCommand() {
|
||||
options.save(`leftPaneVisible`, "true");
|
||||
}
|
||||
|
||||
entitiesReloadedEvent({loadResults}) {
|
||||
if (loadResults.isOptionReloaded("leftPaneVisible")) {
|
||||
this.refreshIcon();
|
||||
|
@ -299,6 +299,7 @@ const DEFAULT_KEYBOARD_ACTIONS = [
|
||||
{
|
||||
actionName: "insertDateTimeToText",
|
||||
defaultShortcuts: ["Alt+T"],
|
||||
description: "Insert current date & time into text",
|
||||
scope: "text-detail"
|
||||
},
|
||||
{
|
||||
@ -456,11 +457,13 @@ const DEFAULT_KEYBOARD_ACTIONS = [
|
||||
{
|
||||
actionName: "reloadFrontendApp",
|
||||
defaultShortcuts: ["F5", "CommandOrControl+R"],
|
||||
description: "Reload frontend App",
|
||||
scope: "window"
|
||||
},
|
||||
{
|
||||
actionName: "openDevTools",
|
||||
defaultShortcuts: isElectron ? ["CommandOrControl+Shift+I"] : [],
|
||||
description: "Open dev tools",
|
||||
scope: "window"
|
||||
},
|
||||
{
|
||||
@ -468,24 +471,34 @@ const DEFAULT_KEYBOARD_ACTIONS = [
|
||||
defaultShortcuts: isElectron ? ["CommandOrControl+F"] : [],
|
||||
scope: "window"
|
||||
},
|
||||
{
|
||||
actionName: "toggleLeftPane",
|
||||
defaultShortcuts: [],
|
||||
description: "Toggle left (note tree) panel",
|
||||
scope: "window"
|
||||
},
|
||||
{
|
||||
actionName: "toggleFullscreen",
|
||||
defaultShortcuts: ["F11"],
|
||||
description: "Toggle full screen",
|
||||
scope: "window"
|
||||
},
|
||||
{
|
||||
actionName: "zoomOut",
|
||||
defaultShortcuts: isElectron ? ["CommandOrControl+-"] : [],
|
||||
description: "Zoom Out",
|
||||
scope: "window"
|
||||
},
|
||||
{
|
||||
actionName: "zoomIn",
|
||||
description: "Zoom In",
|
||||
defaultShortcuts: isElectron ? ["CommandOrControl+="] : [],
|
||||
scope: "window"
|
||||
},
|
||||
{
|
||||
actionName: "copyWithoutFormatting",
|
||||
defaultShortcuts: ["CommandOrControl+Alt+C"],
|
||||
description: "Copy selected text without formatting",
|
||||
scope: "text-detail"
|
||||
}
|
||||
];
|
||||
|
Loading…
x
Reference in New Issue
Block a user