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

This commit is contained in:
Caleb James DeLisle
2017-09-12 14:12:41 +02:00
7 changed files with 67 additions and 21 deletions

View File

@@ -36,8 +36,9 @@ define([
return $('button.ok').last();
};
var listenForKeys = UI.listenForKeys = function (yes, no) {
var listenForKeys = UI.listenForKeys = function (yes, no, el) {
var handler = function (e) {
e.stopPropagation();
switch (e.which) {
case 27: // cancel
if (typeof(no) === 'function') { no(e); }
@@ -48,7 +49,7 @@ define([
}
};
$(window).keyup(handler);
$(el || window).keydown(handler);
return handler;
};
@@ -114,7 +115,9 @@ define([
};
dialog.frame = function (content) {
return h('div.alertify', [
return h('div.alertify', {
tabindex: 1,
}, [
h('div.dialog', [
h('div', content),
])
@@ -229,6 +232,7 @@ define([
var close = Util.once(function () {
$(frame).fadeOut(150, function () { $(this).remove(); });
stopListening(listener);
cb();
});
listener = listenForKeys(close, close);
var $ok = $(ok).click(close);
@@ -237,7 +241,6 @@ define([
setTimeout(function () {
$ok.focus();
UI.notify();
if (!document.hasFocus()) { window.focus(); }
});
};
@@ -283,7 +286,6 @@ define([
setTimeout(function () {
input.select().focus();
UI.notify();
if (!document.hasFocus()) { window.focus(); }
});
};
@@ -330,10 +332,10 @@ define([
document.body.appendChild(frame);
setTimeout(function () {
UI.notify();
$(frame).find('.ok').focus();
if (typeof(opt.done) === 'function') {
opt.done($ok.closest('.dialog'));
}
if (!document.hasFocus()) { window.focus(); }
});
};

View File

@@ -654,10 +654,8 @@ define([
if (workgroup || (!Cryptpad.isLoggedIn() && !config.testMode)) { return; }
var filesList = getFiles([ROOT, 'hrefArray', TRASH]);
var fData = files[FILES_DATA];
getFiles([FILES_DATA]).forEach(function (id) {
if (filesList.indexOf(id) === -1) {
removePadAttribute(fData[id].href);
spliceFileData(id);
}
});
@@ -1014,7 +1012,7 @@ define([
var toClean = [];
us.forEach(function (el, idx) {
if (!isFile(el, true) || rootFiles.indexOf(el) !== -1) {
toClean.push(idx);
toClean.push(el);
}
if (typeof el === "string") {
// We have an old file (href) which is not in filesData: add it
@@ -1026,12 +1024,15 @@ define([
var data = files[FILES_DATA][el];
if (!data) {
debug("An element in TEMPLATE doesn't have associated data", el);
toClean.push(idx);
toClean.push(el);
}
}
});
toClean.forEach(function (idx) {
us.splice(idx, 1);
toClean.forEach(function (el) {
var idx = us.indexOf(el);
if (idx !== -1) {
us.splice(idx, 1);
}
});
};
var migrateAttributes = function (el, id, parsed) {