diff --git a/lib/ace/ext/emmet.js b/lib/ace/ext/emmet.js index 75eefa3f..ceb155ef 100644 --- a/lib/ace/ext/emmet.js +++ b/lib/ace/ext/emmet.js @@ -342,29 +342,29 @@ var keymap = { var editorProxy = new AceEmmetEditor(); exports.commands = new HashHandler(); exports.runEmmetCommand = function(editor) { - editorProxy.setupContext(editor); - if (editorProxy.getSyntax() == "php") - return false; - var actions = emmet.require("actions"); - - if (this.action == "expand_abbreviation_with_tab") { - if (!editor.selection.isEmpty()) - return false; - } - - if (this.action == "wrap_with_abbreviation") { - // without setTimeout prompt doesn't work on firefox - return setTimeout(function() { - actions.run("wrap_with_abbreviation", editorProxy); - }, 0); - } - - var pos = editor.selection.lead; - var token = editor.session.getTokenAt(pos.row, pos.column); - if (token && /\btag\b/.test(token.type)) - return false; - try { + editorProxy.setupContext(editor); + if (editorProxy.getSyntax() == "php") + return false; + var actions = emmet.require("actions"); + + if (this.action == "expand_abbreviation_with_tab") { + if (!editor.selection.isEmpty()) + return false; + } + + if (this.action == "wrap_with_abbreviation") { + // without setTimeout prompt doesn't work on firefox + return setTimeout(function() { + actions.run("wrap_with_abbreviation", editorProxy); + }, 0); + } + + var pos = editor.selection.lead; + var token = editor.session.getTokenAt(pos.row, pos.column); + if (token && /\btag\b/.test(token.type)) + return false; + var result = actions.run(this.action, editorProxy); } catch(e) { editor._signal("changeStatus", typeof e == "string" ? e : e.message); @@ -393,7 +393,7 @@ exports.updateCommands = function(editor, enabled) { }; exports.isSupportedMode = function(modeId) { - return modeId && /css|less|scss|sass|stylus|html|php|twig/.test(modeId); + return modeId && /css|less|scss|sass|stylus|html|php|twig|ejs/.test(modeId); }; var onChangeMode = function(e, target) { @@ -406,9 +406,8 @@ var onChangeMode = function(e, target) { if (enabled) { if (typeof emmetPath == "string") { require("ace/config").loadModule(emmetPath, function() { - + emmetPath = null; }); - emmetPath = null; } } exports.updateCommands(editor, enabled);