Merge branch 'staging' into rebrand

pull/1/head
yflory 4 years ago
commit 7bde225126

@ -1467,5 +1467,6 @@
"loading_state_2": "Inhalte aktualisieren", "loading_state_2": "Inhalte aktualisieren",
"loading_state_1": "Drive laden", "loading_state_1": "Drive laden",
"loading_state_0": "Oberfläche vorbereiten", "loading_state_0": "Oberfläche vorbereiten",
"loading_state_5": "Dokument rekonstruieren" "loading_state_5": "Dokument rekonstruieren",
"error_unhelpfulScriptError": "Skriptfehler: Siehe Konsole im Browser für Details"
} }

@ -650,9 +650,25 @@ define([
}, 500); // 500ms to make sure it is sent after chainpad sync }, 500); // 500ms to make sure it is sent after chainpad sync
}; };
var isAnchor = function (el) { return el.nodeName === 'A'; };
var getAnchorName = function (el) {
return el.getAttribute('id') ||
el.getAttribute('data-cke-saved-name') ||
el.getAttribute('name') ||
Util.stripTags($(el).text());
};
var updateTOC = Util.throttle(function () { var updateTOC = Util.throttle(function () {
var toc = []; var toc = [];
$inner.find('h1, h2, h3').each(function (i, el) { $inner.find('h1, h2, h3, a[id][data-cke-saved-name]').each(function (i, el) {
if (isAnchor(el)) {
return void toc.push({
level: 2,
el: el,
title: getAnchorName(el),
});
}
toc.push({ toc.push({
level: Number(el.tagName.slice(1)), level: Number(el.tagName.slice(1)),
el: el, el: el,
@ -661,6 +677,8 @@ define([
}); });
var content = [h('h2', Messages.markdown_toc)]; var content = [h('h2', Messages.markdown_toc)];
toc.forEach(function (obj) { toc.forEach(function (obj) {
var title = (obj.title || "").trim();
if (!title) { return; }
// Only include level 2 headings // Only include level 2 headings
var level = obj.level; var level = obj.level;
var a = h('a.cp-pad-toc-link', { var a = h('a.cp-pad-toc-link', {
@ -672,7 +690,7 @@ define([
if (!obj.el || UIElements.isVisible(obj.el, $inner)) { return; } if (!obj.el || UIElements.isVisible(obj.el, $inner)) { return; }
obj.el.scrollIntoView(); obj.el.scrollIntoView();
}); });
a.innerHTML = obj.title; a.innerHTML = title;
content.push(h('p.cp-pad-toc-'+level, a)); content.push(h('p.cp-pad-toc-'+level, a));
}); });
$toc.html('').append(content); $toc.html('').append(content);
@ -1098,7 +1116,7 @@ define([
*/ */
Ckeditor.dom.element.prototype.setHtml = function(a){ Ckeditor.dom.element.prototype.setHtml = function(a){
if (/callFunction/.test(a)) { if (/callFunction/.test(a)) {
a = a.replace(/on(mousedown|blur|keydown|focus|click|dragstart)/g, function (value) { a = a.replace(/on(mousedown|blur|keydown|focus|click|dragstart|mouseover|mouseout)/g, function (value) {
return 'o' + value; return 'o' + value;
}); });
} }

Loading…
Cancel
Save