diff --git a/assets/src/css/dashboard.css b/assets/src/css/dashboard.css index ee747279..dbb22548 100644 --- a/assets/src/css/dashboard.css +++ b/assets/src/css/dashboard.css @@ -386,7 +386,8 @@ table tr>*:last-child { } .collapsible > label i { - transition: .2s ease transform + transition: .2s ease transform; + user-select: none; } .collapsible .collapse { diff --git a/filemanager.go b/filemanager.go index 3fa91863..c960aa48 100644 --- a/filemanager.go +++ b/filemanager.go @@ -82,6 +82,21 @@ type FileManager struct { NewFS FSBuilder } +var commandEvents = []string{ + "before_save", + "after_save", + "before_publish", + "after_publish", + "before_copy", + "after_copy", + "before_rename", + "after_rename", + "before_upload", + "after_upload", + "before_delete", + "after_delete", +} + // Command is a command function. type Command func(r *http.Request, m *FileManager, u *User) error @@ -130,24 +145,24 @@ func (m *FileManager) Setup() error { err = m.Store.Config.Get("commands", &m.Commands) if err == nil { - // ADD handlers to commands if dont exist + // Add hypothetically new command handlers. + for _, command := range commandEvents { + if _, ok := m.Commands[command]; ok { + continue + } + + m.Commands[command] = []string{} + } } if err != nil && err == ErrNotExist { - m.Commands = map[string][]string{ - "before_save": {}, - "after_save": {}, - "before_publish": {}, - "after_publish": {}, - "before_copy": {}, - "after_copy": {}, - "before_rename": {}, - "after_rename": {}, - "before_upload": {}, - "after_upload": {}, - "before_delete": {}, - "after_delete": {}, + m.Commands = map[string][]string{} + + // Initialize the command handlers. + for _, command := range commandEvents { + m.Commands[command] = []string{} } + err = m.Store.Config.Save("commands", m.Commands) } diff --git a/rice-box.go.REMOVED.git-id b/rice-box.go.REMOVED.git-id index a4649500..c6ec51e1 100644 --- a/rice-box.go.REMOVED.git-id +++ b/rice-box.go.REMOVED.git-id @@ -1 +1 @@ -c249fdbec733fcd4aefc255262596bee379c471a \ No newline at end of file +02569a5e91d6d6dcfa2357521c46c159f5edd5c4 \ No newline at end of file