@@ -21,7 +21,7 @@ const baseOptions = {
2121  automaticLayout : true , 
2222} ; 
2323
24- function  getEditorconfig ( input )  { 
24+ function  getEditorconfig ( input :  HTMLInputElement )  { 
2525  try  { 
2626    return  JSON . parse ( input . getAttribute ( 'data-editorconfig' ) ) ; 
2727  }  catch  { 
@@ -58,7 +58,7 @@ function exportEditor(editor) {
5858  if  ( ! window . codeEditors . includes ( editor ) )  window . codeEditors . push ( editor ) ; 
5959} 
6060
61- export  async  function  createMonaco ( textarea ,  filename ,  editorOpts )  { 
61+ export  async  function  createMonaco ( textarea :  HTMLTextAreaElement ,  filename :  string ,  editorOpts :  Record < string ,   any > )  { 
6262  const  monaco  =  await  import ( /* webpackChunkName: "monaco" */ 'monaco-editor' ) ; 
6363
6464  initLanguages ( monaco ) ; 
@@ -72,7 +72,7 @@ export async function createMonaco(textarea, filename, editorOpts) {
7272  // https://github.com/microsoft/monaco-editor/issues/2427 
7373  // also, monaco can only parse 6-digit hex colors, so we convert the colors to that format 
7474  const  styles  =  window . getComputedStyle ( document . documentElement ) ; 
75-   const  getColor  =  ( name )  =>  tinycolor ( styles . getPropertyValue ( name ) . trim ( ) ) . toString ( 'hex6' ) ; 
75+   const  getColor  =  ( name :  string )  =>  tinycolor ( styles . getPropertyValue ( name ) . trim ( ) ) . toString ( 'hex6' ) ; 
7676
7777  monaco . editor . defineTheme ( 'gitea' ,  { 
7878    base : isDarkTheme ( )  ? 'vs-dark'  : 'vs' , 
@@ -127,13 +127,13 @@ export async function createMonaco(textarea, filename, editorOpts) {
127127  return  { monaco,  editor} ; 
128128} 
129129
130- function  getFileBasedOptions ( filename ,  lineWrapExts )  { 
130+ function  getFileBasedOptions ( filename :  string ,  lineWrapExts :  string [ ] )  { 
131131  return  { 
132132    wordWrap : ( lineWrapExts  ||  [ ] ) . includes ( extname ( filename ) )  ? 'on'  : 'off' , 
133133  } ; 
134134} 
135135
136- function  togglePreviewDisplay ( previewable )  { 
136+ function  togglePreviewDisplay ( previewable :  boolean )  { 
137137  const  previewTab  =  document . querySelector ( 'a[data-tab="preview"]' ) ; 
138138  if  ( ! previewTab )  return ; 
139139
@@ -152,7 +152,7 @@ function togglePreviewDisplay(previewable) {
152152  } 
153153} 
154154
155- export  async  function  createCodeEditor ( textarea ,  filenameInput )  { 
155+ export  async  function  createCodeEditor ( textarea :  HTMLTextAreaElement ,  filenameInput :  HTMLInputElement )  { 
156156  const  filename  =  basename ( filenameInput . value ) ; 
157157  const  previewableExts  =  new  Set ( ( textarea . getAttribute ( 'data-previewable-extensions' )  ||  '' ) . split ( ',' ) ) ; 
158158  const  lineWrapExts  =  ( textarea . getAttribute ( 'data-line-wrap-extensions' )  ||  '' ) . split ( ',' ) ; 
@@ -177,10 +177,10 @@ export async function createCodeEditor(textarea, filenameInput) {
177177  return  editor ; 
178178} 
179179
180- function  getEditorConfigOptions ( ec )  { 
180+ function  getEditorConfigOptions ( ec :  Record < string ,   any > ) :  Record < string ,   any >  { 
181181  if  ( ! isObject ( ec ) )  return  { } ; 
182182
183-   const  opts  =  { } ; 
183+   const  opts :  Record < string ,   any >  =  { } ; 
184184  opts . detectIndentation  =  ! ( 'indent_style'  in  ec )  ||  ! ( 'indent_size'  in  ec ) ; 
185185  if  ( 'indent_size'  in  ec )  opts . indentSize  =  Number ( ec . indent_size ) ; 
186186  if  ( 'tab_width'  in  ec )  opts . tabSize  =  Number ( ec . tab_width )  ||  opts . indentSize ; 
0 commit comments