mirror of https://github.com/status-im/codimd.git
Update slide rendering to reduce DOM wrap and avoid duplicate rendering slides
This commit is contained in:
parent
eab984deff
commit
d85dd19816
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue