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}
|
||||
*/
|
||||
getProfileName: function() {
|
||||
switch(this.getSyntax()) {
|
||||
switch (this.getSyntax()) {
|
||||
case "css": return "css";
|
||||
case "xml":
|
||||
case "xsl":
|
||||
|
@ -223,8 +223,10 @@ AceEmmetEditor.prototype = {
|
|||
if (!profile)
|
||||
profile = this.ace.session.getLines(0,2).join("").search(/<!DOCTYPE[^>]+XHTML/i) != -1 ? "xhtml": "html";
|
||||
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) {
|
||||
return modeId && /css|less|scss|sass|stylus|html|php|twig|ejs|handlebars/.test(modeId);
|
||||
exports.isSupportedMode = function(mode) {
|
||||
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 editor = target;
|
||||
if (!editor)
|
||||
return;
|
||||
var enabled = exports.isSupportedMode(editor.session.$modeId);
|
||||
var enabled = exports.isSupportedMode(editor.session.$mode);
|
||||
if (e.enableEmmet === false)
|
||||
enabled = false;
|
||||
if (enabled) {
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
"c9.ide.find.replace": "#e4daf722b8",
|
||||
"c9.ide.run.debug": "#23a188b91a",
|
||||
"c9.automate": "#47e2c429c9",
|
||||
"c9.ide.ace.emmet": "#e5f1a92ac3",
|
||||
"c9.ide.ace.emmet": "#0ab4c6cd68",
|
||||
"c9.ide.ace.gotoline": "#4d1a93172c",
|
||||
"c9.ide.ace.keymaps": "#43445d6306",
|
||||
"c9.ide.ace.repl": "#f3a62c1f2a",
|
||||
|
|
Ładowanie…
Reference in New Issue