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:
@@ -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");
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user