mirror of
https://github.com/go-gitea/gitea.git
synced 2024-11-04 08:17:24 -05:00
Fix ui bug in wiki commit page (#12089)
* Fix ui bug in wiki commit page TODO: Maybe we should allow wiki to have its own ``.editorconfig`` file. Signed-off-by: a1012112796 <1012112796@qq.com> * fix a small nit Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: zeripath <art27@cantab.net>
This commit is contained in:
parent
480ac25ed5
commit
cd994f6354
@ -164,9 +164,16 @@ func NewFuncMap() []template.FuncMap {
|
|||||||
mimeType := mime.TypeByExtension(filepath.Ext(filename))
|
mimeType := mime.TypeByExtension(filepath.Ext(filename))
|
||||||
return strings.HasPrefix(mimeType, "image/")
|
return strings.HasPrefix(mimeType, "image/")
|
||||||
},
|
},
|
||||||
"TabSizeClass": func(ec *editorconfig.Editorconfig, filename string) string {
|
"TabSizeClass": func(ec interface{}, filename string) string {
|
||||||
|
var (
|
||||||
|
value *editorconfig.Editorconfig
|
||||||
|
ok bool
|
||||||
|
)
|
||||||
if ec != nil {
|
if ec != nil {
|
||||||
def, err := ec.GetDefinitionForFilename(filename)
|
if value, ok = ec.(*editorconfig.Editorconfig); !ok || value == nil {
|
||||||
|
return "tab-size-8"
|
||||||
|
}
|
||||||
|
def, err := value.GetDefinitionForFilename(filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("tab size class: getting definition for filename: %v", err)
|
log.Error("tab size class: getting definition for filename: %v", err)
|
||||||
return "tab-size-8"
|
return "tab-size-8"
|
||||||
|
Loading…
Reference in New Issue
Block a user