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

This commit is contained in:
ansuz
2017-07-12 10:46:15 +02:00
22 changed files with 545 additions and 242 deletions

View File

@@ -1657,7 +1657,7 @@ define([
content: Messages.user_rename
});
}
if (account) {
if (account && parsed && (!parsed.type || parsed.type !== 'profile')) {
options.push({
tag: 'a',
attributes: {'class': 'profile'},

View File

@@ -143,7 +143,17 @@ define([
DiffMd.apply = function (newHtml, $content) {
var id = $content.attr('id');
if (!id) { throw new Error("The element must have a valid id"); }
var $div = $('<div>', {id: id}).append(newHtml);
var pattern = /(<media-tag src="([^"]*)" data-crypto-key="([^"]*)">)<\/media-tag>/g;
var newHtmlFixed = newHtml.replace(pattern, function (all, tag, src) {
var mt = tag;
if (mediaMap[src]) {
mediaMap[src].forEach(function (n) {
mt += n.outerHTML;
});
}
return mt + '</media-tag>';
});
var $div = $('<div>', {id: id}).append(newHtmlFixed);
var Dom = domFromHTML($('<div>').append($div).html());
var oldDom = domFromHTML($content[0].outerHTML);
var patch = makeDiff(oldDom, Dom, id);
@@ -154,9 +164,11 @@ define([
var $mts = $content.find('media-tag:not(:has(*))');
$mts.each(function (i, el) {
MediaTag(el);
console.log(el.outerHTML);
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
if (mutation.type === 'childList') {
console.log(el.outerHTML);
var list_values = [].slice.call(el.children);
mediaMap[el.getAttribute('src')] = list_values;
}

View File

@@ -600,6 +600,21 @@ define([
return $titleContainer;
};
var createPageTitle = function (toolbar, config) {
if (config.title || !config.pageTitle) { return; }
var $titleContainer = $('<span>', {
id: 'toolbarTitle',
'class': TITLE_CLS
}).appendTo(toolbar.$top);
var $hoverable = $('<span>', {'class': 'hoverable'}).appendTo($titleContainer);
// Buttons
$('<span>', {
'class': 'title pageTitle'
}).appendTo($hoverable).text(config.pageTitle);
};
var createLinkToMain = function (toolbar) {
var $linkContainer = $('<span>', {
'class': "cryptpad-link"
@@ -823,7 +838,6 @@ define([
console.error(err);
return;
}
updateDisplayName(toolbar, config);
Cryptpad.changeDisplayName(newName, true);
});
});
@@ -831,6 +845,7 @@ define([
});
Cryptpad.onDisplayNameChanged(function () {
Cryptpad.findCancelButton().click();
updateDisplayName(toolbar, config);
});
updateDisplayName(toolbar, config);
@@ -1020,6 +1035,7 @@ define([
tb['share'] = createShare;
tb['fileshare'] = createFileShare;
tb['title'] = createTitle;
tb['pageTitle'] = createPageTitle;
tb['lag'] = createLag;
tb['spinner'] = createSpinner;
tb['state'] = createState;