@@ -65,6 +65,36 @@ export default class AdmonitionSetting extends PluginSettingTab {
6565 await this . plugin . saveSettings ( ) ;
6666 } ) ;
6767 } ) ;
68+ new Setting ( containerEl )
69+ . setName ( "Collapsible by Default" )
70+ . setDesc (
71+ "All admonitions will be collapsible by default. Use collapse: none to prevent."
72+ )
73+ . addToggle ( ( t ) => {
74+ t . setValue ( this . plugin . data . autoCollapse ) . onChange (
75+ async ( v ) => {
76+ this . plugin . data . autoCollapse = v ;
77+ this . display ( ) ;
78+ await this . plugin . saveSettings ( ) ;
79+ }
80+ ) ;
81+ } ) ;
82+ if ( this . plugin . data . autoCollapse ) {
83+ new Setting ( containerEl )
84+ . setName ( "Default Collapse Type" )
85+ . setDesc (
86+ "Collapsible admonitions will be either opened or closed."
87+ )
88+ . addDropdown ( ( d ) => {
89+ d . addOption ( "open" , "open" ) ;
90+ d . addOption ( "closed" , "closed" ) ;
91+ d . setValue ( this . plugin . data . defaultCollapseType ) ;
92+ d . onChange ( async ( v ) => {
93+ this . plugin . data . defaultCollapseType = v ;
94+ await this . plugin . saveSettings ( ) ;
95+ } ) ;
96+ } ) ;
97+ }
6898 new Setting ( containerEl )
6999 . setName ( "Add Copy Button" )
70100 . setDesc ( "Add a 'copy content' button to admonitions." )
@@ -291,7 +321,6 @@ class SettingsModal extends Modal {
291321 modal . onClose = validate ;
292322
293323 text . inputEl . onblur = validate ;
294-
295324 } ) ;
296325
297326 const desc = iconSetting . descEl . createDiv ( ) ;
0 commit comments