aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorLibravatar Vijay A <avijayr@protonmail.com>2021-09-06 20:32:08 +0530
committerLibravatar Vijay A <avijayr@protonmail.com>2021-09-06 22:00:46 +0530
commit54f7533673d7ada520ee25c2a8ecd6feab28252a (patch)
tree846ab4541218a5965c28d68bd03ac19f6b2cdf7b /src/lib
parentFix zoom actions executed on another services (#1875) (diff)
downloadferdium-app-54f7533673d7ada520ee25c2a8ecd6feab28252a.tar.gz
ferdium-app-54f7533673d7ada520ee25c2a8ecd6feab28252a.tar.zst
ferdium-app-54f7533673d7ada520ee25c2a8ecd6feab28252a.zip
Revert "refactor: trying to fix zoom in/out being sticky for the last active service when started up"
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Menu.js21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/lib/Menu.js b/src/lib/Menu.js
index 01bdb0bec..8a5af56fb 100644
--- a/src/lib/Menu.js
+++ b/src/lib/Menu.js
@@ -28,8 +28,6 @@ import { workspaceStore } from '../features/workspaces/index';
28import apiBase, { termsBase } from '../api/apiBase'; 28import apiBase, { termsBase } from '../api/apiBase';
29import { openExternalUrl } from '../helpers/url-helpers'; 29import { openExternalUrl } from '../helpers/url-helpers';
30 30
31const debug = require('debug')('Ferdi:Menu');
32
33const menuItems = defineMessages({ 31const menuItems = defineMessages({
34 edit: { 32 edit: {
35 id: 'menu.edit', 33 id: 'menu.edit',
@@ -323,8 +321,7 @@ const menuItems = defineMessages({
323}); 321});
324 322
325function getActiveService() { 323function getActiveService() {
326 // TODO: How is this different from `this.actions.service.active` which is in the ServicesStore class? 324 return window.ferdi.stores.services.active;
327 return this.stores.services.active;
328} 325}
329 326
330const _titleBarTemplateFactory = (intl, locked) => [ 327const _titleBarTemplateFactory = (intl, locked) => [
@@ -407,8 +404,6 @@ const _titleBarTemplateFactory = (intl, locked) => [
407 channel: 'find-in-page', 404 channel: 'find-in-page',
408 args: {}, 405 args: {},
409 }); 406 });
410 } else {
411 debug('No service is active');
412 } 407 }
413 }, 408 },
414 }, 409 },
@@ -436,21 +431,29 @@ const _titleBarTemplateFactory = (intl, locked) => [
436 label: intl.formatMessage(menuItems.resetZoom), 431 label: intl.formatMessage(menuItems.resetZoom),
437 accelerator: `${cmdOrCtrlShortcutKey()}+0`, 432 accelerator: `${cmdOrCtrlShortcutKey()}+0`,
438 click() { 433 click() {
439 this.actions.service.zoomResetForActiveService(); 434 getActiveService().webview.setZoomLevel(0);
440 }, 435 },
441 }, 436 },
442 { 437 {
443 label: intl.formatMessage(menuItems.zoomIn), 438 label: intl.formatMessage(menuItems.zoomIn),
444 accelerator: `${cmdOrCtrlShortcutKey()}+plus`, 439 accelerator: `${cmdOrCtrlShortcutKey()}+plus`,
445 click() { 440 click() {
446 this.actions.service.zoomInForActiveService(); 441 const activeService = getActiveService().webview;
442 const level = activeService.getZoomLevel();
443
444 // level 9 =~ +300% and setZoomLevel wouldnt zoom in further
445 if (level < 9) activeService.setZoomLevel(level + 1);
447 }, 446 },
448 }, 447 },
449 { 448 {
450 label: intl.formatMessage(menuItems.zoomOut), 449 label: intl.formatMessage(menuItems.zoomOut),
451 accelerator: `${cmdOrCtrlShortcutKey()}+-`, 450 accelerator: `${cmdOrCtrlShortcutKey()}+-`,
452 click() { 451 click() {
453 this.actions.service.zoomOutForActiveService(); 452 const activeService = getActiveService().webview;
453 const level = activeService.getZoomLevel();
454
455 // level -9 =~ -50% and setZoomLevel wouldnt zoom out further
456 if (level > -9) activeService.setZoomLevel(level - 1);
454 }, 457 },
455 }, 458 },
456 { 459 {