Fix share modal extension point

This commit is contained in:
yflory 2018-01-18 11:16:30 +01:00
parent caf9797c7c
commit 6a906e3770
2 changed files with 8 additions and 11 deletions

View File

@ -57,12 +57,9 @@ define([
}; };
var customListenForKeys = function (keys, cb, el) { var customListenForKeys = function (keys, cb, el) {
if (!keys || !keys.length || typeof cb !== "function") { return; } if (!keys || !keys.length || typeof cb !== "function") { return; }
console.log(keys);
var handler = function (e) { var handler = function (e) {
console.log('keydown', e.which);
e.stopPropagation(); e.stopPropagation();
keys.some(function (k) { keys.some(function (k) {
console.log(k);
// k is number or array // k is number or array
// if it's an array, it should be [keyCode, "{ctrl|alt|shift|meta}"] // 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']) { if (Array.isArray(k) && e.which === k[0] && e[k[1] + 'Key']) {

View File

@ -351,15 +351,15 @@ define([
var frameEmbed = UI.dialog.customModal(embed, { buttons: embedButtons}); var frameEmbed = UI.dialog.customModal(embed, { buttons: embedButtons});
// Create modal // Create modal
var tabs = UI.dialog.tabs([{ var tabs = [{
title: Messages.share_linkCategory, title: Messages.share_linkCategory,
content: frameLink content: frameLink
}, { }, {
title: Messages.share_embedCategory, title: Messages.share_embedCategory,
content: frameEmbed content: frameEmbed
}]); }];
if (typeof(AppConfig.customizeShareOptions) === 'function') { if (typeof(AppConfig.customizeShareOptions) === 'function') {
Config.customizeShareOptions(hashes, tabs, { AppConfig.customizeShareOptions(hashes, tabs, {
type: 'DEFAULT', type: 'DEFAULT',
origin: origin, origin: origin,
pathname: pathname pathname: pathname
@ -372,7 +372,7 @@ define([
} }
if (val.embed) { $(link).find('#cp-share-embed').attr('checked', true); } if (val.embed) { $(link).find('#cp-share-embed').attr('checked', true); }
if (val.present) { $(link).find('#cp-share-present').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) { UIElements.createFileShareModal = function (config) {
@ -432,21 +432,21 @@ define([
var frameEmbed = UI.dialog.customModal(embed, { buttons: embedButtons}); var frameEmbed = UI.dialog.customModal(embed, { buttons: embedButtons});
// Create modal // Create modal
var tabs = UI.dialog.tabs([{ var tabs = [{
title: Messages.share_linkCategory, title: Messages.share_linkCategory,
content: frameLink content: frameLink
}, { }, {
title: Messages.share_embedCategory, title: Messages.share_embedCategory,
content: frameEmbed content: frameEmbed
}]); }];
if (typeof(AppConfig.customizeShareOptions) === 'function') { if (typeof(AppConfig.customizeShareOptions) === 'function') {
Config.customizeShareOptions(hashes, tabs, { AppConfig.customizeShareOptions(hashes, tabs, {
type: 'FILE', type: 'FILE',
origin: origin, origin: origin,
pathname: pathname pathname: pathname
}); });
} }
UI.openCustomModal(tabs); UI.openCustomModal(UI.dialog.tabs(tabs));
}; };
UIElements.createButton = function (common, type, rightside, data, callback) { UIElements.createButton = function (common, type, rightside, data, callback) {