@jupyterlab/tooltip
Advanced tools
Comparing version 0.8.2 to 0.9.0
@@ -24,5 +24,5 @@ "use strict"; | ||
/** | ||
* The class added to widgets that have spawned a tooltip and anchor it. | ||
* The class added to the body when a tooltip exists on the page. | ||
*/ | ||
var ANCHOR_CLASS = 'jp-Tooltip-anchor'; | ||
var BODY_CLASS = 'jp-mod-tooltip'; | ||
/** | ||
@@ -52,10 +52,7 @@ * The minimum height of a tooltip widget. | ||
var layout = _this.layout = new widgets_1.PanelLayout(); | ||
var model = new rendermime_1.MimeModel({ data: options.bundle }); | ||
_this.anchor = options.anchor; | ||
_this.addClass(TOOLTIP_CLASS); | ||
_this.anchor.addClass(ANCHOR_CLASS); | ||
_this._editor = options.editor; | ||
_this._rendermime = options.rendermime; | ||
var model = new rendermime_1.MimeModel({ | ||
data: options.bundle | ||
}); | ||
var mimeType = _this._rendermime.preferredMimeType(options.bundle, false); | ||
@@ -74,5 +71,2 @@ if (!mimeType) { | ||
Tooltip.prototype.dispose = function () { | ||
if (this.anchor && !this.anchor.isDisposed) { | ||
this.anchor.removeClass(ANCHOR_CLASS); | ||
} | ||
if (this._content) { | ||
@@ -98,8 +92,7 @@ this._content.dispose(); | ||
} | ||
var node = this.node; | ||
var target = event.target; | ||
switch (event.type) { | ||
case 'keydown': | ||
if (this.node.contains(event.target)) { | ||
if (event.keyCode === 27) { | ||
this.dispose(); | ||
} | ||
if (node.contains(target)) { | ||
return; | ||
@@ -110,3 +103,3 @@ } | ||
case 'mousedown': | ||
if (this.node.contains(event.target)) { | ||
if (node.contains(target)) { | ||
this.activate(); | ||
@@ -135,2 +128,3 @@ return; | ||
Tooltip.prototype.onAfterAttach = function (msg) { | ||
document.body.classList.add(BODY_CLASS); | ||
document.addEventListener('keydown', this, USE_CAPTURE); | ||
@@ -145,2 +139,3 @@ document.addEventListener('mousedown', this, USE_CAPTURE); | ||
Tooltip.prototype.onBeforeDetach = function (msg) { | ||
document.body.classList.remove(BODY_CLASS); | ||
document.removeEventListener('keydown', this, USE_CAPTURE); | ||
@@ -178,2 +173,5 @@ document.removeEventListener('mousedown', this, USE_CAPTURE); | ||
var line = editor.getLine(cursor.line); | ||
if (!line) { | ||
return; | ||
} | ||
var tokens = line.substring(0, end).split(/\W+/); | ||
@@ -183,2 +181,5 @@ var last = tokens[tokens.length - 1]; | ||
var position = editor.getPositionAt(start); | ||
if (!position) { | ||
return; | ||
} | ||
var anchor = editor.getCoordinateForPosition(position); | ||
@@ -185,0 +186,0 @@ var style = window.getComputedStyle(this.node); |
{ | ||
"name": "@jupyterlab/tooltip", | ||
"version": "0.8.2", | ||
"version": "0.9.0", | ||
"description": "JupyterLab - Tooltip Widget", | ||
@@ -16,6 +16,6 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@jupyterlab/apputils": "^0.8.2", | ||
"@jupyterlab/codeeditor": "^0.8.1", | ||
"@jupyterlab/rendermime": "^0.8.2", | ||
"@jupyterlab/services": "^0.47.1", | ||
"@jupyterlab/apputils": "^0.9.0", | ||
"@jupyterlab/codeeditor": "^0.9.0", | ||
"@jupyterlab/rendermime": "^0.9.0", | ||
"@jupyterlab/services": "^0.48.0", | ||
"@phosphor/coreutils": "^1.2.0", | ||
@@ -22,0 +22,0 @@ "@phosphor/messaging": "^1.2.1", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
359
12306
+ Added@jupyterlab/apputils@0.9.0(transitive)
+ Added@jupyterlab/codeeditor@0.9.0(transitive)
+ Added@jupyterlab/codemirror@0.9.0(transitive)
+ Added@jupyterlab/coreutils@0.9.0(transitive)
+ Added@jupyterlab/rendermime@0.9.0(transitive)
+ Added@jupyterlab/rendermime-interfaces@0.3.1(transitive)
+ Added@jupyterlab/services@0.48.0(transitive)
- Removed@jupyterlab/apputils@0.8.2(transitive)
- Removed@jupyterlab/codeeditor@0.8.1(transitive)
- Removed@jupyterlab/codemirror@0.8.1(transitive)
- Removed@jupyterlab/coreutils@0.8.1(transitive)
- Removed@jupyterlab/rendermime@0.8.2(transitive)
- Removed@jupyterlab/rendermime-interfaces@0.2.1(transitive)
- Removed@jupyterlab/services@0.47.1(transitive)
Updated@jupyterlab/apputils@^0.9.0
Updated@jupyterlab/services@^0.48.0