2021-05-24 22:29:49 +02:00
|
|
|
import BasicWidget from "../basic_widget.js";
|
|
|
|
import utils from "../../services/utils.js";
|
2020-01-15 19:40:17 +01:00
|
|
|
|
|
|
|
const TPL = `
|
2021-05-28 22:47:59 +02:00
|
|
|
<div class="dropdown global-menu dropright">
|
2020-01-15 19:40:17 +01:00
|
|
|
<style>
|
2021-06-13 22:55:31 +02:00
|
|
|
.global-menu {
|
|
|
|
width: 53px;
|
|
|
|
height: 53px;
|
|
|
|
}
|
|
|
|
|
2020-01-15 19:40:17 +01:00
|
|
|
.global-menu .dropdown-menu {
|
|
|
|
width: 20em;
|
|
|
|
}
|
2021-06-06 22:15:51 +02:00
|
|
|
|
|
|
|
.global-menu-button {
|
|
|
|
background-image: url("images/icon-bw.png");
|
|
|
|
background-repeat: no-repeat;
|
|
|
|
background-position: 50% 45%;
|
2021-06-13 22:55:31 +02:00
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
2021-06-06 22:15:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
.global-menu-button:hover {
|
|
|
|
background-image: url("images/icon-color.png");
|
|
|
|
}
|
2020-01-15 19:40:17 +01:00
|
|
|
</style>
|
|
|
|
|
2021-06-06 22:15:51 +02:00
|
|
|
<button type="button" data-toggle="dropdown" data-placement="right"
|
|
|
|
aria-haspopup="true" aria-expanded="false"
|
|
|
|
class="icon-action global-menu-button" title="Menu"></button>
|
2021-05-28 22:47:59 +02:00
|
|
|
|
|
|
|
<div class="dropdown-menu dropdown-menu-right">
|
|
|
|
<a class="dropdown-item options-button" data-trigger-command="showOptions">
|
|
|
|
<span class="bx bx-slider"></span>
|
|
|
|
Options
|
|
|
|
</a>
|
|
|
|
|
|
|
|
<a class="dropdown-item" data-trigger-command="openNewWindow">
|
|
|
|
<span class="bx bx-window-open"></span>
|
|
|
|
Open new window
|
|
|
|
<kbd data-command="openNewWindow"></kbd>
|
|
|
|
</a>
|
|
|
|
|
|
|
|
<a class="dropdown-item open-dev-tools-button" data-trigger-command="openDevTools">
|
|
|
|
<span class="bx bx-terminal"></span>
|
|
|
|
Open Dev Tools
|
|
|
|
<kbd data-command="openDevTools"></kbd>
|
|
|
|
</a>
|
|
|
|
|
|
|
|
<a class="dropdown-item" data-trigger-command="showSQLConsole">
|
|
|
|
<span class="bx bx-data"></span>
|
|
|
|
Open SQL Console
|
|
|
|
<kbd data-command="showSQLConsole"></kbd>
|
|
|
|
</a>
|
|
|
|
|
|
|
|
<a class="dropdown-item" data-trigger-command="showBackendLog">
|
|
|
|
<span class="bx bx-empty"></span>
|
|
|
|
Show backend log
|
|
|
|
<kbd data-command="showBackendLog"></kbd>
|
|
|
|
</a>
|
|
|
|
|
|
|
|
<a class="dropdown-item" data-trigger-command="reloadFrontendApp"
|
|
|
|
title="Reload can help with some visual glitches without restarting the whole app.">
|
|
|
|
<span class="bx bx-empty"></span>
|
|
|
|
Reload frontend
|
|
|
|
<kbd data-command="reloadFrontendApp"></kbd>
|
|
|
|
</a>
|
|
|
|
|
|
|
|
<a class="dropdown-item" data-trigger-command="toggleFullscreen">
|
|
|
|
<span class="bx bx-empty"></span>
|
|
|
|
Toggle fullscreen
|
|
|
|
<kbd data-command="toggleFullscreen"></kbd>
|
|
|
|
</a>
|
|
|
|
|
|
|
|
<a class="dropdown-item" data-trigger-command="showHelp">
|
|
|
|
<span class="bx bx-info-circle"></span>
|
|
|
|
Show Help
|
|
|
|
<kbd data-command="showHelp"></kbd>
|
|
|
|
</a>
|
|
|
|
|
|
|
|
<a class="dropdown-item show-about-dialog-button">
|
|
|
|
<span class="bx bx-empty"></span>
|
|
|
|
About Trilium Notes
|
|
|
|
</a>
|
|
|
|
|
|
|
|
<a class="dropdown-item logout-button" data-trigger-command="logout">
|
|
|
|
<span class="bx bx-log-out"></span>
|
|
|
|
Logout
|
|
|
|
</a>
|
2020-01-15 19:40:17 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
`;
|
|
|
|
|
|
|
|
export default class GlobalMenuWidget extends BasicWidget {
|
2020-01-22 20:48:56 +01:00
|
|
|
doRender() {
|
2020-01-15 19:40:17 +01:00
|
|
|
this.$widget = $(TPL);
|
|
|
|
|
2021-06-06 22:15:51 +02:00
|
|
|
this.$widget.find(".global-menu-button").tooltip();
|
|
|
|
|
2020-01-22 19:41:19 +01:00
|
|
|
this.$widget.find(".show-about-dialog-button").on('click',
|
2021-05-24 22:29:49 +02:00
|
|
|
() => import("../../dialogs/about.js").then(d => d.showDialog()));
|
2020-01-15 19:40:17 +01:00
|
|
|
|
2020-01-22 19:41:19 +01:00
|
|
|
this.$widget.find(".logout-button").toggle(!utils.isElectron());
|
2020-01-15 19:40:17 +01:00
|
|
|
|
2020-01-22 19:41:19 +01:00
|
|
|
this.$widget.find(".open-dev-tools-button").toggle(utils.isElectron());
|
2020-08-28 14:52:38 +02:00
|
|
|
|
|
|
|
this.$widget.on('click', '.dropdown-item',
|
2021-02-13 21:52:31 +01:00
|
|
|
() => this.$widget.find("[data-toggle='dropdown']").dropdown('toggle'));
|
2020-01-15 19:40:17 +01:00
|
|
|
}
|
2020-06-13 10:23:36 +02:00
|
|
|
}
|