File tree Expand file tree Collapse file tree
renderer/components/editor Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -163,6 +163,24 @@ const editorMenuItems: MenuConfig[] = [
163163 accelerator : 'Shift+CommandOrControl+F' ,
164164 click : ( ) => send ( 'main-menu:format' ) ,
165165 } ,
166+ {
167+ type : 'separator' ,
168+ } ,
169+ {
170+ label : i18n . t ( 'menu:editor.fontSizeIncrease' ) ,
171+ accelerator : 'CommandOrControl+=' ,
172+ click : ( ) => send ( 'main-menu:font-size-increase' ) ,
173+ } ,
174+ {
175+ label : i18n . t ( 'menu:editor.fontSizeDecrease' ) ,
176+ accelerator : 'CommandOrControl+-' ,
177+ click : ( ) => send ( 'main-menu:font-size-decrease' ) ,
178+ } ,
179+ {
180+ label : i18n . t ( 'menu:editor.fontSizeReset' ) ,
181+ accelerator : 'CommandOrControl+0' ,
182+ click : ( ) => send ( 'main-menu:font-size-reset' ) ,
183+ } ,
166184]
167185
168186const menuItems : MenuItemConstructorOptions [ ] = [
Original file line number Diff line number Diff line change @@ -11,6 +11,9 @@ type MainMenuAction =
1111 | 'new-fragment'
1212 | 'new-snippet'
1313 | 'open-dialog'
14+ | 'font-size-increase'
15+ | 'font-size-decrease'
16+ | 'font-size-reset'
1417
1518type DBAction = 'relaod' | 'move' | 'migrate' | 'clear'
1619type SystemAction = 'reload'
Original file line number Diff line number Diff line change @@ -86,6 +86,18 @@ async function init() {
8686
8787 editor .on (' scroll' , hideScrollbar )
8888
89+ ipc .on (' main-menu:font-size-increase' , () => {
90+ settings .fontSize ++
91+ })
92+
93+ ipc .on (' main-menu:font-size-decrease' , () => {
94+ settings .fontSize --
95+ })
96+
97+ ipc .on (' main-menu:font-size-reset' , () => {
98+ settings .fontSize = 13
99+ })
100+
89101 watch (selectedSnippetContent , (v ) => {
90102 nextTick (() => {
91103 setValue (v ?.value || ' ' )
@@ -108,6 +120,15 @@ async function init() {
108120 editor ?.setOption (' theme' , ' neo' )
109121 }
110122 })
123+
124+ watch (
125+ () => settings .fontSize ,
126+ () => {
127+ nextTick (() => {
128+ editor ?.refresh ()
129+ })
130+ },
131+ )
111132}
112133
113134function setValue(value : string , programmatic = true ) {
You can’t perform that action at this time.
0 commit comments