@@ -32,7 +32,7 @@ export const DEFAULT_SETTINGS: Settings = {
32
32
syntax_highlighting : true ,
33
33
syntax_highlighting_mobile : false ,
34
34
enabled_templates_hotkeys : [ "" ] ,
35
- startup_templates : [ "" ]
35
+ startup_templates : [ "" ] ,
36
36
} ;
37
37
38
38
export interface Settings {
@@ -122,8 +122,8 @@ export class TemplaterSettingTab extends PluginSettingTab {
122
122
const mobileDesc = document . createDocumentFragment ( ) ;
123
123
mobileDesc . append (
124
124
"Adds syntax highlighting for Templater commands in edit mode on " +
125
- "mobile. Use with caution: this may break live preview on mobile " +
126
- "platforms."
125
+ "mobile. Use with caution: this may break live preview on mobile " +
126
+ "platforms."
127
127
) ;
128
128
129
129
new Setting ( this . containerEl )
@@ -471,7 +471,8 @@ export class TemplaterSettingTab extends PluginSettingTab {
471
471
) ;
472
472
473
473
new Setting ( this . containerEl ) . addButton ( ( button : ButtonComponent ) => {
474
- button . setButtonText ( "Add new folder template" )
474
+ button
475
+ . setButtonText ( "Add new folder template" )
475
476
. setTooltip ( "Add additional folder template" )
476
477
. setCta ( )
477
478
. onClick ( ( ) => {
@@ -486,13 +487,21 @@ export class TemplaterSettingTab extends PluginSettingTab {
486
487
}
487
488
488
489
add_file_templates_setting ( ) : void {
489
- this . containerEl . createEl ( "h2" , { text : "File Regex Templates" } ) ;
490
+ new Setting ( this . containerEl )
491
+ . setName ( "File Regex Templates" )
492
+ . setHeading ( ) ;
490
493
491
494
const descHeading = document . createDocumentFragment ( ) ;
492
495
descHeading . append (
493
496
"File Regex Templates are triggered when a new " ,
494
497
descHeading . createEl ( "strong" , { text : "empty" } ) ,
495
- " file is created that matches one of them. Templater will fill the empty file with the specified template."
498
+ " file is created that matches one of them. Templater will fill the empty file with the specified template." ,
499
+ descHeading . createEl ( "br" ) ,
500
+ "The first match from the top is used, so the order of the rules is important." ,
501
+ descHeading . createEl ( "br" ) ,
502
+ "Use " ,
503
+ descHeading . createEl ( "code" , { text : ".*" } ) ,
504
+ " as a final catch-all, if you need it."
496
505
) ;
497
506
498
507
new Setting ( this . containerEl ) . setDesc ( descHeading ) ;
@@ -525,26 +534,6 @@ export class TemplaterSettingTab extends PluginSettingTab {
525
534
return ;
526
535
}
527
536
528
- new Setting ( this . containerEl )
529
- . setName ( "Add New" )
530
- . setDesc (
531
- "Add new file regex. The first match from the top is used, so the order of the rules is important. Use `.*` as a final catch-all, if you need it."
532
- )
533
- . addButton ( ( button : ButtonComponent ) => {
534
- button
535
- . setTooltip ( "Add additional file regex" )
536
- . setButtonText ( "+" )
537
- . setCta ( )
538
- . onClick ( ( ) => {
539
- this . plugin . settings . file_templates . push ( {
540
- regex : "" ,
541
- template : "" ,
542
- } ) ;
543
- this . plugin . save_settings ( ) ;
544
- this . display ( ) ;
545
- } ) ;
546
- } ) ;
547
-
548
537
this . plugin . settings . file_templates . forEach ( ( file_template , index ) => {
549
538
const s = new Setting ( this . containerEl )
550
539
. addText ( ( cb ) => {
@@ -615,6 +604,21 @@ export class TemplaterSettingTab extends PluginSettingTab {
615
604
} ) ;
616
605
s . infoEl . remove ( ) ;
617
606
} ) ;
607
+
608
+ new Setting ( this . containerEl ) . addButton ( ( button : ButtonComponent ) => {
609
+ button
610
+ . setButtonText ( "Add new file regex" )
611
+ . setTooltip ( "Add additional file regex" )
612
+ . setCta ( )
613
+ . onClick ( ( ) => {
614
+ this . plugin . settings . file_templates . push ( {
615
+ regex : "" ,
616
+ template : "" ,
617
+ } ) ;
618
+ this . plugin . save_settings ( ) ;
619
+ this . display ( ) ;
620
+ } ) ;
621
+ } ) ;
618
622
}
619
623
620
624
add_startup_templates_setting ( ) : void {
@@ -691,7 +695,9 @@ export class TemplaterSettingTab extends PluginSettingTab {
691
695
}
692
696
693
697
add_user_script_functions_setting ( ) : void {
694
- new Setting ( this . containerEl ) . setName ( "User script functions" ) . setHeading ( ) ;
698
+ new Setting ( this . containerEl )
699
+ . setName ( "User script functions" )
700
+ . setHeading ( ) ;
695
701
696
702
let desc = document . createDocumentFragment ( ) ;
697
703
desc . append (
@@ -776,7 +782,9 @@ export class TemplaterSettingTab extends PluginSettingTab {
776
782
} ) ,
777
783
"It can be dangerous to execute arbitrary system commands from untrusted sources. Only run system commands that you understand, from trusted sources."
778
784
) ;
779
- new Setting ( this . containerEl ) . setName ( "User system command functions" ) . setHeading ( ) ;
785
+ new Setting ( this . containerEl )
786
+ . setName ( "User system command functions" )
787
+ . setHeading ( ) ;
780
788
781
789
new Setting ( this . containerEl )
782
790
. setName ( "Enable user system command functions" )
@@ -946,21 +954,25 @@ export class TemplaterSettingTab extends PluginSettingTab {
946
954
. setName ( "Donate" )
947
955
. setDesc (
948
956
"If you like this Plugin, consider donating to support continued development."
949
- )
950
-
957
+ ) ;
951
958
952
959
const a1 = document . createElement ( "a" ) ;
953
960
a1 . setAttribute ( "href" , "https://github.com/sponsors/silentvoid13" ) ;
954
961
a1 . addClass ( "templater_donating" ) ;
955
962
const img1 = document . createElement ( "img" ) ;
956
- img1 . src = "https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86" ;
963
+ img1 . src =
964
+ "https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86" ;
957
965
a1 . appendChild ( img1 ) ;
958
966
959
967
const a2 = document . createElement ( "a" ) ;
960
- a2 . setAttribute ( "href" , "https://www.paypal.com/donate?hosted_button_id=U2SRGAFYXT32Q" ) ;
968
+ a2 . setAttribute (
969
+ "href" ,
970
+ "https://www.paypal.com/donate?hosted_button_id=U2SRGAFYXT32Q"
971
+ ) ;
961
972
a2 . addClass ( "templater_donating" ) ;
962
973
const img2 = document . createElement ( "img" ) ;
963
- img2 . src = "https://img.shields.io/badge/paypal-silentvoid13-yellow?style=social&logo=paypal" ;
974
+ img2 . src =
975
+ "https://img.shields.io/badge/paypal-silentvoid13-yellow?style=social&logo=paypal" ;
964
976
a2 . appendChild ( img2 ) ;
965
977
966
978
s . settingEl . appendChild ( a1 ) ;
0 commit comments