diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/Menu.js | 21 |
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'; | |||
28 | import apiBase, { termsBase } from '../api/apiBase'; | 28 | import apiBase, { termsBase } from '../api/apiBase'; |
29 | import { openExternalUrl } from '../helpers/url-helpers'; | 29 | import { openExternalUrl } from '../helpers/url-helpers'; |
30 | 30 | ||
31 | const debug = require('debug')('Ferdi:Menu'); | ||
32 | |||
33 | const menuItems = defineMessages({ | 31 | const 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 | ||
325 | function getActiveService() { | 323 | function 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 | ||
330 | const _titleBarTemplateFactory = (intl, locked) => [ | 327 | const _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 | { |