@jupyterlab/codeeditor
Advanced tools
Comparing version 0.3.1 to 0.4.0
@@ -131,2 +131,7 @@ import { JSONObject } from '@phosphor/coreutils'; | ||
readonly selections: IObservableMap<ITextSelection[]>; | ||
/** | ||
* The underlying `IModelDB` instance in which model | ||
* data is stored. | ||
*/ | ||
readonly modelDB: IModelDB; | ||
} | ||
@@ -142,2 +147,7 @@ /** | ||
/** | ||
* The underlying `IModelDB` instance in which model | ||
* data is stored. | ||
*/ | ||
readonly modelDB: IModelDB; | ||
/** | ||
* A signal emitted when a mimetype changes. | ||
@@ -167,3 +177,2 @@ */ | ||
private _onMimeTypeChanged(mimeType, args); | ||
protected modelDB: IModelDB; | ||
private _isDisposed; | ||
@@ -334,5 +343,12 @@ private _mimeTypeChanged; | ||
* Repaint the editor. | ||
* | ||
* #### Notes | ||
* A repainted editor should fit to its host node. | ||
*/ | ||
refresh(): void; | ||
/** | ||
* Resize the editor to fit its host node. | ||
*/ | ||
resizeToFit(): void; | ||
/** | ||
* Add a keydown handler to the editor. | ||
@@ -339,0 +355,0 @@ * |
@@ -25,3 +25,2 @@ "use strict"; | ||
function Model(options) { | ||
this.modelDB = null; | ||
this._isDisposed = false; | ||
@@ -28,0 +27,0 @@ this._mimeTypeChanged = new signaling_1.Signal(this); |
@@ -8,7 +8,7 @@ import { Message } from '@phosphor/messaging'; | ||
*/ | ||
export declare class JSONEditorWidget extends Widget { | ||
export declare class JSONEditor extends Widget { | ||
/** | ||
* Construct a new metadata editor. | ||
*/ | ||
constructor(options: JSONEditorWidget.IOptions); | ||
constructor(options: JSONEditor.IOptions); | ||
/** | ||
@@ -96,5 +96,5 @@ * The code editor used by the editor. | ||
/** | ||
* The static namespace JSONEditorWidget class statics. | ||
* The static namespace JSONEditor class statics. | ||
*/ | ||
export declare namespace JSONEditorWidget { | ||
export declare namespace JSONEditor { | ||
/** | ||
@@ -101,0 +101,0 @@ * The options used to initialize a metadata editor. |
@@ -20,5 +20,5 @@ "use strict"; | ||
/** | ||
* The class name added to a JSONEditorWidget instance. | ||
* The class name added to a JSONEditor instance. | ||
*/ | ||
var METADATA_CLASS = 'jp-JSONEditorWidget'; | ||
var METADATA_CLASS = 'jp-JSONEditor'; | ||
/** | ||
@@ -31,24 +31,24 @@ * The class name added when the Metadata editor contains invalid JSON. | ||
*/ | ||
var HOST_CLASS = 'jp-JSONEditorWidget-host'; | ||
var HOST_CLASS = 'jp-JSONEditor-host'; | ||
/** | ||
* The class name added to the button area. | ||
*/ | ||
var BUTTON_AREA_CLASS = 'jp-JSONEditorWidget-buttons'; | ||
var BUTTON_AREA_CLASS = 'jp-JSONEditor-buttons'; | ||
/** | ||
* The class name added to the revert button. | ||
*/ | ||
var REVERT_CLASS = 'jp-JSONEditorWidget-revertButton'; | ||
var REVERT_CLASS = 'jp-JSONEditor-revertButton'; | ||
/** | ||
* The class name added to the commit button. | ||
*/ | ||
var COMMIT_CLASS = 'jp-JSONEditorWidget-commitButton'; | ||
var COMMIT_CLASS = 'jp-JSONEditor-commitButton'; | ||
/** | ||
* A widget for editing observable JSON. | ||
*/ | ||
var JSONEditorWidget = (function (_super) { | ||
__extends(JSONEditorWidget, _super); | ||
var JSONEditor = (function (_super) { | ||
__extends(JSONEditor, _super); | ||
/** | ||
* Construct a new metadata editor. | ||
*/ | ||
function JSONEditorWidget(options) { | ||
function JSONEditor(options) { | ||
var _this = _super.call(this, { node: Private.createEditorNode() }) || this; | ||
@@ -71,3 +71,3 @@ _this._dataDirty = false; | ||
} | ||
Object.defineProperty(JSONEditorWidget.prototype, "editorHostNode", { | ||
Object.defineProperty(JSONEditor.prototype, "editorHostNode", { | ||
/** | ||
@@ -82,3 +82,3 @@ * Get the editor host node used by the metadata editor. | ||
}); | ||
Object.defineProperty(JSONEditorWidget.prototype, "revertButtonNode", { | ||
Object.defineProperty(JSONEditor.prototype, "revertButtonNode", { | ||
/** | ||
@@ -93,3 +93,3 @@ * Get the revert button used by the metadata editor. | ||
}); | ||
Object.defineProperty(JSONEditorWidget.prototype, "commitButtonNode", { | ||
Object.defineProperty(JSONEditor.prototype, "commitButtonNode", { | ||
/** | ||
@@ -104,3 +104,3 @@ * Get the commit button used by the metadata editor. | ||
}); | ||
Object.defineProperty(JSONEditorWidget.prototype, "source", { | ||
Object.defineProperty(JSONEditor.prototype, "source", { | ||
/** | ||
@@ -129,3 +129,3 @@ * The observable source. | ||
}); | ||
Object.defineProperty(JSONEditorWidget.prototype, "isDirty", { | ||
Object.defineProperty(JSONEditor.prototype, "isDirty", { | ||
/** | ||
@@ -150,3 +150,3 @@ * Get whether the editor is dirty. | ||
*/ | ||
JSONEditorWidget.prototype.handleEvent = function (event) { | ||
JSONEditor.prototype.handleEvent = function (event) { | ||
switch (event.type) { | ||
@@ -166,3 +166,3 @@ case 'blur': | ||
*/ | ||
JSONEditorWidget.prototype.onAfterAttach = function (msg) { | ||
JSONEditor.prototype.onAfterAttach = function (msg) { | ||
var node = this.editorHostNode; | ||
@@ -178,3 +178,3 @@ node.addEventListener('blur', this, true); | ||
*/ | ||
JSONEditorWidget.prototype.onBeforeDetach = function (msg) { | ||
JSONEditor.prototype.onBeforeDetach = function (msg) { | ||
var node = this.editorHostNode; | ||
@@ -188,3 +188,3 @@ node.removeEventListener('blur', this, true); | ||
*/ | ||
JSONEditorWidget.prototype._onSourceChanged = function (sender, args) { | ||
JSONEditor.prototype._onSourceChanged = function (sender, args) { | ||
if (this._changeGuard) { | ||
@@ -202,3 +202,3 @@ return; | ||
*/ | ||
JSONEditorWidget.prototype._onValueChanged = function () { | ||
JSONEditor.prototype._onValueChanged = function () { | ||
var valid = true; | ||
@@ -221,3 +221,3 @@ try { | ||
*/ | ||
JSONEditorWidget.prototype._evtBlur = function (event) { | ||
JSONEditor.prototype._evtBlur = function (event) { | ||
// Update the metadata if necessary. | ||
@@ -231,3 +231,3 @@ if (!this._inputDirty && this._dataDirty) { | ||
*/ | ||
JSONEditorWidget.prototype._evtClick = function (event) { | ||
JSONEditor.prototype._evtClick = function (event) { | ||
var target = event.target; | ||
@@ -249,3 +249,3 @@ if (target === this.revertButtonNode) { | ||
*/ | ||
JSONEditorWidget.prototype._mergeContent = function () { | ||
JSONEditor.prototype._mergeContent = function () { | ||
var model = this.editor.model; | ||
@@ -277,3 +277,3 @@ var current = this._getContent() || {}; | ||
*/ | ||
JSONEditorWidget.prototype._getContent = function () { | ||
JSONEditor.prototype._getContent = function () { | ||
var source = this._source; | ||
@@ -293,3 +293,3 @@ if (!source) { | ||
*/ | ||
JSONEditorWidget.prototype._setValue = function () { | ||
JSONEditor.prototype._setValue = function () { | ||
this._dataDirty = false; | ||
@@ -317,5 +317,5 @@ this._inputDirty = false; | ||
}; | ||
return JSONEditorWidget; | ||
return JSONEditor; | ||
}(widgets_1.Widget)); | ||
exports.JSONEditorWidget = JSONEditorWidget; | ||
exports.JSONEditor = JSONEditor; | ||
/** | ||
@@ -322,0 +322,0 @@ * The namespace for module private data. |
@@ -7,7 +7,7 @@ import { Message } from '@phosphor/messaging'; | ||
*/ | ||
export declare class CodeEditorWidget extends Widget { | ||
export declare class CodeEditorWrapper extends Widget { | ||
/** | ||
* Construct a new code editor widget. | ||
*/ | ||
constructor(options: CodeEditorWidget.IOptions); | ||
constructor(options: CodeEditorWrapper.IOptions); | ||
/** | ||
@@ -26,13 +26,2 @@ * Get the editor wrapped by the widget. | ||
/** | ||
* 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. | ||
@@ -50,6 +39,2 @@ */ | ||
/** | ||
* Handle `before-detach` messages for the widget. | ||
*/ | ||
protected onBeforeDetach(msg: Message): void; | ||
/** | ||
* A message handler invoked on a `'resize'` message. | ||
@@ -59,6 +44,2 @@ */ | ||
/** | ||
* Handle `focus` events for the widget. | ||
*/ | ||
private _evtFocus(event); | ||
/** | ||
* Handle a change in model selections. | ||
@@ -68,8 +49,7 @@ */ | ||
private _editor; | ||
private _needsRefresh; | ||
} | ||
/** | ||
* The namespace for the `CodeEditorWidget` statics. | ||
* The namespace for the `CodeEditorWrapper` statics. | ||
*/ | ||
export declare namespace CodeEditorWidget { | ||
export declare namespace CodeEditorWrapper { | ||
/** | ||
@@ -76,0 +56,0 @@ * The options used to initialize a code editor widget. |
@@ -23,11 +23,10 @@ "use strict"; | ||
*/ | ||
var CodeEditorWidget = (function (_super) { | ||
__extends(CodeEditorWidget, _super); | ||
var CodeEditorWrapper = (function (_super) { | ||
__extends(CodeEditorWrapper, _super); | ||
/** | ||
* Construct a new code editor widget. | ||
*/ | ||
function CodeEditorWidget(options) { | ||
function CodeEditorWrapper(options) { | ||
var _this = _super.call(this) || this; | ||
_this._editor = null; | ||
_this._needsRefresh = false; | ||
var editor = _this._editor = options.factory({ | ||
@@ -44,3 +43,3 @@ host: _this.node, | ||
} | ||
Object.defineProperty(CodeEditorWidget.prototype, "editor", { | ||
Object.defineProperty(CodeEditorWrapper.prototype, "editor", { | ||
/** | ||
@@ -55,3 +54,3 @@ * Get the editor wrapped by the widget. | ||
}); | ||
Object.defineProperty(CodeEditorWidget.prototype, "model", { | ||
Object.defineProperty(CodeEditorWrapper.prototype, "model", { | ||
/** | ||
@@ -69,3 +68,3 @@ * Get the model used by the widget. | ||
*/ | ||
CodeEditorWidget.prototype.dispose = function () { | ||
CodeEditorWrapper.prototype.dispose = function () { | ||
if (this.isDisposed) { | ||
@@ -79,24 +78,5 @@ return; | ||
/** | ||
* 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. | ||
*/ | ||
CodeEditorWidget.prototype.onActivateRequest = function (msg) { | ||
CodeEditorWrapper.prototype.onActivateRequest = function (msg) { | ||
this._editor.focus(); | ||
@@ -107,8 +87,6 @@ }; | ||
*/ | ||
CodeEditorWidget.prototype.onAfterAttach = function (msg) { | ||
CodeEditorWrapper.prototype.onAfterAttach = function (msg) { | ||
_super.prototype.onAfterAttach.call(this, msg); | ||
this.node.addEventListener('focus', this, true); | ||
if (this.isVisible) { | ||
this._editor.refresh(); | ||
this._needsRefresh = false; | ||
} | ||
@@ -119,41 +97,20 @@ }; | ||
*/ | ||
CodeEditorWidget.prototype.onAfterShow = function (msg) { | ||
CodeEditorWrapper.prototype.onAfterShow = function (msg) { | ||
this._editor.refresh(); | ||
this._needsRefresh = false; | ||
}; | ||
/** | ||
* 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) { | ||
CodeEditorWrapper.prototype.onResize = function (msg) { | ||
if (msg.width >= 0 && msg.height >= 0) { | ||
this._editor.setSize(msg); | ||
this._needsRefresh = false; | ||
} | ||
else if (this._editor.hasFocus()) { | ||
this._editor.refresh(); | ||
this._needsRefresh = false; | ||
} | ||
else { | ||
this._needsRefresh = true; | ||
this._editor.resizeToFit(); | ||
} | ||
}; | ||
/** | ||
* Handle `focus` events for the widget. | ||
*/ | ||
CodeEditorWidget.prototype._evtFocus = function (event) { | ||
if (this._needsRefresh) { | ||
this._editor.refresh(); | ||
this._needsRefresh = false; | ||
} | ||
}; | ||
/** | ||
* Handle a change in model selections. | ||
*/ | ||
CodeEditorWidget.prototype._onSelectionsChanged = function () { | ||
CodeEditorWrapper.prototype._onSelectionsChanged = function () { | ||
var _a = this._editor.getSelection(), start = _a.start, end = _a.end; | ||
@@ -167,4 +124,4 @@ if (start.column !== end.column || start.line !== end.line) { | ||
}; | ||
return CodeEditorWidget; | ||
return CodeEditorWrapper; | ||
}(widgets_1.Widget)); | ||
exports.CodeEditorWidget = CodeEditorWidget; | ||
exports.CodeEditorWrapper = CodeEditorWrapper; |
{ | ||
"name": "@jupyterlab/codeeditor", | ||
"version": "0.3.1", | ||
"version": "0.4.0", | ||
"description": "JupyterLab - Abstract Code Editor", | ||
@@ -16,4 +16,4 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@jupyterlab/coreutils": "^0.3.1", | ||
"@jupyterlab/services": "^0.42.1", | ||
"@jupyterlab/coreutils": "^0.4.0", | ||
"@jupyterlab/services": "^0.43.0", | ||
"@phosphor/coreutils": "^1.0.0", | ||
@@ -20,0 +20,0 @@ "@phosphor/disposable": "^1.0.0", |
Sorry, the diff of this file is not supported yet
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
42356
1348
+ Added@jupyterlab/coreutils@0.4.0(transitive)
+ Added@jupyterlab/services@0.43.0(transitive)
- Removed@jupyterlab/coreutils@0.3.1(transitive)
- Removed@jupyterlab/services@0.42.1(transitive)
Updated@jupyterlab/coreutils@^0.4.0
Updated@jupyterlab/services@^0.43.0