@@ -686,6 +686,9 @@ export class PreviewModel implements ViewModel {
686686 }
687687
688688 getSettingsMenuItems ( ) : ContextMenuItem [ ] {
689+ const defaultFontSize = globalStore . get ( getSettingsKeyAtom ( "editor:fontsize" ) ) ?? 12 ;
690+ const blockData = globalStore . get ( this . blockAtom ) ;
691+ const overrideFontSize = blockData ?. meta ?. [ "editor:fontsize" ] ;
689692 const menuItems : ContextMenuItem [ ] = [ ] ;
690693 menuItems . push ( {
691694 label : "Copy Full Path" ,
@@ -716,6 +719,37 @@ export class PreviewModel implements ViewModel {
716719 await navigator . clipboard . writeText ( fileInfo . name ) ;
717720 } ) ,
718721 } ) ;
722+ menuItems . push ( { type : "separator" } ) ;
723+ const fontSizeSubMenu : ContextMenuItem [ ] = [ 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 ] . map (
724+ ( fontSize : number ) => {
725+ return {
726+ label : fontSize . toString ( ) + "px" ,
727+ type : "checkbox" ,
728+ checked : overrideFontSize == fontSize ,
729+ click : ( ) => {
730+ RpcApi . SetMetaCommand ( TabRpcClient , {
731+ oref : WOS . makeORef ( "block" , this . blockId ) ,
732+ meta : { "editor:fontsize" : fontSize } ,
733+ } ) ;
734+ } ,
735+ } ;
736+ }
737+ ) ;
738+ fontSizeSubMenu . unshift ( {
739+ label : "Default (" + defaultFontSize + "px)" ,
740+ type : "checkbox" ,
741+ checked : overrideFontSize == null ,
742+ click : ( ) => {
743+ RpcApi . SetMetaCommand ( TabRpcClient , {
744+ oref : WOS . makeORef ( "block" , this . blockId ) ,
745+ meta : { "editor:fontsize" : null } ,
746+ } ) ;
747+ } ,
748+ } ) ;
749+ menuItems . push ( {
750+ label : "Editor Font Size" ,
751+ submenu : fontSizeSubMenu ,
752+ } ) ;
719753 const finfo = jotaiLoadableValue ( globalStore . get ( this . loadableFileInfo ) , null ) ;
720754 addOpenMenuItems ( menuItems , globalStore . get ( this . connectionImmediate ) , finfo ) ;
721755 const loadableSV = globalStore . get ( this . loadableSpecializedView ) ;
0 commit comments