extract extension even if it contains a suffix

pull/1/head
yann300 6 years ago
parent cbce9748c1
commit 2f8253bddc
  1. 7
      src/app/editor/editor.js

@ -218,8 +218,11 @@ class Editor {
* @param {string} path Path of the file
*/
_getMode (path) {
let ext = path.indexOf('.') !== -1 ? /[^.]+$/.exec(path) : null
if (ext) ext = ext[0]
let ext = path.indexOf('.') !== -1 ? /[^.]+/.exec(path) : null
if (ext) ext = path.replace(ext[0] + '.', '') // we get <ext>
ext = ext.split('#')
if (!ext.length) return this.modes['txt']
ext = ext[0]
return ext && this.modes[ext] ? this.modes[ext] : this.modes['txt']
}

Loading…
Cancel
Save