Skip to content

Commit f27f034

Browse files
author
Chris K
committed
DFL-3608 Inspection tooltips can easily disappear when filtering
1 parent a989717 commit f27f034

File tree

3 files changed

+30
-30
lines changed

3 files changed

+30
-30
lines changed

src/ecma-debugger/js-source-view.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,7 @@ cls.JsSourceView = function(id, name, container_class)
221221
container.innerHTML = "" +
222222
"<div id='" + SCROLL_CONTENT_ID + "'>"+
223223
"<div class='" + CONTAINER_CLASS_NAME + "' " +
224-
"data-menu='js-source-content' " +
225-
"data-tooltip='" + cls.JSSourceTooltip.tooltip_name + "'></div>"+
224+
"data-menu='js-source-content'></div>" +
226225
"</div>"+
227226
"<div id='" + SCROLL_CONTAINER_ID + "' handler='scroll-js-source'>"+
228227
"<div id='" + SCROLL_ID + "'></div>"+
@@ -564,7 +563,7 @@ cls.JsSourceView = function(id, name, container_class)
564563
{
565564
document.getElementById(SCROLL_ID).innerHTML = "";
566565
if (typeof script_id == "number" && !isNaN(script_id) &&
567-
typeof line_no == "number" && !isNaN(line_no))
566+
typeof line_no == "number" && !isNaN(line_no))
568567
{
569568
new ConfirmDialog(ui_strings.D_RELOAD_SCRIPTS,
570569
function(){ runtimes.reloadWindow(); }).show();
@@ -1000,7 +999,13 @@ cls.JsSourceView = function(id, name, container_class)
1000999
this._handlers["scroll-page-down"] = this._scroll_lines.bind(this, PAGE_SCROLL);
10011000
this._handlers["scroll-arrow-up"] = this._scroll_lines.bind(this, -ARROW_SCROLL);
10021001
this._handlers["scroll-arrow-down"] = this._scroll_lines.bind(this, ARROW_SCROLL);
1003-
this.init(id, name, container_class, null, "scroll-js-source-view");
1002+
this.init(id,
1003+
name,
1004+
container_class,
1005+
null,
1006+
"scroll-js-source-view",
1007+
null,
1008+
cls.JSSourceTooltip.tooltip_name);
10041009
this._go_to_line = new cls.GoToLine(this);
10051010
messages.addListener("update-layout", updateLayout);
10061011
messages.addListener("runtime-destroyed", onRuntimeDestroyed);

src/ui-scripts/containers.js

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -66,29 +66,25 @@ var ContainerBase = function()
6666
this.setup = function(view_id)
6767
{
6868
var view = views[this.view_id = view_id];
69-
var container = document.getElementById(this.type + '-to-' + this.cell.id) || this.update();
69+
var container = document.getElementById(this.type + "-to-" + this.cell.id) || this.update();
7070
if( view )
7171
{
72-
container.removeAttribute('handler');
73-
container.removeAttribute('edit-handler');
74-
if (view.default_handler)
72+
var names = ["handler", "edit-handler", "data-tooltip", "data-menu"];
73+
var values = [view.default_handler, view.edit_handler, view.default_tooltip, view_id];
74+
names.forEach(function(name, index)
7575
{
76-
container.setAttribute('handler', view.default_handler);
77-
}
78-
if (view.edit_handler)
79-
{
80-
container.setAttribute('edit-handler', view.edit_handler);
81-
}
82-
container.className = view.container_class || '';
83-
container.setAttribute('data-menu', view_id || '');
84-
container.innerHTML = '';
76+
if (values[index])
77+
container.setAttribute(name, values[index]);
78+
else
79+
container.removeAttribute(name);
80+
});
81+
container.className = view.container_class || "";
82+
container.innerHTML = "";
8583
if (!view.has_container_id(container.id))
86-
{
8784
view.addContainerId(container.id);
88-
}
8985
view.update();
9086
}
91-
}
87+
};
9288

9389
this.init = function(cell)
9490
{

src/ui-scripts/view.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,18 @@ var ViewBase = new function()
6060
return false;
6161
}
6262

63-
this.init = function(id, name, container_class, html, default_handler, edit_handler)
63+
this.init = function(id, name, container_class, html, default_handler, edit_handler, default_tooltip)
6464
{
6565
this.id = id || getId();
6666
this.name = name;
6767
this.container_class = container_class;
6868
this.inner = html; // only for testing;
6969
this.container_ids = [];
70-
this.type = this.type || 'single-view';
71-
this.default_handler = default_handler || '';
72-
this.edit_handler = edit_handler || '';
73-
this.requires_view || ( this.requires_view = '' );
70+
this.type = this.type || "single-view";
71+
this.default_handler = default_handler || "";
72+
this.edit_handler = edit_handler || "";
73+
this.default_tooltip = default_tooltip || "";
74+
this.requires_view || ( this.requires_view = "" );
7475
if(!window.views)
7576
{
7677
window.views = {};
@@ -80,7 +81,7 @@ var ViewBase = new function()
8081
{
8182
ids[ids.length] = this.id;
8283
}
83-
messages.post('view-initialized', {'view_id': this.id});
84+
messages.post("view-initialized", {"view_id": this.id});
8485
}
8586

8687
this.register_overlay = function(view)
@@ -304,11 +305,9 @@ var ViewBase = new function()
304305
* @constructor
305306
* @extends ViewBase
306307
*/
307-
308-
309-
var View = function(id, name, container_class, html, default_handler)
308+
var View = function(id, name, container_class, html, default_handler, edit_handler, default_tooltip)
310309
{
311-
this.init(id, name, container_class, html, default_handler);
310+
this.init(id, name, container_class, html, default_handler, edit_handler, default_tooltip);
312311
}
313312

314313
View.prototype = ViewBase;

0 commit comments

Comments
 (0)