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

German Translation Added.
pull/1/head
Michael Achmann 8 years ago
commit 1f82a44f95

@ -35,8 +35,23 @@ define([
window.Toolbar = Toolbar; window.Toolbar = Toolbar;
window.Hyperjson = Hyperjson; window.Hyperjson = Hyperjson;
var slice = function (coll) {
return Array.prototype.slice.call(coll);
};
var removeListeners = function (root) {
slice(root.attributes).map(function (attr) {
if (/^on/.test(attr.name)) {
root.attributes.removeNamedItem(attr.name);
}
});
slice(root.children).forEach(removeListeners);
};
var hjsonToDom = function (H) { var hjsonToDom = function (H) {
return Hyperjson.toDOM(H); //callOn(H, Hyperscript); var dom = Hyperjson.toDOM(H);
removeListeners(dom);
return dom;
}; };
var module = window.REALTIME_MODULE = window.APP = { var module = window.REALTIME_MODULE = window.APP = {

@ -435,7 +435,7 @@ define([
var msg = Messages.poll_addUser; var msg = Messages.poll_addUser;
Cryptpad.prompt(msg, "", function (name) { Cryptpad.prompt(msg, "", function (name) {
if (name === null) { return; } if (!(name && name.trim())) { return; }
makeUser(module.rt.proxy, id, name).val(name); makeUser(module.rt.proxy, id, name).val(name);
makeUserEditable(id, true).focus(); makeUserEditable(id, true).focus();
}); });
@ -782,14 +782,16 @@ define([
})); }));
} }
/*
if (!readOnly && module.viewHash) { if (!readOnly && module.viewHash) {
/* add a 'links' button */ /* add a 'links' button
var $links = Cryptpad.createButton('readonly', true, {viewHash: module.viewHash}) var $links = Cryptpad.createButton('readonly', true, {viewHash: module.viewHash})
.text(Messages.getViewButton) .text(Messages.getViewButton)
.removeAttr('style') .removeAttr('style')
.attr('class', 'action button readonly'); .attr('class', 'action button readonly');
$toolbar.append($links); $toolbar.append($links);
} }
*/
/* Import/Export buttons */ /* Import/Export buttons */
/* /*

@ -45,7 +45,7 @@ define([
var unsafeTag = function (info) { var unsafeTag = function (info) {
if (['addAttribute', 'modifyAttribute'].indexOf(info.diff.action) !== -1) { if (['addAttribute', 'modifyAttribute'].indexOf(info.diff.action) !== -1) {
if (/^on/.test(info.diff.name)) { if (/^on/.test(info.diff.name)) {
console.log("Rejecting forbidden element attribute with name", info.diff.element.nodeName); console.log("Rejecting forbidden element attribute with name", info.diff.name);
return true; return true;
} }
} }
@ -91,12 +91,28 @@ define([
return patch; return patch;
}; };
var slice = function (coll) {
return Array.prototype.slice.call(coll);
};
/* remove listeners from the DOM */
var removeListeners = function (root) {
slice(root.attributes).map(function (attr) {
if (/^on/.test(attr.name)) {
root.attributes.removeNamedItem(attr.name);
}
});
// all the way down
slice(root.children).forEach(removeListeners);
};
var draw = Slide.draw = function (i) { var draw = Slide.draw = function (i) {
console.log("Trying to draw slide #%s", i); console.log("Trying to draw slide #%s", i);
if (typeof(Slide.content[i]) !== 'string') { return; } if (typeof(Slide.content[i]) !== 'string') { return; }
var c = Slide.content[i]; var c = Slide.content[i];
var Dom = domFromHTML('<div id="content">' + Marked(c) + '</div>'); var Dom = domFromHTML('<div id="content">' + Marked(c) + '</div>');
removeListeners(Dom.body);
var patch = makeDiff(domFromHTML($content[0].outerHTML), Dom); var patch = makeDiff(domFromHTML($content[0].outerHTML), Dom);
if (typeof(patch) === 'string') { if (typeof(patch) === 'string') {

Loading…
Cancel
Save