1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-12-02 06:48:06 +00:00

Image lazy loading (#6809)

* Extend image widget with lazy loading support

* docs: added from-version to docs update
This commit is contained in:
Saq Imtiaz
2022-07-21 16:30:56 +02:00
committed by GitHub
parent 39996c7a2f
commit 613b3df367
2 changed files with 10 additions and 4 deletions

View File

@@ -111,6 +111,9 @@ ImageWidget.prototype.render = function(parent,nextSibling) {
if(this.imageAlt) {
domNode.setAttribute("alt",this.imageAlt);
}
if(this.lazyLoading && tag === "img") {
domNode.setAttribute("loading",this.lazyLoading);
}
// Add classes when the image loads or fails
$tw.utils.addClass(domNode,"tc-image-loading");
domNode.addEventListener("load",function() {
@@ -137,6 +140,7 @@ ImageWidget.prototype.execute = function() {
this.imageClass = this.getAttribute("class");
this.imageTooltip = this.getAttribute("tooltip");
this.imageAlt = this.getAttribute("alt");
this.lazyLoading = this.getAttribute("loading");
};
/*