diff options
Diffstat (limited to 'web_src/js/features/highlight.js')
-rw-r--r-- | web_src/js/features/highlight.js | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/web_src/js/features/highlight.js b/web_src/js/features/highlight.js deleted file mode 100644 index d3f6ba71b8..0000000000 --- a/web_src/js/features/highlight.js +++ /dev/null @@ -1,19 +0,0 @@ -export default async function highlight(elementOrNodeList) { - if (!window.config || !window.config.HighlightJS || !elementOrNodeList) return; - const nodes = 'length' in elementOrNodeList ? elementOrNodeList : [elementOrNodeList]; - if (!nodes.length) return; - - const {default: Worker} = await import(/* webpackChunkName: "highlight" */'./highlight.worker.js'); - const worker = new Worker(); - - worker.addEventListener('message', ({data}) => { - const {index, html} = data; - nodes[index].outerHTML = html; - }); - - for (let index = 0; index < nodes.length; index++) { - const node = nodes[index]; - if (!node) continue; - worker.postMessage({index, html: node.outerHTML}); - } -} |