kopia lustrzana https://github.com/c9/core
commit
f72202160b
|
@ -186,6 +186,7 @@ module.exports = function(config, optimist) {
|
||||||
"./c9.vfs.server/cache",
|
"./c9.vfs.server/cache",
|
||||||
"./c9.vfs.server/download",
|
"./c9.vfs.server/download",
|
||||||
"./c9.vfs.server/filelist",
|
"./c9.vfs.server/filelist",
|
||||||
|
"./c9.vfs.server/fetchcache",
|
||||||
"./c9.vfs.server/statics",
|
"./c9.vfs.server/statics",
|
||||||
"./c9.analytics/mock_analytics",
|
"./c9.analytics/mock_analytics",
|
||||||
"./c9.metrics/mock_metrics",
|
"./c9.metrics/mock_metrics",
|
||||||
|
|
|
@ -294,6 +294,8 @@ function LineWidgets(session) {
|
||||||
if (!w || !w.el) continue;
|
if (!w || !w.el) continue;
|
||||||
if (w.session != this.session) continue;
|
if (w.session != this.session) continue;
|
||||||
if (!w._inDocument) {
|
if (!w._inDocument) {
|
||||||
|
if (this.session.lineWidgets[w.row] != w)
|
||||||
|
continue;
|
||||||
w._inDocument = true;
|
w._inDocument = true;
|
||||||
renderer.container.appendChild(w.el);
|
renderer.container.appendChild(w.el);
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,6 +98,7 @@ var VScrollBar = function(parent, renderer) {
|
||||||
this.width = dom.scrollbarWidth(parent.ownerDocument);
|
this.width = dom.scrollbarWidth(parent.ownerDocument);
|
||||||
this.inner.style.width =
|
this.inner.style.width =
|
||||||
this.element.style.width = (this.width || 15) + 5 + "px";
|
this.element.style.width = (this.width || 15) + 5 + "px";
|
||||||
|
this.$minWidth = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
oop.inherits(VScrollBar, ScrollBar);
|
oop.inherits(VScrollBar, ScrollBar);
|
||||||
|
@ -124,7 +125,7 @@ oop.inherits(VScrollBar, ScrollBar);
|
||||||
* @returns {Number}
|
* @returns {Number}
|
||||||
**/
|
**/
|
||||||
this.getWidth = function() {
|
this.getWidth = function() {
|
||||||
return this.isVisible ? this.width : 0;
|
return Math.max(this.isVisible ? this.width : 0, this.$minWidth || 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -799,8 +799,10 @@ var Selection = function(session) {
|
||||||
var docPos = this.session.screenToDocumentPosition(screenPos.row + rows, screenPos.column);
|
var docPos = this.session.screenToDocumentPosition(screenPos.row + rows, screenPos.column);
|
||||||
|
|
||||||
if (rows !== 0 && chars === 0 && docPos.row === this.lead.row && docPos.column === this.lead.column) {
|
if (rows !== 0 && chars === 0 && docPos.row === this.lead.row && docPos.column === this.lead.column) {
|
||||||
if (this.session.lineWidgets && this.session.lineWidgets[docPos.row])
|
if (this.session.lineWidgets && this.session.lineWidgets[docPos.row]) {
|
||||||
docPos.row++;
|
if (docPos.row > 0 || rows > 0)
|
||||||
|
docPos.row++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// move the cursor and update the desired column
|
// move the cursor and update the desired column
|
||||||
|
|
12
package.json
12
package.json
|
@ -55,7 +55,7 @@
|
||||||
"c9"
|
"c9"
|
||||||
],
|
],
|
||||||
"c9plugins": {
|
"c9plugins": {
|
||||||
"c9.ide.language": "#ff78609c3f",
|
"c9.ide.language": "#2a4a36fc18",
|
||||||
"c9.ide.language.css": "#a649f2a710",
|
"c9.ide.language.css": "#a649f2a710",
|
||||||
"c9.ide.language.generic": "#77d43cfaf0",
|
"c9.ide.language.generic": "#77d43cfaf0",
|
||||||
"c9.ide.language.html": "#0f4078c187",
|
"c9.ide.language.html": "#0f4078c187",
|
||||||
|
@ -80,7 +80,7 @@
|
||||||
"c9.ide.ace.split": "#0ae0151c78",
|
"c9.ide.ace.split": "#0ae0151c78",
|
||||||
"c9.ide.ace.statusbar": "#d95be89d53",
|
"c9.ide.ace.statusbar": "#d95be89d53",
|
||||||
"c9.ide.ace.stripws": "#cf0f42ac59",
|
"c9.ide.ace.stripws": "#cf0f42ac59",
|
||||||
"c9.ide.behaviors": "#e2c7f68242",
|
"c9.ide.behaviors": "#05e5681e2e",
|
||||||
"c9.ide.closeconfirmation": "#cee4674141",
|
"c9.ide.closeconfirmation": "#cee4674141",
|
||||||
"c9.ide.configuration": "#a9066299a2",
|
"c9.ide.configuration": "#a9066299a2",
|
||||||
"c9.ide.dialog.wizard": "#7667ec79a8",
|
"c9.ide.dialog.wizard": "#7667ec79a8",
|
||||||
|
@ -102,14 +102,14 @@
|
||||||
"c9.ide.recentfiles": "#7c099abf40",
|
"c9.ide.recentfiles": "#7c099abf40",
|
||||||
"c9.ide.remote": "#301d2ab519",
|
"c9.ide.remote": "#301d2ab519",
|
||||||
"c9.ide.processlist": "#2b12cd1bdd",
|
"c9.ide.processlist": "#2b12cd1bdd",
|
||||||
"c9.ide.run": "#89a02ba00a",
|
"c9.ide.run": "#f360984649",
|
||||||
"c9.ide.run.build": "#0598fff697",
|
"c9.ide.run.build": "#0598fff697",
|
||||||
"c9.ide.run.debug.xdebug": "#61dcbd0180",
|
"c9.ide.run.debug.xdebug": "#61dcbd0180",
|
||||||
"c9.ide.save": "#e00549cb0f",
|
"c9.ide.save": "#e00549cb0f",
|
||||||
"c9.ide.scm": "#38d2b48b31",
|
"c9.ide.scm": "#2398826541",
|
||||||
"c9.ide.terminal.monitor": "#b76f1c9f24",
|
"c9.ide.terminal.monitor": "#b76f1c9f24",
|
||||||
"c9.ide.test": "#d312a01ac6",
|
"c9.ide.test": "#302388c9eb",
|
||||||
"c9.ide.test.mocha": "#79ff886c04",
|
"c9.ide.test.mocha": "#c81861817e",
|
||||||
"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",
|
||||||
|
|
|
@ -1075,7 +1075,7 @@ define(function(require, module, exports) {
|
||||||
options.document.title = basename(path);
|
options.document.title = basename(path);
|
||||||
options.document.tooltip = path;
|
options.document.tooltip = path;
|
||||||
}
|
}
|
||||||
if (typeof options.value == "string")
|
if (typeof options.value == "string" && !options.newOnError)
|
||||||
options.document.value = options.value;
|
options.document.value = options.value;
|
||||||
// if (options.document.filter === undefined)
|
// if (options.document.filter === undefined)
|
||||||
// options.document.filter = true;
|
// options.document.filter = true;
|
||||||
|
@ -1091,7 +1091,7 @@ define(function(require, module, exports) {
|
||||||
var doc = options.document;
|
var doc = options.document;
|
||||||
var loadFromDisk = path
|
var loadFromDisk = path
|
||||||
&& (!doc || doc.value === undefined)
|
&& (!doc || doc.value === undefined)
|
||||||
&& options.value === undefined
|
&& (options.value === undefined || options.newOnError)
|
||||||
// autoload to false prevents loading data, used by image editor
|
// autoload to false prevents loading data, used by image editor
|
||||||
&& (!editor || editor.autoload !== false);
|
&& (!editor || editor.autoload !== false);
|
||||||
|
|
||||||
|
|
|
@ -1226,7 +1226,7 @@
|
||||||
@dropdown-black-image-height: 5px;
|
@dropdown-black-image-height: 5px;
|
||||||
@dropdown-black-background-position: 50% 50%;
|
@dropdown-black-background-position: 50% 50%;
|
||||||
@dropdown-black-height: 28px;
|
@dropdown-black-height: 28px;
|
||||||
@dropdown-black-padding: 8px 0 5px 9px;
|
@dropdown-black-padding: 7px 8px 5px 9px;
|
||||||
@dropdown-black-font-family: @general-font-family;
|
@dropdown-black-font-family: @general-font-family;
|
||||||
@dropdown-black-font-size: 13px;
|
@dropdown-black-font-size: 13px;
|
||||||
@dropdown-black-button-width: 24px;
|
@dropdown-black-button-width: 24px;
|
||||||
|
|
|
@ -305,6 +305,9 @@
|
||||||
.filetree .tree-row > span.caption {
|
.filetree .tree-row > span.caption {
|
||||||
margin-left: 4px;
|
margin-left: 4px;
|
||||||
}
|
}
|
||||||
|
.filetree .tree-row.heading > span.caption {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.toolbar-top.basic .c9-menu-btnDown.scripts{
|
.toolbar-top.basic .c9-menu-btnDown.scripts{
|
||||||
border: 0;
|
border: 0;
|
||||||
|
@ -417,6 +420,8 @@
|
||||||
.has_apf .toolbar-top .sbtb_middle{
|
.has_apf .toolbar-top .sbtb_middle{
|
||||||
height: auto;
|
height: auto;
|
||||||
padding: 4px 25px 3px 5px;
|
padding: 4px 25px 3px 5px;
|
||||||
|
border: 0;
|
||||||
|
margin-right: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.top-test-panel{
|
.top-test-panel{
|
||||||
|
@ -424,8 +429,13 @@
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.runner-form-header{
|
body .runner-form-header{
|
||||||
border-bottom: 1px solid @border-highlight-dark;
|
background: whitesmoke;
|
||||||
|
}
|
||||||
|
|
||||||
|
.runtestbtn .icon{
|
||||||
|
background-position: 1px 2px;
|
||||||
|
height: 22px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media print, (-o-min-device-pixel-ratio: 5/4), (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 1.25dppx) {
|
@media print, (-o-min-device-pixel-ratio: 5/4), (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 1.25dppx) {
|
||||||
|
@ -483,4 +493,7 @@
|
||||||
.c9-toolbarbutton-glossy .c9-icon {
|
.c9-toolbarbutton-glossy .c9-icon {
|
||||||
height: 19px;
|
height: 19px;
|
||||||
}
|
}
|
||||||
|
.runtestbtn .icon{
|
||||||
|
height: 21px;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -278,9 +278,9 @@ define(function(require, exports, module) {
|
||||||
tree.renderer.on("scrollbarVisibilityChanged", updateScrollBarSize);
|
tree.renderer.on("scrollbarVisibilityChanged", updateScrollBarSize);
|
||||||
tree.renderer.on("resize", updateScrollBarSize);
|
tree.renderer.on("resize", updateScrollBarSize);
|
||||||
function updateScrollBarSize() {
|
function updateScrollBarSize() {
|
||||||
var w = tree.renderer.scrollBarV.getWidth();
|
var scrollBarV = tree.renderer.scrollBarV;
|
||||||
|
var w = scrollBarV.isVisible ? scrollBarV.getWidth() : 0;
|
||||||
btnTreeSettings.$ext.style.marginRight = Math.max(w - 2, 0) + "px";
|
btnTreeSettings.$ext.style.marginRight = Math.max(w - 2, 0) + "px";
|
||||||
tree.renderer.scroller.style.right = Math.max(w, 10) + "px";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tree.on("drop", function(e) {
|
tree.on("drop", function(e) {
|
||||||
|
|
|
@ -240,9 +240,13 @@ define(function(require, exports, module) {
|
||||||
value: options.path
|
value: options.path
|
||||||
? createBind(options.path)
|
? createBind(options.path)
|
||||||
: (options.defaultValue || ""),
|
: (options.defaultValue || ""),
|
||||||
min: options.min,
|
min: options.min || 0,
|
||||||
max: options.max,
|
max: options.max || 10,
|
||||||
realtime: typeof options.realtime !== "undefined" ? options.realtime : 1
|
realtime: typeof options.realtime !== "undefined" ? options.realtime : 1,
|
||||||
|
onafterchange: function(e) {
|
||||||
|
if (options.onchange)
|
||||||
|
options.onchange({ value: e.value });
|
||||||
|
},
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
break;
|
break;
|
||||||
|
@ -254,16 +258,24 @@ define(function(require, exports, module) {
|
||||||
: (options.defaultCheckboxValue || ""),
|
: (options.defaultCheckboxValue || ""),
|
||||||
width: width, maxwidth: maxwidth,
|
width: width, maxwidth: maxwidth,
|
||||||
label: name + ":",
|
label: name + ":",
|
||||||
skin: "checkbox_black"
|
skin: "checkbox_black",
|
||||||
|
onafterchange: function(e) {
|
||||||
|
if (options.onchange)
|
||||||
|
options.onchange({ value: e.value, type: "checkbox" });
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
new ui.spinner({
|
new ui.spinner({
|
||||||
width: options.width || widths["checked-spinner"],
|
width: options.width || widths["checked-spinner"],
|
||||||
value: options.path
|
value: options.path
|
||||||
? createBind(options.path)
|
? createBind(options.path)
|
||||||
: (options.defaultValue || ""),
|
: (options.defaultValue || ""),
|
||||||
min: options.min,
|
min: options.min || 0,
|
||||||
max: options.max,
|
max: options.max || 10,
|
||||||
realtime: typeof options.realtime !== "undefined" ? options.realtime : 1
|
realtime: typeof options.realtime !== "undefined" ? options.realtime : 1,
|
||||||
|
onafterchange: function(e) {
|
||||||
|
if (options.onchange)
|
||||||
|
options.onchange({ value: e.value, type: "spinner" });
|
||||||
|
},
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
break;
|
break;
|
||||||
|
@ -275,7 +287,11 @@ define(function(require, exports, module) {
|
||||||
: (options.defaultValue || ""),
|
: (options.defaultValue || ""),
|
||||||
width: options.width || widths["checked-single"],
|
width: options.width || widths["checked-single"],
|
||||||
label: name,
|
label: name,
|
||||||
skin: "checkbox_black"
|
skin: "checkbox_black",
|
||||||
|
onafterchange: function(e){
|
||||||
|
if (options.onchange)
|
||||||
|
options.onchange({ value: e.value });
|
||||||
|
}
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -190,7 +190,7 @@ EventEmitter.prototype.on = EventEmitter.prototype.addListener;
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
|
|
||||||
EventEmitter.prototype.once = function(type, listener) {
|
EventEmitter.prototype.once = function(type, listener, plugin) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
var wrapped = function() {
|
var wrapped = function() {
|
||||||
|
@ -199,7 +199,7 @@ EventEmitter.prototype.once = function(type, listener) {
|
||||||
}
|
}
|
||||||
wrapped.listener = listener;
|
wrapped.listener = listener;
|
||||||
|
|
||||||
self.on(type, wrapped);
|
self.on(type, wrapped, plugin);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,106 @@
|
||||||
|
define(function(require, exports, module) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
main.consumes = ["Plugin", "vfs.cache", "connect"];
|
||||||
|
main.provides = ["vfs.fetchcache"];
|
||||||
|
return main;
|
||||||
|
|
||||||
|
function main(options, imports, register) {
|
||||||
|
var Plugin = imports.Plugin;
|
||||||
|
var cache = imports["vfs.cache"];
|
||||||
|
|
||||||
|
var error = require("http-error");
|
||||||
|
var Path = require("path");
|
||||||
|
var async = require("async");
|
||||||
|
|
||||||
|
/***** Initialization *****/
|
||||||
|
|
||||||
|
var plugin = new Plugin("Ajax.org", main.consumes);
|
||||||
|
|
||||||
|
var compress = imports.connect.getModule().compress();
|
||||||
|
|
||||||
|
cache.registerExtension(function(vfs, callback) {
|
||||||
|
var restful = vfs.restful.home;
|
||||||
|
|
||||||
|
vfs.restful.home = function(req, res, next) {
|
||||||
|
var path = unescape(req.uri.pathname);
|
||||||
|
|
||||||
|
if (req.method == "GET" && path.indexOf("/.c9/cache") === 0) {
|
||||||
|
compress(req, res, function(err) {
|
||||||
|
if (err) return next(err);
|
||||||
|
|
||||||
|
fetchcache(vfs.vfs, vfs.vfs.env.HOME, vfs.vfsOptions, req, res, next);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
restful(req, res, next);
|
||||||
|
};
|
||||||
|
|
||||||
|
callback();
|
||||||
|
});
|
||||||
|
|
||||||
|
function readFile(vfs, path, callback) {
|
||||||
|
vfs.readfile(path, { encoding: "utf8" }, function(err, meta) {
|
||||||
|
if (err)
|
||||||
|
return callback(err);
|
||||||
|
|
||||||
|
var data = "";
|
||||||
|
meta.stream.on("data", function(d) {
|
||||||
|
data += d;
|
||||||
|
})
|
||||||
|
|
||||||
|
var done;
|
||||||
|
meta.stream.on("error", function(e) {
|
||||||
|
if (done) return;
|
||||||
|
done = true;
|
||||||
|
callback(e);
|
||||||
|
});
|
||||||
|
|
||||||
|
meta.stream.on("end", function() {
|
||||||
|
if (done) return;
|
||||||
|
done = true;
|
||||||
|
callback(null, data);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function fetchcache(vfs, root, vfsOptions, req, res, next) {
|
||||||
|
var path = unescape(req.uri.pathname);
|
||||||
|
|
||||||
|
// sandbox path to workspaceDir
|
||||||
|
path = Path.join(root, path);
|
||||||
|
// if (path.indexOf(root) !== 0)
|
||||||
|
// return next(new error.Forbidden("Can't list files outside of the workspace"));
|
||||||
|
|
||||||
|
// Fetch index
|
||||||
|
readFile(vfs, Path.join(path, "index"), function(err, list){
|
||||||
|
if (err) {
|
||||||
|
var httpErr = new error.NotFound(err.message);
|
||||||
|
return next(httpErr);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fetch each file in the index
|
||||||
|
async.mapLimit(list.split("\n"), 50, function(p, callback){
|
||||||
|
readFile(vfs, Path.join(path, p.replace(/\//g, "\\")), function(ignore, data){
|
||||||
|
var json;
|
||||||
|
try { json = JSON.parse(data); }
|
||||||
|
catch(e) { json = { type: "file", path: p } }
|
||||||
|
|
||||||
|
callback(null, json);
|
||||||
|
});
|
||||||
|
}, function(ignore, results){
|
||||||
|
res.writeHead(200, { "Content-Type": "text/json" });
|
||||||
|
res.write(JSON.stringify(results));
|
||||||
|
res.end();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
plugin.freezePublicAPI({
|
||||||
|
// for testing only
|
||||||
|
fetchcache: fetchcache
|
||||||
|
});
|
||||||
|
|
||||||
|
register(null, { "vfs.fetchcache" : plugin });
|
||||||
|
}
|
||||||
|
});
|
Ładowanie…
Reference in New Issue