Revert "PERF: Move highlightjs to a background worker, and add result cache (#10191)"

This caused a CORS error when used with S3 asset storage

This reverts commit d09f283e91.
This commit is contained in:
David Taylor
2020-07-15 13:52:35 +01:00
parent c802c7367a
commit 7d300006a1
11 changed files with 46 additions and 280 deletions

View File

@@ -1,8 +1,4 @@
import componentTest from "helpers/component-test";
import {
waitForHighlighting,
setupHighlightJs
} from "discourse/lib/highlight-syntax";
const LONG_CODE_BLOCK = "puts a\n".repeat(15000);
@@ -12,15 +8,12 @@ componentTest("highlighting code", {
template: "{{highlighted-code lang='ruby' code=code}}",
beforeEach() {
setupHighlightJs({
highlightJsUrl: "/assets/highlightjs/highlight-test-bundle.min.js",
highlightJsWorkerUrl: "/assets/highlightjs-worker.js"
});
Discourse.HighlightJSPath =
"assets/highlightjs/highlight-test-bundle.min.js";
this.set("code", "def test; end");
},
async test(assert) {
this.set("code", "def test; end");
await waitForHighlighting();
assert.equal(
find("code.ruby.hljs .hljs-function .hljs-keyword")
.text()
@@ -30,19 +23,16 @@ componentTest("highlighting code", {
}
});
componentTest("highlighting code limit", {
componentTest("large code blocks are not highlighted", {
template: "{{highlighted-code lang='ruby' code=code}}",
beforeEach() {
setupHighlightJs({
highlightJsUrl: "/assets/highlightjs/highlight-test-bundle.min.js",
highlightJsWorkerUrl: "/assets/highlightjs-worker.js"
});
Discourse.HighlightJSPath =
"assets/highlightjs/highlight-test-bundle.min.js";
this.set("code", LONG_CODE_BLOCK);
},
async test(assert) {
this.set("code", LONG_CODE_BLOCK);
await waitForHighlighting();
assert.equal(
find("code")
.text()