Skip to content

Build your personal knowledge base with Trilium Notes

keyboard based zooming in electron, fixes #10

azivner27f12a018670
diff --git a/public/javascripts/init.js b/public/javascripts/init.js
index bb09469114..2d8934b5e7 100644
--- a/public/javascripts/init.js
+++ b/public/javascripts/init.js
@@ -90,6 +90,28 @@ $(document).bind('keydown', "ctrl+shift+down", () => {
return false;
});
+$(document).bind('keydown', 'ctrl+-', () => {
+ if (isElectron()) {
+ const webFrame = require('electron').webFrame;
+
+ if (webFrame.getZoomFactor() > 0.2) {
+ webFrame.setZoomFactor(webFrame.getZoomFactor() - 0.1);
+ }
+
+ return false;
+ }
+});
+
+$(document).bind('keydown', 'ctrl+=', () => {
+ if (isElectron()) {
+ const webFrame = require('electron').webFrame;
+
+ webFrame.setZoomFactor(webFrame.getZoomFactor() + 0.1);
+
+ return false;
+ }
+});
+
$("#note-title").bind('keydown', 'return', () => $("#note-detail").focus());
$(window).on('beforeunload', () => {