make sure missing emmet can't break tab key
This commit is contained in:
parent
22de936727
commit
9ccf68dbb2
1 changed files with 24 additions and 25 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue