mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add RED.popover.tooltip for common reuse
This commit is contained in:
parent
fe22cedc1d
commit
73a18891c5
@ -53,7 +53,12 @@ RED.popover = (function() {
|
|||||||
div.addClass("red-ui-popover-size-"+size);
|
div.addClass("red-ui-popover-size-"+size);
|
||||||
}
|
}
|
||||||
if (typeof content === 'function') {
|
if (typeof content === 'function') {
|
||||||
content.call(res).appendTo(div);
|
var result = content.call(res);
|
||||||
|
if (typeof result === 'string') {
|
||||||
|
div.text(result);
|
||||||
|
} else {
|
||||||
|
div.append(result);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
div.html(content);
|
div.html(content);
|
||||||
}
|
}
|
||||||
@ -63,8 +68,8 @@ RED.popover = (function() {
|
|||||||
|
|
||||||
|
|
||||||
var targetPos = target.offset();
|
var targetPos = target.offset();
|
||||||
var targetWidth = target.width();
|
var targetWidth = target.outerWidth();
|
||||||
var targetHeight = target.height();
|
var targetHeight = target.outerHeight();
|
||||||
var divHeight = div.height();
|
var divHeight = div.height();
|
||||||
var divWidth = div.width();
|
var divWidth = div.width();
|
||||||
if (direction === 'right') {
|
if (direction === 'right') {
|
||||||
@ -147,7 +152,17 @@ RED.popover = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
create: createPopover
|
create: createPopover,
|
||||||
|
tooltip: function(target,content) {
|
||||||
|
RED.popover.create({
|
||||||
|
target:target,
|
||||||
|
trigger: "hover",
|
||||||
|
size: "small",
|
||||||
|
direction: "bottom",
|
||||||
|
content: content,
|
||||||
|
delay: { show: 550, hide: 10 }
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
@ -349,14 +349,7 @@ RED.tabs = (function() {
|
|||||||
pinnedLink.addClass("red-ui-tab-link-button-pinned");
|
pinnedLink.addClass("red-ui-tab-link-button-pinned");
|
||||||
pinnedTabsCount++;
|
pinnedTabsCount++;
|
||||||
}
|
}
|
||||||
RED.popover.create({
|
RED.popover.tooltip($(pinnedLink), tab.name);
|
||||||
target:$(pinnedLink),
|
|
||||||
trigger: "hover",
|
|
||||||
size: "small",
|
|
||||||
direction: "bottom",
|
|
||||||
content: tab.name,
|
|
||||||
delay: { show: 550, hide: 10 }
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
link.on("click",onTabClick);
|
link.on("click",onTabClick);
|
||||||
|
Loading…
Reference in New Issue
Block a user