kopia lustrzana https://github.com/c9/core
allow enabling emmet from a mode
rodzic
02fcbfe6b5
commit
0f83dcd570
|
@ -212,7 +212,7 @@ AceEmmetEditor.prototype = {
|
||||||
* @return {String}
|
* @return {String}
|
||||||
*/
|
*/
|
||||||
getProfileName: function() {
|
getProfileName: function() {
|
||||||
switch(this.getSyntax()) {
|
switch (this.getSyntax()) {
|
||||||
case "css": return "css";
|
case "css": return "css";
|
||||||
case "xml":
|
case "xml":
|
||||||
case "xsl":
|
case "xsl":
|
||||||
|
@ -223,8 +223,10 @@ AceEmmetEditor.prototype = {
|
||||||
if (!profile)
|
if (!profile)
|
||||||
profile = this.ace.session.getLines(0,2).join("").search(/<!DOCTYPE[^>]+XHTML/i) != -1 ? "xhtml": "html";
|
profile = this.ace.session.getLines(0,2).join("").search(/<!DOCTYPE[^>]+XHTML/i) != -1 ? "xhtml": "html";
|
||||||
return profile;
|
return profile;
|
||||||
|
default:
|
||||||
|
var mode = this.ace.session.$mode;
|
||||||
|
return mode.emmetConfig && mode.emmetConfig.profile || "xhtml";
|
||||||
}
|
}
|
||||||
return "xhtml";
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -392,15 +394,18 @@ exports.updateCommands = function(editor, enabled) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.isSupportedMode = function(modeId) {
|
exports.isSupportedMode = function(mode) {
|
||||||
return modeId && /css|less|scss|sass|stylus|html|php|twig|ejs|handlebars/.test(modeId);
|
if (!mode) return false;
|
||||||
|
if (mode.emmetConfig) return true;
|
||||||
|
var id = mode.$id || mode;
|
||||||
|
return /css|less|scss|sass|stylus|html|php|twig|ejs|handlebars/.test(id);
|
||||||
};
|
};
|
||||||
|
|
||||||
var onChangeMode = function(e, target) {
|
var onChangeMode = function(e, target) {
|
||||||
var editor = target;
|
var editor = target;
|
||||||
if (!editor)
|
if (!editor)
|
||||||
return;
|
return;
|
||||||
var enabled = exports.isSupportedMode(editor.session.$modeId);
|
var enabled = exports.isSupportedMode(editor.session.$mode);
|
||||||
if (e.enableEmmet === false)
|
if (e.enableEmmet === false)
|
||||||
enabled = false;
|
enabled = false;
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
|
|
|
@ -74,7 +74,7 @@
|
||||||
"c9.ide.find.replace": "#e4daf722b8",
|
"c9.ide.find.replace": "#e4daf722b8",
|
||||||
"c9.ide.run.debug": "#23a188b91a",
|
"c9.ide.run.debug": "#23a188b91a",
|
||||||
"c9.automate": "#47e2c429c9",
|
"c9.automate": "#47e2c429c9",
|
||||||
"c9.ide.ace.emmet": "#e5f1a92ac3",
|
"c9.ide.ace.emmet": "#0ab4c6cd68",
|
||||||
"c9.ide.ace.gotoline": "#4d1a93172c",
|
"c9.ide.ace.gotoline": "#4d1a93172c",
|
||||||
"c9.ide.ace.keymaps": "#43445d6306",
|
"c9.ide.ace.keymaps": "#43445d6306",
|
||||||
"c9.ide.ace.repl": "#f3a62c1f2a",
|
"c9.ide.ace.repl": "#f3a62c1f2a",
|
||||||
|
|
Ładowanie…
Reference in New Issue