DEV: replace diffhtml with morphlex (#555)
morphlex is a lighter and faster morphing library 🚀
This commit is contained in:
parent
6f5f34184b
commit
bc561eb332
|
@ -1,5 +1,5 @@
|
||||||
import { later } from "@ember/runloop";
|
import { later } from "@ember/runloop";
|
||||||
import loadScript from "discourse/lib/load-script";
|
import loadMorphlex from "discourse/lib/load-morphlex";
|
||||||
import { cook } from "discourse/lib/text";
|
import { cook } from "discourse/lib/text";
|
||||||
|
|
||||||
const PROGRESS_INTERVAL = 40;
|
const PROGRESS_INTERVAL = 40;
|
||||||
|
@ -118,8 +118,11 @@ class PostUpdater extends StreamUpdater {
|
||||||
|
|
||||||
const oldElement = this.postElement.querySelector(".cooked");
|
const oldElement = this.postElement.querySelector(".cooked");
|
||||||
|
|
||||||
await loadScript("/javascripts/diffhtml.min.js");
|
// TODO: use `morphInner` once version morphlex 0.0.16 is out
|
||||||
window.diff.innerHTML(oldElement, value);
|
const newElement = oldElement.cloneNode(false);
|
||||||
|
newElement.innerHTML = value;
|
||||||
|
|
||||||
|
(await loadMorphlex()).morph(oldElement, newElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
get raw() {
|
get raw() {
|
||||||
|
|
Loading…
Reference in New Issue