kopia lustrzana https://github.com/c9/core
Allow beautify to be called with a string. Other small supportive fixes
rodzic
2bd0c4081e
commit
ea5d931e15
|
@ -85,7 +85,7 @@
|
||||||
"c9.ide.configuration": "#a9066299a2",
|
"c9.ide.configuration": "#a9066299a2",
|
||||||
"c9.ide.dialog.wizard": "#7667ec79a8",
|
"c9.ide.dialog.wizard": "#7667ec79a8",
|
||||||
"c9.ide.fontawesome": "#781602c5d8",
|
"c9.ide.fontawesome": "#781602c5d8",
|
||||||
"c9.ide.format": "#b0bb91a623",
|
"c9.ide.format": "#33ebd01914",
|
||||||
"c9.ide.help.support": "#e95f98f87c",
|
"c9.ide.help.support": "#e95f98f87c",
|
||||||
"c9.ide.imgeditor": "#66a9733dc1",
|
"c9.ide.imgeditor": "#66a9733dc1",
|
||||||
"c9.ide.immediate": "#18c23aa730",
|
"c9.ide.immediate": "#18c23aa730",
|
||||||
|
@ -108,6 +108,8 @@
|
||||||
"c9.ide.save": "#e00549cb0f",
|
"c9.ide.save": "#e00549cb0f",
|
||||||
"c9.ide.scm": "#38d2b48b31",
|
"c9.ide.scm": "#38d2b48b31",
|
||||||
"c9.ide.terminal.monitor": "#b76f1c9f24",
|
"c9.ide.terminal.monitor": "#b76f1c9f24",
|
||||||
|
"c9.ide.test": "#d312a01ac6",
|
||||||
|
"c9.ide.test.mocha": "#79ff886c04",
|
||||||
"c9.ide.theme.flat": "#2de8414db7",
|
"c9.ide.theme.flat": "#2de8414db7",
|
||||||
"c9.ide.threewaymerge": "#229382aa0b",
|
"c9.ide.threewaymerge": "#229382aa0b",
|
||||||
"c9.ide.undo": "#b028bcb4d5",
|
"c9.ide.undo": "#b028bcb4d5",
|
||||||
|
|
|
@ -10,6 +10,9 @@ define(function(require, module, exports) {
|
||||||
var Plugin = imports.Plugin;
|
var Plugin = imports.Plugin;
|
||||||
var menus = imports.menus;
|
var menus = imports.menus;
|
||||||
|
|
||||||
|
var extname = require("path").extname;
|
||||||
|
var basename = require("path").basename;
|
||||||
|
|
||||||
/***** Initialization *****/
|
/***** Initialization *****/
|
||||||
|
|
||||||
var plugin = new Plugin("Ajax.org", main.consumes);
|
var plugin = new Plugin("Ajax.org", main.consumes);
|
||||||
|
@ -54,9 +57,20 @@ define(function(require, module, exports) {
|
||||||
return editor;
|
return editor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function editorSupportsFile(type, path) {
|
||||||
|
var extensions = findEditor(type).fileExtensions;
|
||||||
|
var ext = extname(path).substr(1).toLowerCase();
|
||||||
|
var filename = basename(path).toLowerCase();
|
||||||
|
return ~extensions.indexOf(path)
|
||||||
|
|| ~extensions.indexOf(filename)
|
||||||
|
|| ~extensions.indexOf(ext) ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
function findEditorByFilename(fn) {
|
function findEditorByFilename(fn) {
|
||||||
var ext = fn.substr(fn.lastIndexOf(".") + 1).toLowerCase();
|
var ext = extname(fn).substr(1).toLowerCase();
|
||||||
|
var filename = basename(fn).toLowerCase();
|
||||||
var editor = fileExtensions[fn] && fileExtensions[fn][0]
|
var editor = fileExtensions[fn] && fileExtensions[fn][0]
|
||||||
|
|| fileExtensions[filename] && fileExtensions[filename][0]
|
||||||
|| fileExtensions[ext] && fileExtensions[ext][0]
|
|| fileExtensions[ext] && fileExtensions[ext][0]
|
||||||
|| defaultEditor;
|
|| defaultEditor;
|
||||||
|
|
||||||
|
@ -245,6 +259,11 @@ define(function(require, module, exports) {
|
||||||
*/
|
*/
|
||||||
findEditorByFilename: findEditorByFilename,
|
findEditorByFilename: findEditorByFilename,
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
editorSupportsFile: editorSupportsFile,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an editor instance based on it's type
|
* Create an editor instance based on it's type
|
||||||
* @param {String} type The type of the editor to create
|
* @param {String} type The type of the editor to create
|
||||||
|
|
|
@ -7,6 +7,7 @@ define(function(require, module, exports) {
|
||||||
var Plugin = imports.Plugin;
|
var Plugin = imports.Plugin;
|
||||||
var Document = imports.Document;
|
var Document = imports.Document;
|
||||||
var ui = imports.ui;
|
var ui = imports.ui;
|
||||||
|
var alert = imports["dialog.alert"].show;
|
||||||
|
|
||||||
var stylesheet = ui.createStylesheet();
|
var stylesheet = ui.createStylesheet();
|
||||||
|
|
||||||
|
@ -249,7 +250,7 @@ define(function(require, module, exports) {
|
||||||
// var lastType = tab.editorType;
|
// var lastType = tab.editorType;
|
||||||
amlPane.cloud9pane.createEditor(type, function(err, editor) {
|
amlPane.cloud9pane.createEditor(type, function(err, editor) {
|
||||||
var info = {};
|
var info = {};
|
||||||
if (editor.isValid(amlTab.document, info) === false) {
|
if (editor.isValid(amlTab.cloud9tab.document, info) === false) {
|
||||||
alert(
|
alert(
|
||||||
info.title || "Could not switch editor",
|
info.title || "Could not switch editor",
|
||||||
info.head || "Could not switch editor because this document is invalid.",
|
info.head || "Could not switch editor because this document is invalid.",
|
||||||
|
|
|
@ -186,13 +186,8 @@ define(function(require, module, exports) {
|
||||||
group = node.group;
|
group = node.group;
|
||||||
|
|
||||||
var path = focussedTab && focussedTab.path || "";
|
var path = focussedTab && focussedTab.path || "";
|
||||||
var ext = path.substr(path.lastIndexOf(".") + 1);
|
|
||||||
|
|
||||||
var type = node.value;
|
var type = node.value;
|
||||||
var extensions = editors.findEditor(type).fileExtensions;
|
var isAvailable = editors.editorSupportsFile(type, path);
|
||||||
var isAvailable = editors.defaultEditor == type
|
|
||||||
|| extensions.indexOf(ext.toLowerCase()) > -1
|
|
||||||
|| !extensions.length;
|
|
||||||
|
|
||||||
node.setAttribute("disabled", !isAvailable);
|
node.setAttribute("disabled", !isAvailable);
|
||||||
});
|
});
|
||||||
|
|
|
@ -116,9 +116,11 @@ define(function(require, module, exports) {
|
||||||
return {
|
return {
|
||||||
mark: mark,
|
mark: mark,
|
||||||
position: position,
|
position: position,
|
||||||
stack: stack.map(function(item) {
|
stack: stack
|
||||||
return item.getState ? item.getState() : item;
|
.filter(function(item){ return item; })
|
||||||
})
|
.map(function(item) {
|
||||||
|
return item.getState ? item.getState() : item;
|
||||||
|
})
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,9 @@ define(function(require, exports, module) {
|
||||||
if (!options.baseName)
|
if (!options.baseName)
|
||||||
options.baseName = "tree";
|
options.baseName = "tree";
|
||||||
|
|
||||||
if (!options.model) {
|
var model = options.model;
|
||||||
var model = new TreeModel();
|
if (!model) {
|
||||||
|
model = new TreeModel();
|
||||||
options.model = model;
|
options.model = model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue