Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
added "switch to mobile version" button to web edition, closes #1889
zadame378435fbedc
diff --git a/package-lock.json b/package-lock.jsonindex 6f2117bcc3..3e737316c4 100644--- a/package-lock.json+++ b/package-lock.json@@ -1,6 +1,6 @@{"name": "trilium",- "version": "0.48.3",+ "version": "0.48.4","lockfileVersion": 1,"requires": true,"dependencies": {diff --git a/src/public/app/services/entrypoints.js b/src/public/app/services/entrypoints.jsindex dff5497cf9..2daa21b256 100644--- a/src/public/app/services/entrypoints.js+++ b/src/public/app/services/entrypoints.js@@ -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';diff --git a/src/public/app/widgets/buttons/global_menu.js b/src/public/app/widgets/buttons/global_menu.jsindex f1d6c4d769..671783fabc 100644--- a/src/public/app/widgets/buttons/global_menu.js+++ b/src/public/app/widgets/buttons/global_menu.js@@ -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'));