File tree Expand file tree Collapse file tree 3 files changed +318
-302
lines changed
Expand file tree Collapse file tree 3 files changed +318
-302
lines changed Original file line number Diff line number Diff line change @@ -386,7 +386,8 @@ table tr>*:last-child {
386386}
387387
388388.collapsible > label i {
389- transition : .2s ease transform
389+ transition : .2s ease transform;
390+ user-select : none;
390391}
391392
392393.collapsible .collapse {
Original file line number Diff line number Diff line change @@ -82,6 +82,21 @@ type FileManager struct {
8282 NewFS FSBuilder
8383}
8484
85+ var commandEvents = []string {
86+ "before_save" ,
87+ "after_save" ,
88+ "before_publish" ,
89+ "after_publish" ,
90+ "before_copy" ,
91+ "after_copy" ,
92+ "before_rename" ,
93+ "after_rename" ,
94+ "before_upload" ,
95+ "after_upload" ,
96+ "before_delete" ,
97+ "after_delete" ,
98+ }
99+
85100// Command is a command function.
86101type Command func (r * http.Request , m * FileManager , u * User ) error
87102
@@ -130,24 +145,24 @@ func (m *FileManager) Setup() error {
130145 err = m .Store .Config .Get ("commands" , & m .Commands )
131146
132147 if err == nil {
133- // ADD handlers to commands if dont exist
148+ // Add hypothetically new command handlers.
149+ for _ , command := range commandEvents {
150+ if _ , ok := m .Commands [command ]; ok {
151+ continue
152+ }
153+
154+ m .Commands [command ] = []string {}
155+ }
134156 }
135157
136158 if err != nil && err == ErrNotExist {
137- m .Commands = map [string ][]string {
138- "before_save" : {},
139- "after_save" : {},
140- "before_publish" : {},
141- "after_publish" : {},
142- "before_copy" : {},
143- "after_copy" : {},
144- "before_rename" : {},
145- "after_rename" : {},
146- "before_upload" : {},
147- "after_upload" : {},
148- "before_delete" : {},
149- "after_delete" : {},
159+ m .Commands = map [string ][]string {}
160+
161+ // Initialize the command handlers.
162+ for _ , command := range commandEvents {
163+ m .Commands [command ] = []string {}
150164 }
165+
151166 err = m .Store .Config .Save ("commands" , m .Commands )
152167 }
153168
Load Diff Large diffs are not rendered by default.
You can’t perform that action at this time.
0 commit comments