mirror of https://github.com/xwiki-labs/cryptpad
Merge branch 'staging' of github.com:xwiki-labs/cryptpad into staging
This commit is contained in:
commit
8c4ed76fa7
|
@ -92,16 +92,25 @@ define([
|
|||
]);
|
||||
}
|
||||
|
||||
var button = h('button.navbar-toggler', {
|
||||
'type':'button',
|
||||
/*'data-toggle':'collapse',
|
||||
'data-target':'#menuCollapse',
|
||||
'aria-controls': 'menuCollapse',
|
||||
'aria-expanded':'false',
|
||||
'aria-label':'Toggle navigation'*/
|
||||
}, h('i.fa.fa-bars '));
|
||||
|
||||
$(button).click(function () {
|
||||
if ($('#menuCollapse').is(':visible')) {
|
||||
return void $('#menuCollapse').slideUp();
|
||||
}
|
||||
$('#menuCollapse').slideDown();
|
||||
});
|
||||
|
||||
return h('nav.navbar.navbar-expand-lg',
|
||||
h('a.navbar-brand', { href: '/index.html'}),
|
||||
h('button.navbar-toggler', {
|
||||
'type':'button',
|
||||
'data-toggle':'collapse',
|
||||
'data-target':'#menuCollapse',
|
||||
'aria-controls': 'menuCollapse',
|
||||
'aria-expanded':'false',
|
||||
'aria-label':'Toggle navigation'
|
||||
}, h('i.fa.fa-bars ')),
|
||||
button,
|
||||
h('div.collapse.navbar-collapse.justify-content-end#menuCollapse', [
|
||||
//h('a.nav-item.nav-link', { href: '/what-is-cryptpad.html'}, Msg.topbar_whatIsCryptpad), // Moved the FAQ
|
||||
h('a.nav-item.nav-link', { href: '/faq.html'}, Msg.faq_link),
|
||||
|
|
|
@ -55,9 +55,23 @@
|
|||
user-select: none;
|
||||
float: none;
|
||||
text-align: left;
|
||||
font: @dropdown_font;
|
||||
line-height: 1em;
|
||||
align-items: center;
|
||||
|
||||
&:not(.fa) {
|
||||
font: @dropdown_font;
|
||||
}
|
||||
&.fa {
|
||||
font-size: 18px;
|
||||
&::before {
|
||||
width: 40px;
|
||||
margin-left: -10px;
|
||||
text-align: center;
|
||||
}
|
||||
* {
|
||||
font: @dropdown_font;
|
||||
}
|
||||
}
|
||||
|
||||
.fa {
|
||||
width: 20px;
|
||||
|
|
|
@ -27,8 +27,7 @@ $(function () {
|
|||
window.Tether = function () {};
|
||||
require([
|
||||
'less!/customize/src/less2/main.less',
|
||||
'css!/bower_components/bootstrap/dist/css/bootstrap.min.css',
|
||||
'/bower_components/bootstrap/dist/js/bootstrap.bundle.min.js'
|
||||
'css!/bower_components/bootstrap/dist/css/bootstrap.min.css'
|
||||
], function () {
|
||||
$body.append($main);
|
||||
|
||||
|
|
|
@ -145,6 +145,8 @@ define(function () {
|
|||
out.useTemplate = "Commencer avec un modèle?";
|
||||
out.useTemplateOK = 'Choisir un modèle (Entrée)';
|
||||
out.useTemplateCancel = 'Document vierge (Échap)';
|
||||
out.template_import = "Importer un modèle";
|
||||
out.template_empty = "Aucun modèle disponible";
|
||||
|
||||
out.previewButtonTitle = "Afficher ou cacher la prévisualisation de Markdown";
|
||||
|
||||
|
@ -611,9 +613,6 @@ define(function () {
|
|||
out.pad_showToolbar = "Afficher la barre d'outils";
|
||||
out.pad_hideToolbar = "Cacher la barre d'outils";
|
||||
|
||||
// general warnings
|
||||
out.warn_notPinned = "Ce pad n'est stocké dans aucun CryptDrive. Il va expirer après 3 mois d'inactivité. <a href='/about.html#pinning'>En savoir plus...</a>";
|
||||
|
||||
// markdown toolbar
|
||||
out.mdToolbar_button = "Afficher ou cacher la barre d'outils Markdown";
|
||||
out.mdToolbar_defaultText = "Votre texte ici";
|
||||
|
@ -952,8 +951,6 @@ define(function () {
|
|||
|
||||
// Header.html
|
||||
|
||||
out.header_france = '<a href="http://www.xwiki.com/fr" target="_blank" rel="noopener noreferrer">Fait avec <img class="bottom-bar-heart" src="/customize/heart.png" alt="amour" /> en <img class="bottom-bar-fr" title="France" alt="France" src="/customize/fr.png" /> par <img src="/customize/logo-xwiki.png" alt="XWiki SAS" class="bottom-bar-xwiki"/></a>';
|
||||
out.header_support = '<a href="http://ng.open-paas.org/" title="OpenPaaS::ng" target="_blank" rel="noopener noreferrer"> <img src="/customize/openpaasng.png" alt="OpenPaaS-ng" class="bottom-bar-openpaas" /></a>';
|
||||
out.updated_0_header_logoTitle = 'Retourner vers votre CryptDrive';
|
||||
out.header_logoTitle = out.updated_0_header_logoTitle;
|
||||
out.header_homeTitle = "Aller sur la page d'accueil";
|
||||
|
|
|
@ -146,6 +146,8 @@ define(function () {
|
|||
out.useTemplate = "Start with a template?"; //Would you like to "You have available templates for this type of pad. Do you want to use one?";
|
||||
out.useTemplateOK = 'Pick a template (Enter)';
|
||||
out.useTemplateCancel = 'Start fresh (Esc)';
|
||||
out.template_import = "Import a template";
|
||||
out.template_empty = "No template available";
|
||||
|
||||
out.previewButtonTitle = "Display or hide the Markdown preview mode";
|
||||
|
||||
|
@ -615,9 +617,6 @@ define(function () {
|
|||
out.pad_showToolbar = "Show toolbar";
|
||||
out.pad_hideToolbar = "Hide toolbar";
|
||||
|
||||
// general warnings
|
||||
out.warn_notPinned = "This pad is not in anyone's CryptDrive. It will expire after 3 months. <a href='/about.html#pinning'>Learn more...</a>";
|
||||
|
||||
// markdown toolbar
|
||||
out.mdToolbar_button = "Show or hide the Markdown toolbar";
|
||||
out.mdToolbar_defaultText = "Your text here";
|
||||
|
@ -996,9 +995,6 @@ define(function () {
|
|||
|
||||
// Header.html
|
||||
|
||||
out.header_france = '<a href="http://www.xwiki.com/" target="_blank" rel="noopener noreferrer">With <img class="bottom-bar-heart" src="/customize/heart.png" alt="love" /> from <img class="bottom-bar-fr" src="/customize/fr.png" title="France" alt="France"/> by <img src="/customize/logo-xwiki.png" alt="XWiki SAS" class="bottom-bar-xwiki"/></a>';
|
||||
|
||||
out.header_support = '<a href="http://ng.open-paas.org/" title="OpenPaaS::ng" target="_blank" rel="noopener noreferrer"> <img src="/customize/openpaasng.png" alt="OpenPaaS-ng" class="bottom-bar-openpaas" /></a>';
|
||||
out.updated_0_header_logoTitle = 'Go to your CryptDrive';
|
||||
out.header_logoTitle = out.updated_0_header_logoTitle;
|
||||
out.header_homeTitle = 'Go to CryptPad homepage';
|
||||
|
|
|
@ -482,13 +482,44 @@ define([
|
|||
'class': 'fa fa-upload cp-toolbar-icon-import',
|
||||
title: Messages.importButtonTitle,
|
||||
}).append($('<span>', {'class': 'cp-toolbar-drawer-element'}).text(Messages.importButton));
|
||||
if (callback) {
|
||||
/*if (data.types) {
|
||||
// New import button in the toolbar
|
||||
var importFunction = {
|
||||
template: function () {
|
||||
UIElements.openTemplatePicker(common, true);
|
||||
},
|
||||
file: function (cb) {
|
||||
importContent('text/plain', function (content, file) {
|
||||
cb(content, file);
|
||||
}, {accept: data ? data.accept : undefined})
|
||||
}
|
||||
};
|
||||
var toImport = [];
|
||||
Object.keys(data.types).forEach(function (importType) {
|
||||
if (!importFunction[importType] || !data.types[importType]) { return; }
|
||||
var option = h('button', importType);
|
||||
$(option).click(function () {
|
||||
importFunction[importType](data.types[importType]);
|
||||
});
|
||||
toImport.push(options);
|
||||
});
|
||||
|
||||
button.click(common.prepareFeedback(type));
|
||||
|
||||
if (toImport.length === 1) {
|
||||
button.click(function () { $(toImport[0]).click(); });
|
||||
} else {
|
||||
Cryptpad.alert(h('p.cp-import-container', toImport));
|
||||
}
|
||||
}
|
||||
else if (callback) {*/
|
||||
// Old import button, used in settings
|
||||
button
|
||||
.click(common.prepareFeedback(type))
|
||||
.click(importContent('text/plain', function (content, file) {
|
||||
callback(content, file);
|
||||
}, {accept: data ? data.accept : undefined}));
|
||||
}
|
||||
//}
|
||||
break;
|
||||
case 'upload':
|
||||
button = $('<button>', {
|
||||
|
@ -520,6 +551,17 @@ define([
|
|||
if (data.accept) { $input.attr('accept', data.accept); }
|
||||
button.click(function () { $input.click(); });
|
||||
break;
|
||||
case 'importtemplate':
|
||||
button = $('<button>', {
|
||||
'class': 'fa fa-upload cp-toolbar-icon-import',
|
||||
title: Messages.template_import,
|
||||
}).append($('<span>', {'class': 'cp-toolbar-drawer-element'}).text(Messages.template_import));
|
||||
button
|
||||
.click(common.prepareFeedback(type))
|
||||
.click(function () {
|
||||
UIElements.openTemplatePicker(common, true);
|
||||
});
|
||||
break;
|
||||
case 'template':
|
||||
if (!AppConfig.enableTemplates) { return; }
|
||||
if (!common.isLoggedIn()) { return; }
|
||||
|
@ -584,7 +626,8 @@ define([
|
|||
sframeChan.query('Q_MOVE_TO_TRASH', null, function (err) {
|
||||
if (err) { return void callback(err); }
|
||||
var cMsg = common.isLoggedIn() ? Messages.movedToTrash : Messages.deleted;
|
||||
UI.alert(cMsg, undefined, true);
|
||||
var msg = common.fixLinks($('<div>').html(cMsg));
|
||||
UI.alert(msg);
|
||||
callback();
|
||||
return;
|
||||
});
|
||||
|
@ -920,18 +963,7 @@ define([
|
|||
h('ul', elements)
|
||||
]);
|
||||
|
||||
var origin = common.getMetadataMgr().getPrivateData().origin || '';
|
||||
$(text).find('a').click(function (e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
var href = $(this).attr('href');
|
||||
var absolute = /^https?:\/\//i;
|
||||
if (!absolute.test(href)) {
|
||||
if (href.slice(0,1) !== '/') { href = '/' + href; }
|
||||
href = origin + href;
|
||||
}
|
||||
common.openUnsafeURL(href);
|
||||
});
|
||||
common.fixLinks(text);
|
||||
|
||||
var closeButton = h('span.cp-help-close.fa.fa-window-close');
|
||||
var $toolbarButton = common.createButton('', true, {
|
||||
|
@ -1422,50 +1454,51 @@ define([
|
|||
tag: 'a',
|
||||
attributes: {
|
||||
'target': '_blank',
|
||||
'href': origin+'/drive/'
|
||||
'href': origin+'/drive/',
|
||||
'class': 'fa fa-hdd-o'
|
||||
},
|
||||
content: Messages.login_accessDrive
|
||||
content: h('span', Messages.login_accessDrive)
|
||||
});
|
||||
}
|
||||
// Add the change display name button if not in read only mode
|
||||
if (config.changeNameButtonCls && config.displayChangeName && !AppConfig.disableProfile) {
|
||||
options.push({
|
||||
tag: 'a',
|
||||
attributes: {'class': config.changeNameButtonCls},
|
||||
content: Messages.user_rename
|
||||
attributes: {'class': config.changeNameButtonCls + ' fa fa-user'},
|
||||
content: h('span', Messages.user_rename)
|
||||
});
|
||||
}
|
||||
if (accountName && !AppConfig.disableProfile) {
|
||||
options.push({
|
||||
tag: 'a',
|
||||
attributes: {'class': 'cp-toolbar-menu-profile'},
|
||||
content: Messages.profileButton
|
||||
attributes: {'class': 'cp-toolbar-menu-profile fa fa-user-circle'},
|
||||
content: h('span', Messages.profileButton)
|
||||
});
|
||||
}
|
||||
if (padType !== 'settings') {
|
||||
options.push({
|
||||
tag: 'a',
|
||||
attributes: {'class': 'cp-toolbar-menu-settings'},
|
||||
content: Messages.settingsButton
|
||||
attributes: {'class': 'cp-toolbar-menu-settings fa fa-cog'},
|
||||
content: h('span', Messages.settingsButton)
|
||||
});
|
||||
}
|
||||
// Add login or logout button depending on the current status
|
||||
if (accountName) {
|
||||
options.push({
|
||||
tag: 'a',
|
||||
attributes: {'class': 'cp-toolbar-menu-logout'},
|
||||
content: Messages.logoutButton
|
||||
attributes: {'class': 'cp-toolbar-menu-logout fa fa-sign-out'},
|
||||
content: h('span', Messages.logoutButton)
|
||||
});
|
||||
} else {
|
||||
options.push({
|
||||
tag: 'a',
|
||||
attributes: {'class': 'cp-toolbar-menu-login'},
|
||||
content: Messages.login_login
|
||||
attributes: {'class': 'cp-toolbar-menu-login fa fa-sign-in'},
|
||||
content: h('span', Messages.login_login)
|
||||
});
|
||||
options.push({
|
||||
tag: 'a',
|
||||
attributes: {'class': 'cp-toolbar-menu-register'},
|
||||
content: Messages.login_register
|
||||
attributes: {'class': 'cp-toolbar-menu-register fa fa-user-plus'},
|
||||
content: h('span', Messages.login_register)
|
||||
});
|
||||
}
|
||||
var $icon = $('<span>', {'class': 'fa fa-user-secret'});
|
||||
|
@ -1521,9 +1554,8 @@ define([
|
|||
UIElements.displayAvatar(Common, $avatar, url,
|
||||
newName || Messages.anonymous, function ($img) {
|
||||
oldUrl = url;
|
||||
if ($img) {
|
||||
$userAdmin.find('> button').addClass('cp-avatar');
|
||||
}
|
||||
$userAdmin.find('> button').removeClass('cp-avatar');
|
||||
if ($img) { $userAdmin.find('> button').addClass('cp-avatar'); }
|
||||
loadingAvatar = false;
|
||||
});
|
||||
return;
|
||||
|
@ -1742,7 +1774,7 @@ define([
|
|||
sframeChan.event("EV_FILE_PICKER_OPEN", types);
|
||||
};
|
||||
|
||||
UIElements.openTemplatePicker = function (common) {
|
||||
UIElements.openTemplatePicker = function (common, force) {
|
||||
var metadataMgr = common.getMetadataMgr();
|
||||
var type = metadataMgr.getMetadataLazy().type;
|
||||
var sframeChan = common.getSframeChannel();
|
||||
|
@ -1782,10 +1814,13 @@ define([
|
|||
if (data) {
|
||||
common.openFilePicker(pickerCfg);
|
||||
focus = document.activeElement;
|
||||
if (force) { return void onConfirm(true); }
|
||||
UI.confirm(Messages.useTemplate, onConfirm, {
|
||||
ok: Messages.useTemplateOK,
|
||||
cancel: Messages.useTemplateCancel,
|
||||
});
|
||||
} else if (force) {
|
||||
UI.alert(Messages.template_empty);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
|
@ -34,6 +34,10 @@ define(['json.sortify'], function (Sortify) {
|
|||
}
|
||||
if (!metadataObj.users) { metadataObj.users = {}; }
|
||||
if (!metadataLazyObj.users) { metadataLazyObj.users = {}; }
|
||||
|
||||
if (!metadataObj.type) { metadataObj.type = meta.doc.type; }
|
||||
if (!metadataLazyObj.type) { metadataLazyObj.type = meta.doc.type; }
|
||||
|
||||
var mdo = {};
|
||||
// We don't want to add our user data to the object multiple times.
|
||||
//var containsYou = false;
|
||||
|
|
|
@ -572,6 +572,9 @@ define([
|
|||
toolbar.$rightside.append($templateButton);
|
||||
}
|
||||
|
||||
var $importTemplateButton = common.createButton('importtemplate', true);
|
||||
toolbar.$drawer.append($importTemplateButton);
|
||||
|
||||
/* add a forget button */
|
||||
toolbar.$rightside.append(common.createButton('forget', true, {}, function (err) {
|
||||
if (err) { return; }
|
||||
|
|
|
@ -643,10 +643,19 @@ define([
|
|||
replaceHash(Utils.Hash.getEditHashFromKeys(wc, secret.keys));
|
||||
}
|
||||
};
|
||||
Object.keys(rtConfig).forEach(function (k) {
|
||||
cpNfCfg[k] = rtConfig[k];
|
||||
|
||||
nThen(function (waitFor) {
|
||||
if (isNewFile && cfg.owned && !window.location.hash) {
|
||||
Cryptpad.getMetadata(waitFor(function (err, m) {
|
||||
cpNfCfg.owners = [m.priv.edPublic];
|
||||
}));
|
||||
}
|
||||
}).nThen(function () {
|
||||
Object.keys(rtConfig).forEach(function (k) {
|
||||
cpNfCfg[k] = rtConfig[k];
|
||||
});
|
||||
CpNfOuter.start(cpNfCfg);
|
||||
});
|
||||
CpNfOuter.start(cpNfCfg);
|
||||
};
|
||||
|
||||
sframeChan.on('Q_CREATE_PAD', function (data, cb) {
|
||||
|
|
|
@ -343,6 +343,27 @@ define([
|
|||
window.open(bounceHref);
|
||||
};
|
||||
|
||||
funcs.fixLinks = function (domElement) {
|
||||
var origin = ctx.metadataMgr.getPrivateData().origin;
|
||||
$(domElement).find('a[target="_blank"]').click(function (e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
var href = $(this).attr('href');
|
||||
var absolute = /^https?:\/\//i;
|
||||
if (!absolute.test(href)) {
|
||||
if (href.slice(0,1) !== '/') { href = '/' + href; }
|
||||
href = origin + href;
|
||||
}
|
||||
funcs.openUnsafeURL(href);
|
||||
});
|
||||
$(domElement).find('a[target!="_blank"]').click(function (e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
funcs.gotoURL($(this).attr('href'));
|
||||
});
|
||||
return $(domElement)[0];
|
||||
};
|
||||
|
||||
funcs.whenRealtimeSyncs = evRealtimeSynced.reg;
|
||||
|
||||
var logoutHandlers = [];
|
||||
|
|
|
@ -370,7 +370,8 @@ define([
|
|||
currentPath = [FILES_DATA];
|
||||
$tree.hide();
|
||||
if (Object.keys(files.root).length && !proxy.anonymousAlert) {
|
||||
UI.alert(Messages.fm_alert_anonymous, null, true);
|
||||
var msg = common.fixLinks($('<div>').html(Messages.fm_alert_anonymous));
|
||||
UI.alert(msg);
|
||||
proxy.anonymousAlert = true;
|
||||
}
|
||||
}
|
||||
|
@ -1516,13 +1517,7 @@ define([
|
|||
}
|
||||
if (!APP.loggedIn) {
|
||||
msg = Messages.fm_info_anonymous;
|
||||
$box.html(msg);
|
||||
$box.find('a[target!="_blank"]').click(function (e) {
|
||||
e.preventDefault();
|
||||
var href = $(this).attr('href');
|
||||
common.gotoURL(href);
|
||||
});
|
||||
return $box;
|
||||
return $(common.fixLinks($box.html(msg)));
|
||||
}
|
||||
if (!msg || APP.store['hide-info-' + path[0]] === '1') {
|
||||
$box.hide();
|
||||
|
|
|
@ -93,6 +93,7 @@ define([
|
|||
getSecrets: getSecrets,
|
||||
noHash: true, // Don't add the hash in the URL if it doesn't already exist
|
||||
addRpc: addRpc,
|
||||
owned: true
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -46,6 +46,7 @@ define([
|
|||
SFCommonO.start({
|
||||
getSecrets: getSecrets,
|
||||
noHash: true,
|
||||
owned: true
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue