make sure missing emmet can't break tab key

This commit is contained in:
nightwing 2014-11-05 23:17:59 +04:00
commit 9ccf68dbb2

View file

@ -342,6 +342,7 @@ var keymap = {
var editorProxy = new AceEmmetEditor(); var editorProxy = new AceEmmetEditor();
exports.commands = new HashHandler(); exports.commands = new HashHandler();
exports.runEmmetCommand = function(editor) { exports.runEmmetCommand = function(editor) {
try {
editorProxy.setupContext(editor); editorProxy.setupContext(editor);
if (editorProxy.getSyntax() == "php") if (editorProxy.getSyntax() == "php")
return false; return false;
@ -364,7 +365,6 @@ exports.runEmmetCommand = function(editor) {
if (token && /\btag\b/.test(token.type)) if (token && /\btag\b/.test(token.type))
return false; return false;
try {
var result = actions.run(this.action, editorProxy); var result = actions.run(this.action, editorProxy);
} catch(e) { } catch(e) {
editor._signal("changeStatus", typeof e == "string" ? e : e.message); editor._signal("changeStatus", typeof e == "string" ? e : e.message);
@ -393,7 +393,7 @@ exports.updateCommands = function(editor, enabled) {
}; };
exports.isSupportedMode = function(modeId) { 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) { var onChangeMode = function(e, target) {
@ -406,9 +406,8 @@ var onChangeMode = function(e, target) {
if (enabled) { if (enabled) {
if (typeof emmetPath == "string") { if (typeof emmetPath == "string") {
require("ace/config").loadModule(emmetPath, function() { require("ace/config").loadModule(emmetPath, function() {
});
emmetPath = null; emmetPath = null;
});
} }
} }
exports.updateCommands(editor, enabled); exports.updateCommands(editor, enabled);