Merge branch 'staging' of github.com:xwiki-labs/cryptpad into staging

pull/1/head
ansuz 5 years ago
commit 459c2ba7e3

@ -44,6 +44,13 @@
text-overflow: ellipsis; text-overflow: ellipsis;
} }
} }
div.plain-text-reader {
background: #f3f3f3;
padding: 10px;
color: black;
text-align: left;
}
} }
.markdown_preformatted-code (@color: #333) { .markdown_preformatted-code (@color: #333) {

@ -592,6 +592,16 @@ define([
]); ]);
}; };
UI.createHelper = function (href, text) {
var q = h('a.fa.fa-question-circle', {
style: 'text-decoration: none !important;',
title: text,
href: href,
target: "_blank",
'data-tippy-placement': "right"
});
return q;
};
/* /*
* spinner * spinner

@ -76,6 +76,7 @@
text: function (metadata, url, content, cfg, cb) { text: function (metadata, url, content, cfg, cb) {
var plainText = document.createElement('div'); var plainText = document.createElement('div');
plainText.className = "plain-text-reader"; plainText.className = "plain-text-reader";
plainText.setAttribute('style', 'white-space: pre-wrap;');
var reader = new FileReader(); var reader = new FileReader();
reader.addEventListener('loadend', function (e) { reader.addEventListener('loadend', function (e) {
plainText.innerText = e.srcElement.result; plainText.innerText = e.srcElement.result;

@ -492,8 +492,8 @@ define([
_addSharedFolder(Env, { _addSharedFolder(Env, {
path: parentPath, path: parentPath,
name: folderName, name: folderName,
owned: true, // XXX FIXME hardcoded preference owned: data.owned, // XXX FIXME hardcoded preference
password: '', // XXX FIXME hardcoded preference password: data.password || '', // XXX FIXME hardcoded preference
}, waitFor(function (id) { }, waitFor(function (id) {
// _addSharedFolder can be an id or an error // _addSharedFolder can be an id or an error
if (typeof(id) === 'object' && id && id.error) { if (typeof(id) === 'object' && id && id.error) {
@ -1012,11 +1012,13 @@ define([
} }
}, cb); }, cb);
}; };
var convertFolderToSharedFolderInner = function (Env, path, cb) { var convertFolderToSharedFolderInner = function (Env, path, owned, password, cb) {
return void Env.sframeChan.query("Q_DRIVE_USEROBJECT", { return void Env.sframeChan.query("Q_DRIVE_USEROBJECT", {
cmd: "convertFolderToSharedFolder", cmd: "convertFolderToSharedFolder",
data: { data: {
path: path path: path,
owned: owned,
password: password
} }
}, cb); }, cb);
}; };

@ -257,14 +257,7 @@ define([
store: true store: true
}; };
var createHelper = function (href, text) { var createHelper = function (href, text) {
var q = h('a.fa.fa-question-circle', { return UI.createHelper(origin + href, text);
style: 'text-decoration: none !important;',
title: text,
href: origin + href,
target: "_blank",
'data-tippy-placement': "right"
});
return q;
}; };
var createManualStore = function (isFolderUpload) { var createManualStore = function (isFolderUpload) {
var privateData = common.getMetadataMgr().getPrivateData(); var privateData = common.getMetadataMgr().getPrivateData();

@ -3940,12 +3940,28 @@ define([
else if (manager.hasSubSharedFolder(el)) { else if (manager.hasSubSharedFolder(el)) {
return void UI.alert(Messages.convertFolderToSF_SFChildren); return void UI.alert(Messages.convertFolderToSF_SFChildren);
} }
// if root
else if (paths[0].path.length <= 1) {
return void UI.warn(Messages.error);
}
// if folder does not contains SF // if folder does not contains SF
else { else {
return void UI.confirm(Messages.convertFolderToSF_confirm, function(res) { var convertContent = h('div', [
h('p', Messages.convertFolderToSF_confirm),
h('label', {for: 'cp-upload-password'}, Messages.creation_passwordValue),
UI.passwordInput({id: 'cp-upload-password'}),
h('span', {
style: 'display:flex;align-items:center;justify-content:space-between'
}, [
UI.createCheckbox('cp-upload-owned', Messages.sharedFolders_create_owned, true),
UI.createHelper(APP.origin + '/faq.html#keywords-owned', Messages.creation_owned1)
]),
]);
return void UI.confirm(convertContent, function(res) {
if (!res) { return; } if (!res) { return; }
if (paths[0].path.length <= 1) { return; } // if root var password = $(convertContent).find('#cp-upload-password').val() || undefined;
manager.convertFolderToSharedFolder(paths[0].path, refresh); var owned = Util.isChecked($(convertContent).find('#cp-upload-owned'));
manager.convertFolderToSharedFolder(paths[0].path, owned, password, refresh);
}); });
} }
} else { // File } else { // File

Loading…
Cancel
Save