mirror of
https://github.com/zadam/trilium.git
synced 2025-11-03 03:46:37 +01:00
client: Hide native title bar setting on web
This commit is contained in:
8
integration-tests/settings.spec.ts
Normal file
8
integration-tests/settings.spec.ts
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
import test, { expect } from "@playwright/test";
|
||||||
|
|
||||||
|
test("Native Title Bar not displayed on web", async ({ page }) => {
|
||||||
|
await page.goto('http://localhost:8082/#root/_hidden/_options/_optionsAppearance');
|
||||||
|
await expect(page.getByRole('heading', { name: 'Theme' })).toBeVisible();
|
||||||
|
await expect(page.getByRole('heading', { name: 'Native Title Bar (requires' })).toBeHidden();
|
||||||
|
});
|
||||||
|
|
||||||
@@ -85,6 +85,9 @@ function now() {
|
|||||||
return formatTimeWithSeconds(new Date());
|
return formatTimeWithSeconds(new Date());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns `true` if the client is currently running under Electron, or `false` if running in a web browser.
|
||||||
|
*/
|
||||||
function isElectron() {
|
function isElectron() {
|
||||||
return !!(window && window.process && window.process.type);
|
return !!(window && window.process && window.process.type);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -131,6 +131,10 @@ class BasicWidget extends Component {
|
|||||||
return this.$widget;
|
return this.$widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if the widget is enabled. Widgets are enabled by default. Generally setting this to `false` will cause the widget not to be displayed, however it will still be available on the DOM but hidden.
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
isEnabled() {
|
isEnabled() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ class NoteContextAwareWidget extends BasicWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*
|
||||||
* @returns {boolean} true when an active note exists
|
* @returns {boolean} true when an active note exists
|
||||||
*/
|
*/
|
||||||
isEnabled() {
|
isEnabled() {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import OptionsWidget from "../options_widget.js";
|
import OptionsWidget from "../options_widget.js";
|
||||||
import { t } from "../../../../services/i18n.js";
|
import { t } from "../../../../services/i18n.js";
|
||||||
|
import utils from "../../../../services/utils.js";
|
||||||
|
|
||||||
const TPL = `
|
const TPL = `
|
||||||
<div class="options-section">
|
<div class="options-section">
|
||||||
@@ -21,6 +22,10 @@ export default class NativeTitleBarOptions extends OptionsWidget {
|
|||||||
this.updateOption('nativeTitleBarVisible', nativeTitleBarVisible);
|
this.updateOption('nativeTitleBarVisible', nativeTitleBarVisible);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isEnabled() {
|
||||||
|
return utils.isElectron();
|
||||||
|
}
|
||||||
|
|
||||||
async optionsLoaded(options) {
|
async optionsLoaded(options) {
|
||||||
this.$nativeTitleBarSelect.val(options.nativeTitleBarVisible === 'true' ? 'show' : 'hide');
|
this.$nativeTitleBarSelect.val(options.nativeTitleBarVisible === 'true' ? 'show' : 'hide');
|
||||||
|
|||||||
Reference in New Issue
Block a user