1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Merge pull request #1853 from node-red-hitachi/fix-icon-spec-for-typedInput

Fix use of HTML tag or CSS class specification as icon of TypedInput
This commit is contained in:
Nick O'Leary 2018-08-28 20:44:06 +01:00 committed by GitHub
commit 0f0d0c046c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -522,10 +522,18 @@
this.selectLabel.empty(); this.selectLabel.empty();
var image; var image;
if (opt.icon) { if (opt.icon) {
if (opt.icon.indexOf("<") === 0) {
$(opt.icon).prependTo(this.selectLabel);
}
else if (opt.icon.indexOf("/") !== -1) {
image = new Image(); image = new Image();
image.name = opt.icon; image.name = opt.icon;
image.src = opt.icon; image.src = opt.icon;
$('<img>',{src:opt.icon,style:"margin-right: 4px;height: 18px;"}).prependTo(this.selectLabel); $('<img>',{src:opt.icon,style:"margin-right: 4px;height: 18px;"}).prependTo(this.selectLabel);
}
else {
$('<i>',{class:"red-ui-typedInput-icon "+opt.icon}).prependTo(this.selectLabel);
}
} else { } else {
this.selectLabel.text(opt.label); this.selectLabel.text(opt.label);
} }