Don't highlight `inline code` blocks in headers with output.html.playpen(playgroud).editable=true

This commit is contained in:
FWYongxing 2021-07-27 00:38:52 +08:00 committed by Yongxing
parent 27faa54ae8
commit 49ef7b6f02
1 changed files with 4 additions and 3 deletions

View File

@ -162,12 +162,13 @@ function playground_text(playground) {
if (window.ace) { if (window.ace) {
// language-rust class needs to be removed for editable // language-rust class needs to be removed for editable
// blocks or highlightjs will capture events // blocks or highlightjs will capture events
Array code_nodes
.from(document.querySelectorAll('code.editable')) .filter(function (node) {return node.classList.contains("editable"); })
.forEach(function (block) { block.classList.remove('language-rust'); }); .forEach(function (block) { block.classList.remove('language-rust'); });
Array Array
.from(document.querySelectorAll('code:not(.editable)')) code_nodes
.filter(function (node) {return !node.classList.contains("editable"); })
.forEach(function (block) { hljs.highlightBlock(block); }); .forEach(function (block) { hljs.highlightBlock(block); });
} else { } else {
code_nodes.forEach(function (block) { hljs.highlightBlock(block); }); code_nodes.forEach(function (block) { hljs.highlightBlock(block); });