kopia lustrzana https://github.com/c9/core
commit
2e5adbace2
|
@ -343,11 +343,9 @@ var keymap = {
|
|||
|
||||
var editorProxy = new AceEmmetEditor();
|
||||
exports.commands = new HashHandler();
|
||||
exports.runEmmetCommand = function(editor) {
|
||||
exports.runEmmetCommand = function runEmmetCommand(editor) {
|
||||
try {
|
||||
editorProxy.setupContext(editor);
|
||||
if (editorProxy.getSyntax() == "php")
|
||||
return false;
|
||||
var actions = emmet.require("actions");
|
||||
|
||||
if (this.action == "expand_abbreviation_with_tab") {
|
||||
|
@ -369,6 +367,10 @@ exports.runEmmetCommand = function(editor) {
|
|||
|
||||
var result = actions.run(this.action, editorProxy);
|
||||
} catch(e) {
|
||||
if (!emmet) {
|
||||
load(runEmmetCommand.bind(this, editor));
|
||||
return true;
|
||||
}
|
||||
editor._signal("changeStatus", typeof e == "string" ? e : e.message);
|
||||
console.log(e);
|
||||
result = false;
|
||||
|
@ -401,6 +403,22 @@ exports.isSupportedMode = function(mode) {
|
|||
return /css|less|scss|sass|stylus|html|php|twig|ejs|handlebars/.test(id);
|
||||
};
|
||||
|
||||
exports.isAvailable = function(editor, command) {
|
||||
if (/(evaluate_math_expression|expand_abbreviation)$/.test(command))
|
||||
return true;
|
||||
var mode = editor.session.$mode;
|
||||
var isSupported = exports.isSupportedMode(mode);
|
||||
if (isSupported && mode.$modes) {
|
||||
// TODO refactor mode delegates to make this simpler
|
||||
try {
|
||||
editorProxy.setupContext(editor);
|
||||
if (/js|php/.test(editorProxy.getSyntax()))
|
||||
isSupported = false;
|
||||
} catch(e) {}
|
||||
}
|
||||
return isSupported;
|
||||
}
|
||||
|
||||
var onChangeMode = function(e, target) {
|
||||
var editor = target;
|
||||
if (!editor)
|
||||
|
@ -408,16 +426,20 @@ var onChangeMode = function(e, target) {
|
|||
var enabled = exports.isSupportedMode(editor.session.$mode);
|
||||
if (e.enableEmmet === false)
|
||||
enabled = false;
|
||||
if (enabled) {
|
||||
if (typeof emmetPath == "string") {
|
||||
require("ace/config").loadModule(emmetPath, function() {
|
||||
emmetPath = null;
|
||||
});
|
||||
}
|
||||
}
|
||||
if (enabled)
|
||||
load();
|
||||
exports.updateCommands(editor, enabled);
|
||||
};
|
||||
|
||||
var load = function(cb) {
|
||||
if (typeof emmetPath == "string") {
|
||||
require("ace/config").loadModule(emmetPath, function() {
|
||||
emmetPath = null;
|
||||
cb && cb();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
exports.AceEmmetEditor = AceEmmetEditor;
|
||||
require("ace/config").defineOptions(Editor.prototype, "editor", {
|
||||
enableEmmet: {
|
||||
|
|
|
@ -124,6 +124,9 @@ function addModule(id, parent) {
|
|||
children.push(name.slice(1, -1));
|
||||
}
|
||||
}
|
||||
if (/\.json$/.test(filename))
|
||||
children = [];
|
||||
|
||||
var module = {
|
||||
relPath: relPath(filename),
|
||||
id: filename,
|
||||
|
|
|
@ -74,6 +74,8 @@ plugin.replaceDomains = function(settings, domains) {
|
|||
continue;
|
||||
if (settings[s].baseUrl)
|
||||
settings[s].baseUrl = replaceDomain(settings[s].baseUrl, primaryDomain);
|
||||
if (settings[s].localBaseUrl)
|
||||
settings[s].localBaseUrl = replaceDomain(settings[s].localBaseUrl, primaryDomain);
|
||||
if (settings[s].primaryBaseUrl)
|
||||
settings[s].primaryBaseUrl = replaceDomain(settings[s].primaryBaseUrl, primaryDomain);
|
||||
if (settings[s].baseUrls) {
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
"dependencies": {
|
||||
"simple-mime": "~0.0.7"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"pty.js": "0.2.3"
|
||||
"externalDependencies": {
|
||||
"pty.js": "0.2.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"chai": "~1.2.0",
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
"c9.ide.find.replace": "#44772dd796",
|
||||
"c9.ide.run.debug": "#c7f1ed5d5d",
|
||||
"c9.automate": "#47e2c429c9",
|
||||
"c9.ide.ace.emmet": "#0ab4c6cd68",
|
||||
"c9.ide.ace.emmet": "#6dc4585e02",
|
||||
"c9.ide.ace.gotoline": "#a8ff07c8f4",
|
||||
"c9.ide.ace.keymaps": "#43445d6306",
|
||||
"c9.ide.ace.repl": "#f3a62c1f2a",
|
||||
|
@ -83,7 +83,7 @@
|
|||
"c9.ide.ace.stripws": "#cf0f42ac59",
|
||||
"c9.ide.behaviors": "#98461756d9",
|
||||
"c9.ide.closeconfirmation": "#a28bfd8272",
|
||||
"c9.ide.configuration": "#adf50fdaa2",
|
||||
"c9.ide.configuration": "#a17478a2e5",
|
||||
"c9.ide.dialog.wizard": "#7667ec79a8",
|
||||
"c9.ide.fontawesome": "#781602c5d8",
|
||||
"c9.ide.format": "#b0bb91a623",
|
||||
|
|
|
@ -167,7 +167,7 @@ define(function(require, exports, module) {
|
|||
return;
|
||||
}
|
||||
|
||||
var servers = shuffleServers(version, vfsServers);
|
||||
servers = shuffleServers(version, vfsServers);
|
||||
|
||||
// check for version
|
||||
if (vfsServers.length && !servers.length) {
|
||||
|
|
Ładowanie…
Reference in New Issue