@@ -9,7 +9,7 @@ import { Message, MessageLoop } from '@lumino/messaging';
99import { PromiseDelegate } from '@lumino/coreutils' ;
1010import { ArrayExt } from '@lumino/algorithm' ;
1111
12- import { ICodeSnippet } from './CodeSnippetService' ;
12+ import { ICodeSnippet , CodeSnippetService } from './CodeSnippetService' ;
1313
1414/**
1515 * The class name for preview box
@@ -46,6 +46,7 @@ export class Preview<T> extends Widget {
4646 editor : CodeEditor . IEditor ;
4747 codeSnippet : ICodeSnippet ;
4848 editorServices : IEditorServices ;
49+ codeSnippetService : CodeSnippetService ;
4950 private _hasRefreshedSinceAttach : boolean ;
5051 constructor (
5152 options : Partial < Preview . IOptions < T > > = { } ,
@@ -57,6 +58,7 @@ export class Preview<T> extends Widget {
5758 this . _id = options . id ;
5859 this . codeSnippet = options . codeSnippet ;
5960 this . editorServices = editorServices ;
61+ this . codeSnippetService = CodeSnippetService . getCodeSnippetService ( ) ;
6062 this . addClass ( PREVIEW_CLASS ) ;
6163 const layout = ( this . layout = new PanelLayout ( ) ) ;
6264 const content = new Panel ( ) ;
@@ -157,9 +159,21 @@ export class Preview<T> extends Widget {
157159 const getMimeTypeByLanguage = this . editorServices . mimeTypeService
158160 . getMimeTypeByLanguage ;
159161
162+ let previewFontSize = this . codeSnippetService . settings . get (
163+ 'snippetPreviewFontSize'
164+ ) . composite as number ;
165+ if (
166+ this . codeSnippetService . settings . get ( 'snippetPreviewFontSize' ) . user !==
167+ undefined
168+ ) {
169+ previewFontSize = this . codeSnippetService . settings . get (
170+ 'snippetPreviewFontSize'
171+ ) . user as number ;
172+ }
173+
160174 this . editor = editorFactory ( {
161175 host : document . getElementById ( PREVIEW_CONTENT + this . _id ) ,
162- config : { readOnly : true , fontSize : 3 } ,
176+ config : { readOnly : true , fontSize : previewFontSize } ,
163177 model : new CodeEditor . Model ( {
164178 value : this . codeSnippet . code . join ( '\n' ) ,
165179 mimeType : getMimeTypeByLanguage ( {
0 commit comments