diff --git a/plugins/editors/codemirror/layouts/editors/codemirror/init.php b/plugins/editors/codemirror/layouts/editors/codemirror/init.php index 316a48146a1a4..4e9d7fd599e86 100644 --- a/plugins/editors/codemirror/layouts/editors/codemirror/init.php +++ b/plugins/editors/codemirror/layouts/editors/codemirror/init.php @@ -45,16 +45,15 @@ cm.defineInitHook(function (editor) { // Try to set up the mode - var mode = cm.findModeByName(editor.options.mode || ''); + var mode = cm.findModeByMIME(editor.options.mode || '') || + cm.findModeByName(editor.options.mode || '') || + cm.findModeByExtension(editor.options.mode || ''); + + cm.autoLoadMode(editor, mode ? mode.mode : editor.options.mode); if (mode) { - cm.autoLoadMode(editor, mode.mode); - editor.setOption('mode', mode.mime); - } - else - { - cm.autoLoadMode(editor, editor.options.mode); + editor.setOption('mode', mode.mode); } // Handle gutter clicks (place or remove a marker).