mirror of
https://github.com/zadam/trilium.git
synced 2025-01-15 03:27:44 +08:00
added "switch to mobile version" button to web edition, closes #1889
This commit is contained in:
parent
e4dca4750f
commit
e378435fbe
3 changed files with 16 additions and 3 deletions
2
package-lock.json
generated
2
package-lock.json
generated
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "trilium",
|
||||
"version": "0.48.3",
|
||||
"version": "0.48.4",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
|
|
@ -172,6 +172,12 @@ export default class Entrypoints extends Component {
|
|||
utils.reloadFrontendApp("Switching to desktop version");
|
||||
}
|
||||
|
||||
async switchToMobileVersionCommand() {
|
||||
utils.setCookie('trilium-device', 'mobile');
|
||||
|
||||
utils.reloadFrontendApp("Switching to mobile version");
|
||||
}
|
||||
|
||||
async openInWindowCommand({notePath, hoistedNoteId}) {
|
||||
if (!hoistedNoteId) {
|
||||
hoistedNoteId = 'root';
|
||||
|
|
|
@ -60,6 +60,11 @@ const TPL = `
|
|||
<kbd data-command="showBackendLog"></kbd>
|
||||
</a>
|
||||
|
||||
<a class="dropdown-item switch-to-mobile-version-button" data-trigger-command="switchToMobileVersion">
|
||||
<span class="bx bx-empty"></span>
|
||||
Switch to mobile version
|
||||
</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>
|
||||
|
@ -103,9 +108,11 @@ export default class GlobalMenuWidget extends BasicWidget {
|
|||
this.$widget.find(".show-about-dialog-button").on('click',
|
||||
() => import("../../dialogs/about.js").then(d => d.showDialog()));
|
||||
|
||||
this.$widget.find(".logout-button").toggle(!utils.isElectron());
|
||||
const isElectron = utils.isElectron();
|
||||
|
||||
this.$widget.find(".open-dev-tools-button").toggle(utils.isElectron());
|
||||
this.$widget.find(".logout-button").toggle(!isElectron);
|
||||
this.$widget.find(".open-dev-tools-button").toggle(isElectron);
|
||||
this.$widget.find(".switch-to-mobile-version-button").toggle(!isElectron);
|
||||
|
||||
this.$widget.on('click', '.dropdown-item',
|
||||
() => this.$widget.find("[data-toggle='dropdown']").dropdown('toggle'));
|
||||
|
|
Loading…
Reference in a new issue