@jupyterlab/codeeditor
Advanced tools
Comparing version 0.1.4 to 0.2.0
@@ -1,2 +0,2 @@ | ||
import { nbformat } from '@jupyterlab/services'; | ||
import { nbformat } from '@jupyterlab/coreutils'; | ||
/** | ||
@@ -3,0 +3,0 @@ * The mime type service of a code editor. |
@@ -25,2 +25,13 @@ import { Message } from '@phosphor/messaging'; | ||
/** | ||
* Handle the DOM events for the widget. | ||
* | ||
* @param event - The DOM event sent to the widget. | ||
* | ||
* #### Notes | ||
* This method implements the DOM `EventListener` interface and is | ||
* called in response to events on the panel's DOM node. It should | ||
* not be called directly by user code. | ||
*/ | ||
handleEvent(event: Event): void; | ||
/** | ||
* Handle `'activate-request'` messages. | ||
@@ -34,6 +45,2 @@ */ | ||
/** | ||
* Handle `before-detach` messages for the widget. | ||
*/ | ||
protected onBeforeDetach(msg: Message): void; | ||
/** | ||
* A message handler invoked on an `'after-show'` message. | ||
@@ -43,16 +50,9 @@ */ | ||
/** | ||
* A message handler invoked on an `'resize'` message. | ||
* Handle `before-detach` messages for the widget. | ||
*/ | ||
protected onResize(msg: Widget.ResizeMessage): void; | ||
protected onBeforeDetach(msg: Message): void; | ||
/** | ||
* Handle the DOM events for the widget. | ||
* | ||
* @param event - The DOM event sent to the widget. | ||
* | ||
* #### Notes | ||
* This method implements the DOM `EventListener` interface and is | ||
* called in response to events on the panel's DOM node. It should | ||
* not be called directly by user code. | ||
* A message handler invoked on a `'resize'` message. | ||
*/ | ||
handleEvent(event: Event): void; | ||
protected onResize(msg: Widget.ResizeMessage): void; | ||
/** | ||
@@ -62,2 +62,6 @@ * Handle `focus` events for the widget. | ||
private _evtFocus(event); | ||
/** | ||
* Handle a change in model selections. | ||
*/ | ||
private _onSelectionsChanged(); | ||
private _editor; | ||
@@ -64,0 +68,0 @@ private _needsRefresh; |
@@ -17,2 +17,6 @@ // Copyright (c) Jupyter Development Team. | ||
/** | ||
* The class name added to an editor widget that has a primary selection. | ||
*/ | ||
var HAS_SELECTION_CLASS = 'jp-mod-has-primary-selection'; | ||
/** | ||
* A widget which hosts a code editor. | ||
@@ -29,3 +33,3 @@ */ | ||
_this._needsRefresh = false; | ||
_this._editor = options.factory({ | ||
var editor = _this._editor = options.factory({ | ||
host: _this.node, | ||
@@ -38,2 +42,3 @@ model: options.model, | ||
}); | ||
editor.model.selections.changed.connect(_this._onSelectionsChanged, _this); | ||
return _this; | ||
@@ -73,2 +78,21 @@ } | ||
/** | ||
* Handle the DOM events for the widget. | ||
* | ||
* @param event - The DOM event sent to the widget. | ||
* | ||
* #### Notes | ||
* This method implements the DOM `EventListener` interface and is | ||
* called in response to events on the panel's DOM node. It should | ||
* not be called directly by user code. | ||
*/ | ||
CodeEditorWidget.prototype.handleEvent = function (event) { | ||
switch (event.type) { | ||
case 'focus': | ||
this._evtFocus(event); | ||
break; | ||
default: | ||
break; | ||
} | ||
}; | ||
/** | ||
* Handle `'activate-request'` messages. | ||
@@ -91,8 +115,2 @@ */ | ||
/** | ||
* Handle `before-detach` messages for the widget. | ||
*/ | ||
CodeEditorWidget.prototype.onBeforeDetach = function (msg) { | ||
this.node.removeEventListener('focus', this, true); | ||
}; | ||
/** | ||
* A message handler invoked on an `'after-show'` message. | ||
@@ -105,4 +123,10 @@ */ | ||
/** | ||
* A message handler invoked on an `'resize'` message. | ||
* Handle `before-detach` messages for the widget. | ||
*/ | ||
CodeEditorWidget.prototype.onBeforeDetach = function (msg) { | ||
this.node.removeEventListener('focus', this, true); | ||
}; | ||
/** | ||
* A message handler invoked on a `'resize'` message. | ||
*/ | ||
CodeEditorWidget.prototype.onResize = function (msg) { | ||
@@ -122,21 +146,2 @@ if (msg.width >= 0 && msg.height >= 0) { | ||
/** | ||
* Handle the DOM events for the widget. | ||
* | ||
* @param event - The DOM event sent to the widget. | ||
* | ||
* #### Notes | ||
* This method implements the DOM `EventListener` interface and is | ||
* called in response to events on the panel's DOM node. It should | ||
* not be called directly by user code. | ||
*/ | ||
CodeEditorWidget.prototype.handleEvent = function (event) { | ||
switch (event.type) { | ||
case 'focus': | ||
this._evtFocus(event); | ||
break; | ||
default: | ||
break; | ||
} | ||
}; | ||
/** | ||
* Handle `focus` events for the widget. | ||
@@ -150,4 +155,16 @@ */ | ||
}; | ||
/** | ||
* Handle a change in model selections. | ||
*/ | ||
CodeEditorWidget.prototype._onSelectionsChanged = function () { | ||
var _a = this._editor.getSelection(), start = _a.start, end = _a.end; | ||
if (start.column !== end.column || start.line !== end.line) { | ||
this.addClass(HAS_SELECTION_CLASS); | ||
} | ||
else { | ||
this.removeClass(HAS_SELECTION_CLASS); | ||
} | ||
}; | ||
return CodeEditorWidget; | ||
}(widgets_1.Widget)); | ||
exports.CodeEditorWidget = CodeEditorWidget; |
{ | ||
"name": "@jupyterlab/codeeditor", | ||
"version": "0.1.4", | ||
"version": "0.2.0", | ||
"description": "JupyterLab - Abstract Code Editor", | ||
@@ -9,3 +9,4 @@ "main": "lib/index.js", | ||
"lib/*.d.ts", | ||
"lib/*.js" | ||
"lib/*.js", | ||
"style/*.css" | ||
], | ||
@@ -16,9 +17,9 @@ "directories": { | ||
"dependencies": { | ||
"@jupyterlab/coreutils": "^0.1.1", | ||
"@jupyterlab/services": "^0.40.1", | ||
"@phosphor/coreutils": "^0.1.5", | ||
"@phosphor/disposable": "^0.1.1", | ||
"@phosphor/messaging": "^0.1.2", | ||
"@phosphor/signaling": "^0.1.2", | ||
"@phosphor/widgets": "^0.3.0" | ||
"@jupyterlab/coreutils": "^0.2.0", | ||
"@jupyterlab/services": "^0.41.0", | ||
"@phosphor/coreutils": "^1.0.0", | ||
"@phosphor/disposable": "^1.0.0", | ||
"@phosphor/messaging": "^1.0.0", | ||
"@phosphor/signaling": "^1.0.0", | ||
"@phosphor/widgets": "^1.0.0" | ||
}, | ||
@@ -25,0 +26,0 @@ "devDependencies": { |
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
43611
14
1386
+ Added@jupyterlab/coreutils@0.2.0(transitive)
+ Added@jupyterlab/services@0.41.0(transitive)
+ Added@phosphor/algorithm@1.2.0(transitive)
+ Added@phosphor/collections@1.2.0(transitive)
+ Added@phosphor/commands@1.7.2(transitive)
+ Added@phosphor/coreutils@1.3.1(transitive)
+ Added@phosphor/disposable@1.3.1(transitive)
+ Added@phosphor/domutils@1.1.4(transitive)
+ Added@phosphor/dragdrop@1.4.1(transitive)
+ Added@phosphor/keyboard@1.1.3(transitive)
+ Added@phosphor/messaging@1.3.0(transitive)
+ Added@phosphor/properties@1.1.3(transitive)
+ Added@phosphor/signaling@1.3.1(transitive)
+ Added@phosphor/virtualdom@1.2.0(transitive)
+ Added@phosphor/widgets@1.9.3(transitive)
- Removed@jupyterlab/coreutils@0.1.3(transitive)
- Removed@jupyterlab/services@0.40.4(transitive)
- Removed@phosphor/algorithm@0.1.1(transitive)
- Removed@phosphor/collections@0.1.1(transitive)
- Removed@phosphor/commands@0.1.5(transitive)
- Removed@phosphor/coreutils@0.1.5(transitive)
- Removed@phosphor/disposable@0.1.1(transitive)
- Removed@phosphor/domutils@0.1.2(transitive)
- Removed@phosphor/dragdrop@0.1.4(transitive)
- Removed@phosphor/keyboard@0.1.1(transitive)
- Removed@phosphor/messaging@0.1.2(transitive)
- Removed@phosphor/properties@0.1.1(transitive)
- Removed@phosphor/signaling@0.1.2(transitive)
- Removed@phosphor/virtualdom@0.1.1(transitive)
- Removed@phosphor/widgets@0.3.1(transitive)
Updated@jupyterlab/coreutils@^0.2.0
Updated@jupyterlab/services@^0.41.0
Updated@phosphor/coreutils@^1.0.0
Updated@phosphor/disposable@^1.0.0
Updated@phosphor/messaging@^1.0.0
Updated@phosphor/signaling@^1.0.0
Updated@phosphor/widgets@^1.0.0