mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 18:12:29 +08:00
feat(settings): turn native title bar into a checkbox
This commit is contained in:
parent
1e985f7858
commit
698ab86224
@ -3,13 +3,14 @@ import { t } from "../../../../services/i18n.js";
|
|||||||
import utils from "../../../../services/utils.js";
|
import utils from "../../../../services/utils.js";
|
||||||
|
|
||||||
const TPL = `
|
const TPL = `
|
||||||
<div class="options-section">
|
<div class="options-section">
|
||||||
<h4>${t("native_title_bar.title")}</h4>
|
<div class="side-checkbox">
|
||||||
|
<label class="form-check">
|
||||||
<select class="native-title-bar-select form-control">
|
<input type="checkbox" class="native-title-bar form-check-input" />
|
||||||
<option value="show">${t("native_title_bar.enabled")}</option>
|
<strong>Native title bar</strong>
|
||||||
<option value="hide">${t("native_title_bar.disabled")}</option>
|
<p>For Windows and macOS, keeping the native title bar off makes the application look more compact. On Linux, keeping the native title bar on integrates better with the rest of the system.</p>
|
||||||
</select>
|
</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="options-section">
|
<div class="options-section">
|
||||||
@ -30,12 +31,8 @@ const TPL = `
|
|||||||
export default class ElectronIntegrationOptions extends OptionsWidget {
|
export default class ElectronIntegrationOptions extends OptionsWidget {
|
||||||
doRender() {
|
doRender() {
|
||||||
this.$widget = $(TPL);
|
this.$widget = $(TPL);
|
||||||
this.$nativeTitleBarSelect = this.$widget.find(".native-title-bar-select");
|
this.$nativeTitleBar = this.$widget.find("input.native-title-bar");
|
||||||
this.$nativeTitleBarSelect.on('change', () => {
|
this.$nativeTitleBar.on("change", () => this.updateCheckboxOption("nativeTitleBarVisible", this.$nativeTitleBar));
|
||||||
const nativeTitleBarVisible = this.$nativeTitleBarSelect.val() === 'show' ? 'true' : 'false';
|
|
||||||
|
|
||||||
this.updateOption('nativeTitleBarVisible', nativeTitleBarVisible);
|
|
||||||
});
|
|
||||||
|
|
||||||
this.$backgroundEffects = this.$widget.find("input.background-effects");
|
this.$backgroundEffects = this.$widget.find("input.background-effects");
|
||||||
this.$backgroundEffects.on("change", () => this.updateCheckboxOption("backgroundEffects", this.$backgroundEffects));
|
this.$backgroundEffects.on("change", () => this.updateCheckboxOption("backgroundEffects", this.$backgroundEffects));
|
||||||
@ -53,7 +50,7 @@ export default class ElectronIntegrationOptions extends OptionsWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async optionsLoaded(options) {
|
async optionsLoaded(options) {
|
||||||
this.$nativeTitleBarSelect.val(options.nativeTitleBarVisible === 'true' ? 'show' : 'hide');
|
this.setCheckboxState(this.$nativeTitleBar, options.nativeTitleBarVisible);
|
||||||
this.setCheckboxState(this.$backgroundEffects, options.backgroundEffects);
|
this.setCheckboxState(this.$backgroundEffects, options.backgroundEffects);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user