From 9be5f332d24f521a5a9851d09892a96c919f7dff Mon Sep 17 00:00:00 2001 From: Michael Mayer Date: Sun, 27 Dec 2020 13:29:36 +0100 Subject: [PATCH] UX: Disable back button in full-screen viewers and editors Signed-off-by: Michael Mayer --- frontend/src/app.js | 5 ++++- frontend/src/share.js | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/frontend/src/app.js b/frontend/src/app.js index 1b62a7481..35f4a4da5 100644 --- a/frontend/src/app.js +++ b/frontend/src/app.js @@ -109,7 +109,10 @@ const router = new Router({ }); router.beforeEach((to, from, next) => { - if (to.matched.some((record) => record.meta.settings) && config.values.disable.settings) { + if (document.documentElement.className) { + // Disable back button in full-screen viewers and editors. + next(false); + } else if (to.matched.some((record) => record.meta.settings) && config.values.disable.settings) { next({ name: "home" }); } else if (to.matched.some((record) => record.meta.admin)) { if (isPublic || session.isAdmin()) { diff --git a/frontend/src/share.js b/frontend/src/share.js index dfe5f7c10..3f8ffc907 100644 --- a/frontend/src/share.js +++ b/frontend/src/share.js @@ -109,7 +109,10 @@ const router = new Router({ }); router.beforeEach((to, from, next) => { - if (to.matched.some((record) => record.meta.settings) && config.values.disable.settings) { + if (document.documentElement.className) { + // Disable back button in full-screen viewers and editors. + next(false); + } else if (to.matched.some((record) => record.meta.settings) && config.values.disable.settings) { next({ name: "home" }); } else if (to.matched.some((record) => record.meta.admin)) { if (isPublic || session.isAdmin()) {