1- import { MolangAutocomplete } from './molang'
1+ import { MolangAutocomplete } from './molang' ;
22
33interface MolangEditorOptions {
4- autocomplete_context : MolangAutocomplete . Context
5- text : string
4+ autocomplete_context : MolangAutocomplete . Context ;
5+ text : string ;
66}
77export function openMolangEditor ( options : MolangEditorOptions , callback : ( result : string ) => void ) {
88 interface VueData {
9- text : string
9+ text : string ;
1010 }
1111 let dialog = new Dialog ( 'expression_editor' , {
1212 title : 'menu.text_edit.expression_editor' ,
@@ -19,14 +19,14 @@ export function openMolangEditor(options: MolangEditorOptions, callback: (result
1919 } ,
2020 methods : {
2121 prettyPrint ( this : VueData ) {
22- this . text = this . text . replace ( / ; \s * (? ! \n ) / g, ';\n' )
22+ this . text = this . text . replace ( / ; \s * (? ! \n ) / g, ';\n' ) ;
2323 } ,
2424 minify ( this : VueData ) {
25- this . text = this . text . replace ( / \n / g, '' ) . replace ( / \s { 2 , } / g, ' ' )
25+ this . text = this . text . replace ( / \n / g, '' ) . replace ( / \s { 2 , } / g, ' ' ) ;
2626 } ,
2727 findReplace ( this : VueData ) {
28- this
29- let scope = this
28+ this ;
29+ let scope = this ;
3030 new Dialog ( {
3131 id : 'find_replace' ,
3232 title : 'action.find_replace' ,
@@ -40,23 +40,23 @@ export function openMolangEditor(options: MolangEditorOptions, callback: (result
4040 } ,
4141 } ,
4242 onConfirm ( form ) {
43- if ( ! form . find ) return
43+ if ( ! form . find ) return ;
4444 function replace ( text : string ) {
4545 if ( form . regex ) {
46- let regex = new RegExp ( form . find , 'g' )
47- return text . replace ( regex , form . replace )
46+ let regex = new RegExp ( form . find , 'g' ) ;
47+ return text . replace ( regex , form . replace ) ;
4848 } else {
49- return text . split ( form . find ) . join ( form . replace )
49+ return text . split ( form . find ) . join ( form . replace ) ;
5050 }
5151 }
52- scope . text = replace ( scope . text )
52+ scope . text = replace ( scope . text ) ;
5353 } ,
54- } ) . show ( )
54+ } ) . show ( ) ;
5555 } ,
5656 autocomplete ( text : string , position : number ) {
57- if ( Settings . get ( 'autocomplete_code' ) == false ) return [ ]
58- let test = options . autocomplete_context . autocomplete ( text , position )
59- return test
57+ if ( Settings . get ( 'autocomplete_code' ) == false ) return [ ] ;
58+ let test = options . autocomplete_context . autocomplete ( text , position ) ;
59+ return test ;
6060 } ,
6161 } ,
6262 template : `
@@ -81,18 +81,18 @@ export function openMolangEditor(options: MolangEditorOptions, callback: (result
8181 onOpen ( ) {
8282 let element = document . querySelector (
8383 '#expression_editor_prism.molang_input'
84- ) as HTMLElement
85- element . style . height = dialog . object . clientHeight - 50 + 'px'
84+ ) as HTMLElement ;
85+ element . style . height = dialog . object . clientHeight - 50 + 'px' ;
8686 } ,
8787 onResize ( ) {
8888 let element = document . querySelector (
8989 '#expression_editor_prism.molang_input'
90- ) as HTMLElement
91- element . style . height = dialog . object . clientHeight - 50 + 'px'
90+ ) as HTMLElement ;
91+ element . style . height = dialog . object . clientHeight - 50 + 'px' ;
9292 } ,
9393 onConfirm ( ) {
94- callback ( dialog . content_vue . $data . text )
94+ callback ( dialog . content_vue . $data . text ) ;
9595 } ,
96- } )
97- dialog . show ( )
96+ } ) ;
97+ dialog . show ( ) ;
9898}
0 commit comments