Merge branch 'staging' into trim-history

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

@ -168,6 +168,9 @@
margin-bottom: 0; margin-bottom: 0;
} }
} }
.cp-alertify-type-container {
overflow: visible !important;
}
.alertify-tabs { .alertify-tabs {
max-height: 100%; max-height: 100%;
display: flex; 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 { textarea {
padding: 8px; padding: 8px;
&[readonly] { &[readonly] {

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

@ -14,7 +14,7 @@
.radio-group { .radio-group {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
&:not(:last-child){ &:not(:last-child) {
margin-bottom: 8px; margin-bottom: 8px;
} }
.cp-radio { .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 * users and these users will be redirected to the login page if they still try to access
* the app * 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 /* 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 * 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)); 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) { dialog.nav = function (content) {
return h('nav', content || [ return h('nav', content || [
dialog.cancelButton(), dialog.cancelButton(),
@ -186,6 +197,7 @@ define([
}); });
}; };
return $frame.click(function (e) { return $frame.click(function (e) {
$frame.find('.cp-dropdown-content').hide();
e.stopPropagation(); e.stopPropagation();
})[0]; })[0];
}; };
@ -480,7 +492,8 @@ define([
cb = cb || function () {}; cb = cb || function () {};
opt = opt || {}; 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]; var input = $(inputBlock).is('input') ? inputBlock : $(inputBlock).find('input')[0];
input.value = typeof(def) === 'string'? def: ''; input.value = typeof(def) === 'string'? def: '';

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

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

@ -6,9 +6,11 @@ define([
'/bower_components/nthen/index.js', '/bower_components/nthen/index.js',
'/common/sframe-common.js', '/common/sframe-common.js',
'/customize/messages.js', '/customize/messages.js',
'/common/hyperscript.js',
'/common/common-util.js', '/common/common-util.js',
'/common/common-hash.js', '/common/common-hash.js',
'/common/common-interface.js', '/common/common-interface.js',
'/common/common-ui-elements.js',
'/common/common-thumbnail.js', '/common/common-thumbnail.js',
'/common/common-feedback.js', '/common/common-feedback.js',
'/customize/application_config.js', '/customize/application_config.js',
@ -26,9 +28,11 @@ define([
nThen, nThen,
SFCommon, SFCommon,
Messages, Messages,
h,
Util, Util,
Hash, Hash,
UI, UI,
UIElements,
Thumb, Thumb,
Feedback, Feedback,
AppConfig, AppConfig,
@ -408,10 +412,36 @@ define([
var $export = common.createButton('export', true, {}, function () { var $export = common.createButton('export', true, {}, function () {
var ext = (typeof(extension) === 'function') ? extension() : extension; var ext = (typeof(extension) === 'function') ? extension() : extension;
var suggestion = title.suggestTitle('cryptpad-document'); 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, UI.prompt(Messages.exportPrompt,
Util.fixFileName(suggestion) + ext, function (filename) Util.fixFileName(suggestion), function (filename)
{ {
if (!(typeof(filename) === 'string' && filename)) { return; } if (!(typeof(filename) === 'string' && filename)) { return; }
filename = filename + $select.getValue();
if (async) { if (async) {
fe(function (blob) { fe(function (blob) {
SaveAs(blob, filename); SaveAs(blob, filename);
@ -420,6 +450,8 @@ define([
} }
var blob = fe(); var blob = fe();
SaveAs(blob, filename); SaveAs(blob, filename);
}, {
typeInput: $select[0]
}); });
}); });
toolbar.$drawer.append($export); toolbar.$drawer.append($export);

Loading…
Cancel
Save