This commit is contained in:
zadam
2020-02-05 22:46:20 +01:00
parent 42017fde5f
commit d1bb62c40e
10 changed files with 158 additions and 166 deletions

View File

@@ -18,11 +18,12 @@ const TPL = `
export default class HistoryNavigationWidget extends BasicWidget {
doRender() {
if (!utils.isElectron()) {
return;
if (utils.isElectron()) {
this.$widget = $(TPL);
}
else {
this.$widget = $("<div>");
}
this.$widget = $(TPL);
return this.$widget;
}

View File

@@ -3,16 +3,16 @@ import splitService from "../services/split.js";
import BasicWidget from "./basic_widget.js";
const TPL = `
<div>
<div class="hide-in-zen-mode">
<style>
#hide-right-pane-button, #show-right-pane-button {
.hide-right-pane-button, .show-right-pane-button {
position: fixed;
bottom: 10px;
right: 10px;
z-index: 1000;
}
#hide-left-pane-button, #show-left-pane-button {
.hide-left-pane-button, .show-left-pane-button {
position: fixed;
bottom: 10px;
left: 10px;
@@ -20,15 +20,15 @@ const TPL = `
}
</style>
<button id="hide-left-pane-button" class="btn btn-sm icon-button bx bx-chevrons-left hide-in-zen-mode" title="Show sidebar"></button>
<button id="show-left-pane-button" class="btn btn-sm icon-button bx bx-chevrons-right hide-in-zen-mode" title="Hide sidebar"></button>
<button class="hide-left-pane-button btn btn-sm icon-button bx bx-chevrons-left" title="Show sidebar"></button>
<button class="show-left-pane-button btn btn-sm icon-button bx bx-chevrons-right" title="Hide sidebar"></button>
<button id="hide-right-pane-button" class="btn btn-sm icon-button bx bx-chevrons-right hide-in-zen-mode" title="Hide sidebar"></button>
<button id="show-right-pane-button" class="btn btn-sm icon-button bx bx-chevrons-left hide-in-zen-mode" title="Show sidebar"></button>
<button class="hide-right-pane-button btn btn-sm icon-button bx bx-chevrons-right" title="Hide sidebar"></button>
<button class="show-right-pane-button btn btn-sm icon-button bx bx-chevrons-left" title="Show sidebar"></button>
</div>
`;
export default class SidebarToggle extends BasicWidget {
export default class SidepaneToggles extends BasicWidget {
constructor(appContext) {
super(appContext);
@@ -41,11 +41,11 @@ export default class SidebarToggle extends BasicWidget {
this.toggleSidebar('left', options.is('leftPaneVisible'));
this.toggleSidebar('right', options.is('rightPaneVisible'));
$("#show-right-pane-button").on('click', () => toggleAndSave('right', true));
$("#hide-right-pane-button").on('click', () => toggleAndSave('right', false));
this.$widget.find(".show-right-pane-button").on('click', () => this.toggleAndSave('right', true));
this.$widget.find(".hide-right-pane-button").on('click', () => this.toggleAndSave('right', false));
$("#show-left-pane-button").on('click', () => toggleAndSave('left', true));
$("#hide-left-pane-button").on('click', () => toggleAndSave('left', false));
this.$widget.find(".show-left-pane-button").on('click', () => this.toggleAndSave('left', true));
this.$widget.find(".hide-left-pane-button").on('click', () => this.toggleAndSave('left', false));
splitService.setupSplit(this.paneVisible.left, this.paneVisible.right);
@@ -54,8 +54,8 @@ export default class SidebarToggle extends BasicWidget {
toggleSidebar(side, show) {
$(`#${side}-pane`).toggle(show);
$(`#show-${side}-pane-button`).toggle(!show);
$(`#hide-${side}-pane-button`).toggle(show);
this.$widget.find(`.show-${side}-pane-button`).toggle(!show);
this.$widget.find(`.hide-${side}-pane-button`).toggle(show);
this.paneVisible[side] = show;
}

View File

@@ -1,6 +1,5 @@
import BasicWidget from "./basic_widget.js";
import HistoryNavigationWidget from "./history_navigation.js";
import keyboardActionService from "../services/keyboard_actions.js";
import protectedSessionService from "../services/protected_session.js";
const TPL = `

View File

@@ -19,10 +19,6 @@ const TPL = `
export default class TitleBarButtonsWidget extends BasicWidget {
doRender() {
if (!utils.isElectron()) {
return;
}
if (!options.is('nativeTitleBarVisible')) {
this.$widget = $(TPL);
this.$widget.show();