Merge branch 'staging' into trim-history

pull/1/head
ansuz 5 years ago
commit 50ea551b36

@ -168,6 +168,9 @@
margin-bottom: 0;
}
}
.cp-alertify-type-container {
overflow: visible !important;
}
.alertify-tabs {
max-height: 100%;
display: flex;

@ -23,6 +23,23 @@
}
}
div.cp-alertify-type {
display: flex;
input {
margin: 0;
flex: 1;
min-width: 0;
}
span {
button {
margin: 0;
height: 100%;
margin-left: -1px;
text-transform: unset !important;
}
}
}
textarea {
padding: 8px;
&[readonly] {

@ -17,8 +17,7 @@
button {
.fa-caret-down {
margin-right: 0px;
margin-left: 5px;
margin-right: 1em !important;
}
* {
.tools_unselectable();

@ -14,7 +14,7 @@
.radio-group {
display: flex;
flex-direction: row;
&:not(:last-child){
&:not(:last-child) {
margin-bottom: 8px;
}
.cp-radio {

@ -20,7 +20,7 @@ define(function() {
* users and these users will be redirected to the login page if they still try to access
* the app
*/
config.registeredOnlyTypes = ['file', 'contacts', 'oodoc', 'ooslide', 'sheet', 'notifications'];
config.registeredOnlyTypes = ['file', 'contacts', 'oodoc', 'ooslide', 'notifications'];
/* CryptPad is available is multiple languages, but only English and French are maintained
* by the developers. The other languages may be outdated, and any missing string for a langauge

@ -161,6 +161,17 @@ define([
return h('p.msg', h('input', attrs));
};
dialog.textTypeInput = function (dropdown) {
var attrs = {
type: 'text',
'class': 'cp-text-type-input',
};
return h('p.msg.cp-alertify-type-container', h('div.cp-alertify-type', [
h('input', attrs),
dropdown // must be a "span"
]));
};
dialog.nav = function (content) {
return h('nav', content || [
dialog.cancelButton(),
@ -186,6 +197,7 @@ define([
});
};
return $frame.click(function (e) {
$frame.find('.cp-dropdown-content').hide();
e.stopPropagation();
})[0];
};
@ -480,7 +492,8 @@ define([
cb = cb || function () {};
opt = opt || {};
var inputBlock = opt.password ? UI.passwordInput() : dialog.textInput();
var inputBlock = opt.password ? UI.passwordInput() :
(opt.typeInput ? dialog.textTypeInput(opt.typeInput) : dialog.textInput());
var input = $(inputBlock).is('input') ? inputBlock : $(inputBlock).find('input')[0];
input.value = typeof(def) === 'string'? def: '';

@ -2896,9 +2896,11 @@ define([
var $button = $('<button>', {
'class': ''
}).append($('<span>', {'class': 'cp-dropdown-button-title'}).html(config.text || ""));
/*$('<span>', {
if (config.caretDown) {
$('<span>', {
'class': 'fa fa-caret-down',
}).appendTo($button);*/
}).prependTo($button);
}
// Menu
var $innerblock = $('<div>', {'class': 'cp-dropdown-content'});
@ -2965,6 +2967,12 @@ define([
if (config.isSelect) {
var pressed = '';
var to;
$container.on('click', 'a', function () {
value = $(this).data('value');
var $val = $(this);
var textValue = $val.html() || value;
$button.find('.cp-dropdown-button-title').html(textValue);
});
$container.keydown(function (e) {
var $value = $innerblock.find('[data-value].cp-dropdown-element-active:visible');
if (e.which === 38) { // Up

@ -584,7 +584,9 @@ define([
ooChannel.cpIndex++;
ooChannel.lastHash = hash;
// Check if a checkpoint is needed
if (ooChannel.cpIndex % CHECKPOINT_INTERVAL === 0) {
var lastCp = getLastCp();
if (common.isLoggedIn() && (ooChannel.cpIndex % CHECKPOINT_INTERVAL === 0 ||
(ooChannel.cpIndex - lastCp.index) > CHECKPOINT_INTERVAL)) {
makeCheckpoint();
}
// Remove my lock
@ -662,7 +664,7 @@ define([
var startOO = function (blob, file) {
if (APP.ooconfig) { return void console.error('already started'); }
var url = URL.createObjectURL(blob);
var lock = readOnly || !common.isLoggedIn();
var lock = readOnly;// || !common.isLoggedIn();
// Config
APP.ooconfig = {

@ -6,9 +6,11 @@ define([
'/bower_components/nthen/index.js',
'/common/sframe-common.js',
'/customize/messages.js',
'/common/hyperscript.js',
'/common/common-util.js',
'/common/common-hash.js',
'/common/common-interface.js',
'/common/common-ui-elements.js',
'/common/common-thumbnail.js',
'/common/common-feedback.js',
'/customize/application_config.js',
@ -26,9 +28,11 @@ define([
nThen,
SFCommon,
Messages,
h,
Util,
Hash,
UI,
UIElements,
Thumb,
Feedback,
AppConfig,
@ -408,10 +412,36 @@ define([
var $export = common.createButton('export', true, {}, function () {
var ext = (typeof(extension) === 'function') ? extension() : extension;
var suggestion = title.suggestTitle('cryptpad-document');
ext = ext || '.txt';
var types = [{
tag: 'a',
attributes: {
'data-value': ext,
'href': '#'
},
content: ext
}, {
tag: 'a',
attributes: {
'data-value': '',
'href': '#'
},
content: '&nbsp;'
}];
var dropdownConfig = {
text: ext, // Button initial text
caretDown: true,
options: types, // Entries displayed in the menu
isSelect: true,
initialValue: ext,
common: common
};
var $select = UIElements.createDropdown(dropdownConfig);
UI.prompt(Messages.exportPrompt,
Util.fixFileName(suggestion) + ext, function (filename)
Util.fixFileName(suggestion), function (filename)
{
if (!(typeof(filename) === 'string' && filename)) { return; }
filename = filename + $select.getValue();
if (async) {
fe(function (blob) {
SaveAs(blob, filename);
@ -420,6 +450,8 @@ define([
}
var blob = fe();
SaveAs(blob, filename);
}, {
typeInput: $select[0]
});
});
toolbar.$drawer.append($export);

Loading…
Cancel
Save