Merge branch 'staging' of github.com:xwiki-labs/cryptpad into staging
commit
b08c1d94a1
|
@ -15,3 +15,5 @@ www/pad/mediatag-plugin.js
|
|||
www/pad/mediatag-plugin-dialog.js
|
||||
|
||||
www/common/media-tag-nacl.min.js
|
||||
|
||||
customize/
|
||||
|
|
|
@ -56,10 +56,21 @@ define([
|
|||
return handler;
|
||||
};
|
||||
var customListenForKeys = function (keys, cb, el) {
|
||||
if (!keys || typeof cb !== "function") { return; }
|
||||
if (!keys || !keys.length || typeof cb !== "function") { return; }
|
||||
var handler = function (e) {
|
||||
e.stopPropagation();
|
||||
if (keys.indexOf(e.which) !== -1) { cb(); }
|
||||
keys.some(function (k) {
|
||||
// k is number or array
|
||||
// if it's an array, it should be [keyCode, "{ctrl|alt|shift|meta}"]
|
||||
if (Array.isArray(k) && e.which === k[0] && e[k[1] + 'Key']) {
|
||||
cb();
|
||||
return true;
|
||||
}
|
||||
if (e.which === k && !e.shiftKey && !e.altKey && !e.metaKey && !e.ctrlKey) {
|
||||
cb();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
};
|
||||
$(el || window).keydown(handler);
|
||||
return handler;
|
||||
|
@ -318,7 +329,7 @@ define([
|
|||
b.onClick();
|
||||
close($(this).parents('.alertify').first());
|
||||
});
|
||||
if (b.keys && b.keys.length) { $(button).attr('data-keys', b.keys.join(',')); }
|
||||
if (b.keys && b.keys.length) { $(button).attr('data-keys', JSON.stringify(b.keys)); }
|
||||
navs.push(button);
|
||||
});
|
||||
var frame = h('div', [
|
||||
|
@ -334,7 +345,7 @@ define([
|
|||
content
|
||||
]);
|
||||
$(frame).find('button[data-keys]').each(function (i, el) {
|
||||
var keys = $(el).attr('data-keys');
|
||||
var keys = JSON.parse($(el).attr('data-keys'));
|
||||
customListenForKeys(keys, function () {
|
||||
if (!$(el).is(':visible')) { return; }
|
||||
$(el).click();
|
||||
|
|
|
@ -298,24 +298,26 @@ define([
|
|||
$(link).find('#cp-share-link-preview').val(getLinkValue());
|
||||
});
|
||||
var linkButtons = [{
|
||||
name: Messages.cancel,
|
||||
onClick: function () {},
|
||||
keys: [27]
|
||||
}, {
|
||||
name: Messages.share_linkCopy,
|
||||
onClick: function () {
|
||||
saveValue();
|
||||
var v = getLinkValue();
|
||||
var success = Clipboard.copy(v);
|
||||
if (success) { UI.log(Messages.shareSuccess); }
|
||||
}
|
||||
},
|
||||
keys: [13]
|
||||
}, {
|
||||
name: Messages.share_linkOpen,
|
||||
onClick: function () {
|
||||
saveValue();
|
||||
var v = getLinkValue();
|
||||
window.open(v);
|
||||
}
|
||||
}, {
|
||||
name: Messages.cancel,
|
||||
onClick: function () {},
|
||||
keys: [27]
|
||||
},
|
||||
keys: [[13, 'ctrl']]
|
||||
}];
|
||||
var frameLink = UI.dialog.customModal(link, {buttons: linkButtons});
|
||||
|
||||
|
@ -334,29 +336,30 @@ define([
|
|||
UI.dialog.selectable(getEmbedValue())
|
||||
]);
|
||||
var embedButtons = [{
|
||||
name: Messages.cancel,
|
||||
onClick: function () {},
|
||||
keys: [27]
|
||||
}, {
|
||||
name: Messages.share_linkCopy,
|
||||
onClick: function () {
|
||||
var v = getEmbedValue();
|
||||
var success = Clipboard.copy(v);
|
||||
if (success) { UI.log(Messages.shareSuccess); }
|
||||
}
|
||||
}, {
|
||||
name: Messages.cancel,
|
||||
onClick: function () {},
|
||||
keys: [27]
|
||||
},
|
||||
keys: [13]
|
||||
}];
|
||||
var frameEmbed = UI.dialog.customModal(embed, { buttons: embedButtons});
|
||||
|
||||
// Create modal
|
||||
var tabs = UI.dialog.tabs([{
|
||||
var tabs = [{
|
||||
title: Messages.share_linkCategory,
|
||||
content: frameLink
|
||||
}, {
|
||||
title: Messages.share_embedCategory,
|
||||
content: frameEmbed
|
||||
}]);
|
||||
}];
|
||||
if (typeof(AppConfig.customizeShareOptions) === 'function') {
|
||||
Config.customizeShareOptions(hashes, tabs, {
|
||||
AppConfig.customizeShareOptions(hashes, tabs, {
|
||||
type: 'DEFAULT',
|
||||
origin: origin,
|
||||
pathname: pathname
|
||||
|
@ -369,7 +372,7 @@ define([
|
|||
}
|
||||
if (val.embed) { $(link).find('#cp-share-embed').attr('checked', true); }
|
||||
if (val.present) { $(link).find('#cp-share-present').attr('checked', true); }
|
||||
UI.openCustomModal(tabs);
|
||||
UI.openCustomModal(UI.dialog.tabs(tabs));
|
||||
});
|
||||
};
|
||||
UIElements.createFileShareModal = function (config) {
|
||||
|
@ -389,16 +392,17 @@ define([
|
|||
var getLinkValue = function () { return url; };
|
||||
$(link).find('#cp-share-link-preview').val(getLinkValue());
|
||||
var linkButtons = [{
|
||||
name: Messages.cancel,
|
||||
onClick: function () {},
|
||||
keys: [27]
|
||||
}, {
|
||||
name: Messages.share_linkCopy,
|
||||
onClick: function () {
|
||||
var v = getLinkValue();
|
||||
var success = Clipboard.copy(v);
|
||||
if (success) { UI.log(Messages.shareSuccess); }
|
||||
}
|
||||
}, {
|
||||
name: Messages.cancel,
|
||||
onClick: function () {},
|
||||
keys: [27]
|
||||
},
|
||||
keys: [13]
|
||||
}];
|
||||
var frameLink = UI.dialog.customModal(link, {buttons: linkButtons});
|
||||
|
||||
|
@ -413,35 +417,36 @@ define([
|
|||
UI.dialog.selectable(common.getMediatagFromHref(url)),
|
||||
]);
|
||||
var embedButtons = [{
|
||||
name: Messages.cancel,
|
||||
onClick: function () {},
|
||||
keys: [27]
|
||||
}, {
|
||||
name: Messages.share_mediatagCopy,
|
||||
onClick: function () {
|
||||
var v = common.getMediatagFromHref(url);
|
||||
var success = Clipboard.copy(v);
|
||||
if (success) { UI.log(Messages.shareSuccess); }
|
||||
}
|
||||
}, {
|
||||
name: Messages.cancel,
|
||||
onClick: function () {},
|
||||
keys: [27]
|
||||
},
|
||||
keys: [13]
|
||||
}];
|
||||
var frameEmbed = UI.dialog.customModal(embed, { buttons: embedButtons});
|
||||
|
||||
// Create modal
|
||||
var tabs = UI.dialog.tabs([{
|
||||
var tabs = [{
|
||||
title: Messages.share_linkCategory,
|
||||
content: frameLink
|
||||
}, {
|
||||
title: Messages.share_embedCategory,
|
||||
content: frameEmbed
|
||||
}]);
|
||||
}];
|
||||
if (typeof(AppConfig.customizeShareOptions) === 'function') {
|
||||
Config.customizeShareOptions(hashes, tabs, {
|
||||
AppConfig.customizeShareOptions(hashes, tabs, {
|
||||
type: 'FILE',
|
||||
origin: origin,
|
||||
pathname: pathname
|
||||
});
|
||||
}
|
||||
UI.openCustomModal(tabs);
|
||||
UI.openCustomModal(UI.dialog.tabs(tabs));
|
||||
};
|
||||
|
||||
UIElements.createButton = function (common, type, rightside, data, callback) {
|
||||
|
|
|
@ -2280,7 +2280,7 @@ define([
|
|||
$element.appendTo($list);
|
||||
});
|
||||
|
||||
createGhostIcon($list);
|
||||
if (!inTrash) { createGhostIcon($list); }
|
||||
}
|
||||
$content.append($info).append($dirContent);
|
||||
|
||||
|
|
Loading…
Reference in New Issue