fontZoom.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*---------------------------------------------------------------------------------------------
  2. * Copyright (c) Microsoft Corporation. All rights reserved.
  3. * Licensed under the MIT License. See License.txt in the project root for license information.
  4. *--------------------------------------------------------------------------------------------*/
  5. import { EditorAction, registerEditorAction } from '../../browser/editorExtensions.js';
  6. import { EditorZoom } from '../../common/config/editorZoom.js';
  7. import * as nls from '../../../nls.js';
  8. class EditorFontZoomIn extends EditorAction {
  9. constructor() {
  10. super({
  11. id: 'editor.action.fontZoomIn',
  12. label: nls.localize('EditorFontZoomIn.label', "Editor Font Zoom In"),
  13. alias: 'Editor Font Zoom In',
  14. precondition: undefined
  15. });
  16. }
  17. run(accessor, editor) {
  18. EditorZoom.setZoomLevel(EditorZoom.getZoomLevel() + 1);
  19. }
  20. }
  21. class EditorFontZoomOut extends EditorAction {
  22. constructor() {
  23. super({
  24. id: 'editor.action.fontZoomOut',
  25. label: nls.localize('EditorFontZoomOut.label', "Editor Font Zoom Out"),
  26. alias: 'Editor Font Zoom Out',
  27. precondition: undefined
  28. });
  29. }
  30. run(accessor, editor) {
  31. EditorZoom.setZoomLevel(EditorZoom.getZoomLevel() - 1);
  32. }
  33. }
  34. class EditorFontZoomReset extends EditorAction {
  35. constructor() {
  36. super({
  37. id: 'editor.action.fontZoomReset',
  38. label: nls.localize('EditorFontZoomReset.label', "Editor Font Zoom Reset"),
  39. alias: 'Editor Font Zoom Reset',
  40. precondition: undefined
  41. });
  42. }
  43. run(accessor, editor) {
  44. EditorZoom.setZoomLevel(0);
  45. }
  46. }
  47. registerEditorAction(EditorFontZoomIn);
  48. registerEditorAction(EditorFontZoomOut);
  49. registerEditorAction(EditorFontZoomReset);