Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add class to tooltip DOM element distinguish errors from warnings #4810

Merged
merged 2 commits into from
May 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/ace/mouse/default_gutter_handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ function GutterHandler(mouseHandler) {
tooltipAnnotation = annotation.text.join("<br/>");

tooltip.setHtml(tooltipAnnotation);

var annotationClassName = annotation.className;
if (annotationClassName) {
tooltip.setClassName(annotationClassName.trim());
}

tooltip.show();
editor._signal("showGutterTooltip", tooltip);
editor.on("mousewheel", hideTooltip);
Expand Down
5 changes: 4 additions & 1 deletion lib/ace/tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ define(function(require, exports, module) {
var oop = require("./lib/oop");
var dom = require("./lib/dom");

var CLASSNAME = "ace_tooltip";

/**
* @class Tooltip
**/
Expand All @@ -52,7 +54,7 @@ function Tooltip (parentNode) {
(function() {
this.$init = function() {
this.$element = dom.createElement("div");
this.$element.className = "ace_tooltip";
this.$element.className = CLASSNAME;
this.$element.style.display = "none";
this.$parentNode.appendChild(this.$element);
return this.$element;
Expand Down Expand Up @@ -114,6 +116,7 @@ function Tooltip (parentNode) {
this.hide = function() {
if (this.isOpen) {
this.getElement().style.display = "none";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can store this class name in some constant / property so in cass it’s changed we change it in one place

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have created a constant var CLASSNAME

this.getElement().className = CLASSNAME;
this.isOpen = false;
}
};
Expand Down