Merge branch 'staging' of github.com:xwiki-labs/cryptpad into staging

This commit is contained in:
ansuz
2017-02-27 20:11:26 +01:00
5 changed files with 50 additions and 23 deletions

View File

@@ -292,7 +292,7 @@ define([
removeSelected();
var $name = $element.find('.name');
if (!$name.length) {
$name = $element.find('.element');
$name = $element.find('> .element');
}
$name.hide();
var name = path[path.length - 1];
@@ -576,6 +576,10 @@ define([
var andThen = function () {
filesOp.moveElements(paths, newPath, cb);
};
// Cancel drag&drop from TRASH to TRASH
if (filesOp.comparePath(newPath, [TRASH]) && paths.length >= 1 && paths[0][0] === TRASH) {
return;
}
// "force" is currently unused but may be configurable by user
if (newPath[0] !== TRASH || force) {
andThen();
@@ -861,13 +865,15 @@ define([
return $title;
}
path.forEach(function (p, idx) {
if (isTrash && [1,2].indexOf(idx) !== -1) { return; }
if (isTrash && [2,3].indexOf(idx) !== -1) { return; }
var $span = $('<span>', {'class': 'element'});
if (idx < path.length - 1) {
$span.addClass('clickable');
$span.click(function (e) {
module.displayDirectory(path.slice(0, idx + 1));
var sliceEnd = idx + 1;
if (isTrash && idx === 1) { sliceEnd = 4; } // Make sure we don't show the index or 'element' and 'path'
module.displayDirectory(path.slice(0, sliceEnd));
});
}
@@ -1903,11 +1909,9 @@ define([
var createReadme = function (proxy, cb) {
if (proxy.initializing) {
var hash = Cryptpad.createRandomHash();
console.log(Messages.driveReadme);
Get.put(hash, Messages.driveReadme, function (e) {
if (e) { console.error(e); }
if (e) { logError(e); }
var href = '/pad/#' + hash;
console.log(href);
proxy.drive[UNSORTED].push(href);
proxy.drive[FILES_DATA].push({
href: href,

View File

@@ -130,7 +130,6 @@ define([
$(inner).css({
color: '#fff',
});
//documentBody.innerHTML = Messages.initialState;
var cursor = window.cursor = Cursor(inner);
@@ -366,10 +365,6 @@ define([
};
var realtimeOptions = {
// provide initialstate...
//initialState: stringifyDOM(inner) || '{}',
initialState: '[]',
// the websocket URL
websocketURL: Cryptpad.getWebsocketURL(),
@@ -431,6 +426,7 @@ define([
var updateMetadata = function(shjson) {
// Extract the user list (metadata) from the hyperjson
if (!shjson || typeof (shjson) !== "string") { updateTitle(defaultName); return; }
var hjson = JSON.parse(shjson);
var peerMetadata = hjson[3];
var titleUpdated = false;
@@ -678,7 +674,7 @@ define([
var shjson = info.realtime.getUserDoc();
var newPad = false;
if (shjson === '[]') { newPad = true; }
if (shjson === '') { newPad = true; }
if (!newPad) {
applyHjson(shjson);
@@ -704,7 +700,7 @@ define([
}
}
} else {
updateMetadata(shjson);
updateTitle(Cryptpad.initialName || defaultName);
documentBody.innerHTML = Messages.initialState;
}