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