mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-08-05 21:33:52 +00:00
Undo unneeded changes to image widget
This commit is contained in:
parent
37f6930bf2
commit
cca1f21d02
@ -43,7 +43,6 @@ ImageWidget.prototype = new Widget();
|
|||||||
Render this widget into the DOM
|
Render this widget into the DOM
|
||||||
*/
|
*/
|
||||||
ImageWidget.prototype.render = function(parent,nextSibling) {
|
ImageWidget.prototype.render = function(parent,nextSibling) {
|
||||||
var self = this;
|
|
||||||
this.parentDomNode = parent;
|
this.parentDomNode = parent;
|
||||||
this.computeAttributes();
|
this.computeAttributes();
|
||||||
this.execute();
|
this.execute();
|
||||||
@ -119,14 +118,6 @@ ImageWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
if(this.lazyLoading && tag === "img") {
|
if(this.lazyLoading && tag === "img") {
|
||||||
domNode.setAttribute("loading",this.lazyLoading);
|
domNode.setAttribute("loading",this.lazyLoading);
|
||||||
}
|
}
|
||||||
// Insert element
|
|
||||||
parent.insertBefore(domNode,nextSibling);
|
|
||||||
this.domNodes.push(domNode);
|
|
||||||
// Render children into a wrapper
|
|
||||||
this.childWrapper = this.document.createElement("span");
|
|
||||||
this.childWrapper.style.display = "none" ;
|
|
||||||
parent.insertBefore(this.childWrapper,nextSibling);
|
|
||||||
this.renderChildren(this.childWrapper,null);
|
|
||||||
// Add classes when the image loads or fails
|
// Add classes when the image loads or fails
|
||||||
$tw.utils.addClass(domNode,"tc-image-loading");
|
$tw.utils.addClass(domNode,"tc-image-loading");
|
||||||
domNode.addEventListener("load",function() {
|
domNode.addEventListener("load",function() {
|
||||||
@ -136,9 +127,10 @@ ImageWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
domNode.addEventListener("error",function() {
|
domNode.addEventListener("error",function() {
|
||||||
$tw.utils.removeClass(domNode,"tc-image-loading");
|
$tw.utils.removeClass(domNode,"tc-image-loading");
|
||||||
$tw.utils.addClass(domNode,"tc-image-error");
|
$tw.utils.addClass(domNode,"tc-image-error");
|
||||||
self.childWrapper.style.display = "inline" ;
|
|
||||||
domNode.style.display = "none";
|
|
||||||
},false);
|
},false);
|
||||||
|
// Insert element
|
||||||
|
parent.insertBefore(domNode,nextSibling);
|
||||||
|
this.domNodes.push(domNode);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -150,12 +142,10 @@ ImageWidget.prototype.execute = function() {
|
|||||||
this.imageWidth = this.getAttribute("width");
|
this.imageWidth = this.getAttribute("width");
|
||||||
this.imageHeight = this.getAttribute("height");
|
this.imageHeight = this.getAttribute("height");
|
||||||
this.imageClass = this.getAttribute("class");
|
this.imageClass = this.getAttribute("class");
|
||||||
this.imageUsemap = this.getAttribute("usemap");
|
this.imageUsemap = this.getAttribute("usemap");
|
||||||
this.imageTooltip = this.getAttribute("tooltip");
|
this.imageTooltip = this.getAttribute("tooltip");
|
||||||
this.imageAlt = this.getAttribute("alt");
|
this.imageAlt = this.getAttribute("alt");
|
||||||
this.lazyLoading = this.getAttribute("loading");
|
this.lazyLoading = this.getAttribute("loading");
|
||||||
// Make the child widgets
|
|
||||||
this.makeChildWidgets();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -173,4 +163,4 @@ ImageWidget.prototype.refresh = function(changedTiddlers) {
|
|||||||
|
|
||||||
exports.image = ImageWidget;
|
exports.image = ImageWidget;
|
||||||
|
|
||||||
})();
|
})();
|
Loading…
x
Reference in New Issue
Block a user