Fixed highlight.js problem with partial rendering

This commit is contained in:
benweet 2014-02-16 15:34:11 +00:00
parent c5a1497374
commit 3c37584b40

View File

@ -95,7 +95,8 @@ define([
var previewContentsElt = document.getElementById('preview-contents'); var previewContentsElt = document.getElementById('preview-contents');
editor.hooks.chain("onPreviewRefresh", function() { editor.hooks.chain("onPreviewRefresh", function() {
_.each(previewContentsElt.querySelectorAll('.prettyprint > code'), function(elt) { _.each(previewContentsElt.querySelectorAll('.prettyprint > code'), function(elt) {
hljs.highlightBlock(elt); !elt.highlighted && hljs.highlightBlock(elt);
elt.highlighted = true;
}); });
}); });
} }