From 2f8253bddc0ba8e9840786d0b8075b37a81c774a Mon Sep 17 00:00:00 2001 From: yann300 Date: Fri, 3 May 2019 14:30:18 +0200 Subject: [PATCH] extract extension even if it contains a suffix --- src/app/editor/editor.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/app/editor/editor.js b/src/app/editor/editor.js index 34d32a8a77..f447b940a7 100644 --- a/src/app/editor/editor.js +++ b/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.split('#') + if (!ext.length) return this.modes['txt'] + ext = ext[0] return ext && this.modes[ext] ? this.modes[ext] : this.modes['txt'] }