Improve tooltips
Allow tooltips in div element (currently tooltips only allow items in pre element which is tricky to format). Also fix wrapping, remove gradient fill, and introduce a maximum width of 500px by default.
This commit is contained in:
parent
3af776df12
commit
2636e5de5f
1 changed files with 9 additions and 4 deletions
|
|
@ -352,12 +352,13 @@ var Autocomplete = function() {
|
||||||
|
|
||||||
this.showDocTooltip = function(item) {
|
this.showDocTooltip = function(item) {
|
||||||
if (!this.tooltipNode) {
|
if (!this.tooltipNode) {
|
||||||
this.tooltipNode = dom.createElement("pre");
|
this.tooltipNode = item.docHTML ? dom.createElement("div") : dom.createElement("pre");
|
||||||
this.tooltipNode.className = "ace_tooltip ace_doc-tooltip";
|
this.tooltipNode.className = "ace_tooltip ace_doc-tooltip";
|
||||||
this.tooltipNode.style.margin = 0;
|
this.tooltipNode.style.margin = 0;
|
||||||
this.tooltipNode.style.pointerEvents = "auto";
|
this.tooltipNode.style.pointerEvents = "auto";
|
||||||
this.tooltipNode.tabIndex = -1;
|
this.tooltipNode.tabIndex = -1;
|
||||||
this.tooltipNode.onblur = this.blurListener.bind(this);
|
this.tooltipNode.onblur = this.blurListener.bind(this);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var tooltipNode = this.tooltipNode;
|
var tooltipNode = this.tooltipNode;
|
||||||
|
|
@ -373,7 +374,8 @@ var Autocomplete = function() {
|
||||||
var rect = popup.container.getBoundingClientRect();
|
var rect = popup.container.getBoundingClientRect();
|
||||||
tooltipNode.style.top = popup.container.style.top;
|
tooltipNode.style.top = popup.container.style.top;
|
||||||
tooltipNode.style.bottom = popup.container.style.bottom;
|
tooltipNode.style.bottom = popup.container.style.bottom;
|
||||||
|
tooltipNode.style.backgroundImage = "none";
|
||||||
|
tooltipNode.style.backgroundColor = "#FFFFEE";
|
||||||
if (window.innerWidth - rect.right < 320) {
|
if (window.innerWidth - rect.right < 320) {
|
||||||
tooltipNode.style.right = window.innerWidth - rect.left + "px";
|
tooltipNode.style.right = window.innerWidth - rect.left + "px";
|
||||||
tooltipNode.style.left = "";
|
tooltipNode.style.left = "";
|
||||||
|
|
@ -381,8 +383,11 @@ var Autocomplete = function() {
|
||||||
tooltipNode.style.left = (rect.right + 1) + "px";
|
tooltipNode.style.left = (rect.right + 1) + "px";
|
||||||
tooltipNode.style.right = "";
|
tooltipNode.style.right = "";
|
||||||
}
|
}
|
||||||
// tooltipNode.style.height = rect.height + "px";
|
|
||||||
tooltipNode.style.display = "block";
|
tooltipNode.style.display = "block";
|
||||||
|
tooltipNode.style.maxWidth = "500px";
|
||||||
|
tooltipNode.style.whiteSpace = "normal";
|
||||||
|
tooltipNode.style.wordWrap = "normal";
|
||||||
|
tooltipNode.style.textAlign = "left";
|
||||||
};
|
};
|
||||||
|
|
||||||
this.hideDocTooltip = function() {
|
this.hideDocTooltip = function() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue