Version 0.6.1 of the editor allows us to Ctrl+MouseScroll to zoom in/out.
Is there a way to programmatically zoom in the editor, so as to bind the keys (CtrlCmd + NUMPAD_ADD) with the editor zoom action?
Also, is there a way to get the current zoom level, so we can store it between sessions?
monaco-editor npm version: 0.6.1
Browser: Chrome
OS: Windows
ctrl + mouse scroll simply updates the fontSize option (leaving the lineHeight unconfigured, which means lineHeight will be computed based off fontSize). So you can simply call editor.updateOptions({ fontSize: newFontSize }) independent of ctrl + mouse scroll.
Great! Would onDidLayoutChange be the best handler to store the font size when it is updated by a ctrl+scroll zoom in/out ?
I think there might be a bug here. If I zoom in using Ctrl+Scroll it updates the fontSize but does not reset the zoomLevel when I'm done, so if I then call updateOptions with a specific font size, it is multiplied by the zoomLevel in computeInternalOptions:
var editorZoomLevelMultiplier = 1 + (exports.EditorZoom.getZoomLevel() * 0.1);
Is there some way to reset the zoom level, that could be a possible workaround.
I'm sorry, at this time, there's no API exposed to EditorZoom.
@samelhusseini:
You can call
editor.trigger('keyboard', 'editor.action.fontZoomOut', {});
or
editor.trigger('keyboard', 'editor.action.fontZoomIn', {});
to programmatically zoom out/zoom in the editor.