diff --git a/package-lock.json b/package-lock.json index 7cb9c5a65..6eda4a9af 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1001,9 +1001,9 @@ "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" }, "axios": { - "version": "0.19.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.1.tgz", - "integrity": "sha512-Yl+7nfreYKaLRvAvjNPkvfjnQHJM1yLBY3zhqAwcJSwR/6ETkanUgylgtIvkvz0xJ+p/vZuNw8X7Hnb7Whsbpw==", + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz", + "integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==", "requires": { "follow-redirects": "1.5.10" } @@ -3987,9 +3987,9 @@ } }, "file-type": { - "version": "13.1.1", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-13.1.1.tgz", - "integrity": "sha512-HEb3tepyq8KzKSFEGMJSIxqn8uC1n3AM8OKME5+BIgq0bErRzcDPOdmnyPKtfjStSpIvuk0Rle8mvuG4824caQ==", + "version": "13.1.2", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-13.1.2.tgz", + "integrity": "sha512-NiHXbmclwHN38eHZfRklosbm7/W+1yacDzRCyddd0NiyuJUArQDmzJ8GPSFJGl82+I59u7sNGfcAVnJsfXJb8A==", "requires": { "readable-web-to-node-stream": "^2.0.0", "strtok3": "^5.0.2", diff --git a/package.json b/package.json index fa5dbe9f1..292149089 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ }, "dependencies": { "async-mutex": "0.1.4", - "axios": "0.19.1", + "axios": "0.19.2", "body-parser": "1.19.0", "cls-hooked": "4.2.2", "commonmark": "0.29.1", @@ -37,7 +37,7 @@ "electron-window-state": "5.0.3", "express": "4.17.1", "express-session": "1.17.0", - "file-type": "13.1.1", + "file-type": "13.1.2", "fs-extra": "8.1.0", "helmet": "3.21.2", "html": "1.0.0", diff --git a/src/public/javascripts/services/entrypoints.js b/src/public/javascripts/services/entrypoints.js index 6e987ce33..01f092c34 100644 --- a/src/public/javascripts/services/entrypoints.js +++ b/src/public/javascripts/services/entrypoints.js @@ -41,7 +41,6 @@ export default class Entrypoints extends Component { } } - findInTextListener() { if (utils.isElectron()) { const {remote} = require('electron'); @@ -113,4 +112,68 @@ export default class Entrypoints extends Component { copyWithoutFormattingListener() { utils.copySelectionToClipboard(); } -} \ No newline at end of file + + toggleFullscreenListener() { + if (utils.isElectron()) { + const win = require('electron').remote.getCurrentWindow(); + + if (win.isFullScreenable()) { + win.setFullScreen(!win.isFullScreen()); + } + } + else { + // outside of electron this is handled by the browser + this.$widget.find(".toggle-fullscreen-button").hide(); + } + } + + toggleZenModeListener() { + if (!this.zenModeActive) { + $(".hide-in-zen-mode,.gutter").addClass("hidden-by-zen-mode"); + $("#container").addClass("zen-mode"); + this.zenModeActive = true; + } + else { + // not hiding / showing explicitly since element might be hidden also for other reasons + $(".hide-in-zen-mode,.gutter").removeClass("hidden-by-zen-mode"); + $("#container").removeClass("zen-mode"); + this.zenModeActive = false; + } + } + + reloadFrontendAppListener() { + utils.reloadApp(); + } + + logoutListener() { + const $logoutForm = $('
') + .append($(``)); + + $("body").append($logoutForm); + $logoutForm.trigger('submit'); + } + + showOptionsListener() { + import("../dialogs/options.js").then(d => d.showDialog()) + } + + showHelpListener() { + import("../dialogs/help.js").then(d => d.showDialog()) + } + + showSQLConsoleListener() { + import("../dialogs/sql_console.js").then(d => d.showDialog()) + } + + showBackendLogListener() { + import("../dialogs/backend_log.js").then(d => d.showDialog()) + } + + backInNoteHistoryListener() { + window.history.back(); + } + + forwardInNoteHistoryListener() { + window.history.forward(); + } +} diff --git a/src/public/javascripts/widgets/global_menu.js b/src/public/javascripts/widgets/global_menu.js index 9ee4429a4..5bbaecd18 100644 --- a/src/public/javascripts/widgets/global_menu.js +++ b/src/public/javascripts/widgets/global_menu.js @@ -3,12 +3,6 @@ import keyboardActionService from "../services/keyboard_actions.js"; import utils from "../services/utils.js"; import syncService from "../services/sync.js"; -const OPTIONS = "../dialogs/options.js"; -const SQL_CONSOLE = "../dialogs/sql_console.js"; -const BACKEND_LOG = "../dialogs/backend_log.js"; -const HELP = "../dialogs/help.js"; -const ABOUT = "../dialogs/about.js"; - const TPL = ` `; @@ -24,13 +24,6 @@ export default class HistoryNavigationWidget extends BasicWidget { this.$widget = $(TPL); - this.$widget.find(".history-back-button").on('click', window.history.back); - this.$widget.find(".history-forward-button").on('click', window.history.forward); - - // FIXME: does not belong here - keyboardActionService.setGlobalActionHandler("BackInNoteHistory", window.history.back); - keyboardActionService.setGlobalActionHandler("ForwardInNoteHistory", window.history.forward); - return this.$widget; } } \ No newline at end of file