1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-01-25 16:36:52 +00:00

Add alt attribute to image widget

This commit is contained in:
Jermolene 2014-08-20 10:00:34 +01:00
parent 1973df0809
commit fbf307c648
2 changed files with 6 additions and 1 deletions

View File

@ -105,6 +105,9 @@ ImageWidget.prototype.render = function(parent,nextSibling) {
if(this.imageTooltip) { if(this.imageTooltip) {
domNode.setAttribute("title",this.imageTooltip); domNode.setAttribute("title",this.imageTooltip);
} }
if(this.imageAlt) {
domNode.setAttribute("alt",this.imageAlt);
}
// Insert element // Insert element
parent.insertBefore(domNode,nextSibling); parent.insertBefore(domNode,nextSibling);
this.domNodes.push(domNode); this.domNodes.push(domNode);
@ -120,6 +123,7 @@ ImageWidget.prototype.execute = function() {
this.imageHeight = this.getAttribute("height"); this.imageHeight = this.getAttribute("height");
this.imageClass = this.getAttribute("class"); this.imageClass = this.getAttribute("class");
this.imageTooltip = this.getAttribute("tooltip"); this.imageTooltip = this.getAttribute("tooltip");
this.imageAlt = this.getAttribute("alt");
}; };
/* /*

View File

@ -1,6 +1,6 @@
title: ImageWidget title: ImageWidget
created: 20140416160234142 created: 20140416160234142
modified: 20140611160234142 modified: 20140820100234142
tags: widget tags: widget
! Introduction ! Introduction
@ -16,6 +16,7 @@ Any content of the `<$image>` widget is ignored.
|width |The width of the image as a number | |width |The width of the image as a number |
|height |The height of the image | |height |The height of the image |
|tooltip |The tooltip to be displayed over the image | |tooltip |The tooltip to be displayed over the image |
|alt |The alternative text to be associated with the image |
|class |CSS classes to be assigned to the `<img>` element | |class |CSS classes to be assigned to the `<img>` element |
! External Images and the ''_canonical_uri'' field ! External Images and the ''_canonical_uri'' field