mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-06-23 08:02:31 +00:00
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 loadScript from "discourse/lib/load-script";
|
||||
import loadMorphlex from "discourse/lib/load-morphlex";
|
||||
import { cook } from "discourse/lib/text";
|
||||
|
||||
const PROGRESS_INTERVAL = 40;
|
||||
@ -118,8 +118,11 @@ class PostUpdater extends StreamUpdater {
|
||||
|
||||
const oldElement = this.postElement.querySelector(".cooked");
|
||||
|
||||
await loadScript("/javascripts/diffhtml.min.js");
|
||||
window.diff.innerHTML(oldElement, value);
|
||||
// TODO: use `morphInner` once version morphlex 0.0.16 is out
|
||||
const newElement = oldElement.cloneNode(false);
|
||||
newElement.innerHTML = value;
|
||||
|
||||
(await loadMorphlex()).morph(oldElement, newElement);
|
||||
}
|
||||
|
||||
get raw() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user