Update slide rendering to reduce DOM wrap and avoid duplicate rendering slides

This commit is contained in:
Wu Cheng-Han 2016-07-30 20:33:32 +08:00
parent eab984deff
commit d85dd19816
2 changed files with 9 additions and 5 deletions

View File

@ -355,7 +355,7 @@
var rendered = md.render(markdown);
rendered = preventXSS(rendered);
var result = postProcess(rendered);
section.innerHTML = result[0].outerHTML;
section.innerHTML = result[0].innerHTML;
addAttributes( section, section, null, section.getAttribute( 'data-element-attributes' ) ||
section.parentNode.getAttribute( 'data-element-attributes' ) ||
DEFAULT_ELEMENT_ATTRIBUTES_SEPARATOR,

View File

@ -55,10 +55,14 @@ viewAjaxCallback = function () {
};
function renderSlide(event) {
var title = document.title;
finishView($(event.currentSlide));
document.title = title;
Reveal.layout();
var markdown = $(event.currentSlide);
if (!markdown.attr('data-rendered')) {
var title = document.title;
finishView(markdown);
markdown.attr('data-rendered', 'true');
document.title = title;
Reveal.layout();
}
}
Reveal.addEventListener('ready', renderSlide);