@jupyterlab/codeeditor
Advanced tools
Comparing version 0.7.0 to 0.8.0
@@ -257,14 +257,2 @@ import { JSONObject } from '@phosphor/coreutils'; | ||
/** | ||
* Whether line numbers should be displayed. Defaults to false. | ||
*/ | ||
lineNumbers: boolean; | ||
/** | ||
* Set to false for horizontal scrolling. Defaults to true. | ||
*/ | ||
wordWrap: boolean; | ||
/** | ||
* Whether the editor is read-only. Defaults to false. | ||
*/ | ||
readOnly: boolean; | ||
/** | ||
* The DOM node that hosts the editor. | ||
@@ -290,2 +278,10 @@ */ | ||
/** | ||
* Get a config option for the editor. | ||
*/ | ||
getOption<K extends keyof IConfig>(option: K): IConfig[K]; | ||
/** | ||
* Set a config option for the editor. | ||
*/ | ||
setOption<K extends keyof IConfig>(option: K, value: IConfig[K]): void; | ||
/** | ||
* Returns the content for the given line number. | ||
@@ -407,2 +403,39 @@ * | ||
/** | ||
* The configuration options for an editor. | ||
*/ | ||
interface IConfig { | ||
/** | ||
* Whether line numbers should be displayed. | ||
*/ | ||
lineNumbers: boolean; | ||
/** | ||
* Set to false for horizontal scrolling. | ||
*/ | ||
lineWrap: boolean; | ||
/** | ||
* Whether the editor is read-only. | ||
*/ | ||
readOnly: boolean; | ||
/** | ||
* The number of spaces a tab is equal to. | ||
*/ | ||
tabSize: number; | ||
/** | ||
* Whether to insert spaces when pressing Tab. | ||
*/ | ||
insertSpaces: boolean; | ||
/** | ||
* Whether to highlight matching brackets when one of them is selected. | ||
*/ | ||
matchBrackets: boolean; | ||
/** | ||
* Whether to automatically close brackets after opening them. | ||
*/ | ||
autoClosingBrackets: boolean; | ||
} | ||
/** | ||
* The default configuration options for an editor. | ||
*/ | ||
let defaultConfig: IConfig; | ||
/** | ||
* The options used to initialize an editor. | ||
@@ -424,17 +457,9 @@ */ | ||
/** | ||
* Whether line numbers should be displayed. Defaults to `false`. | ||
* The default selection style for the editor. | ||
*/ | ||
lineNumbers?: boolean; | ||
selectionStyle?: CodeEditor.ISelectionStyle; | ||
/** | ||
* Set to false for horizontal scrolling. Defaults to `true`. | ||
* The configuration options for the editor. | ||
*/ | ||
wordWrap?: boolean; | ||
/** | ||
* Whether the editor is read-only. Defaults to `false`. | ||
*/ | ||
readOnly?: boolean; | ||
/** | ||
* The default selection style for the editor. | ||
*/ | ||
selectionStyle?: CodeEditor.ISelectionStyle; | ||
config?: Partial<IConfig>; | ||
} | ||
@@ -441,0 +466,0 @@ namespace Model { |
@@ -118,2 +118,14 @@ "use strict"; | ||
CodeEditor.Model = Model; | ||
/** | ||
* The default configuration options for an editor. | ||
*/ | ||
CodeEditor.defaultConfig = { | ||
lineNumbers: false, | ||
lineWrap: true, | ||
readOnly: false, | ||
tabSize: 4, | ||
insertSpaces: true, | ||
matchBrackets: true, | ||
autoClosingBrackets: true | ||
}; | ||
})(CodeEditor = exports.CodeEditor || (exports.CodeEditor = {})); |
@@ -81,3 +81,3 @@ "use strict"; | ||
_this.editor = options.editorFactory({ host: host, model: model }); | ||
_this.editor.readOnly = true; | ||
_this.editor.setOption('readOnly', true); | ||
_this.collapsible = !!options.collapsible; | ||
@@ -174,3 +174,3 @@ return _this; | ||
this._source = value; | ||
this.editor.readOnly = !value; | ||
this.editor.setOption('readOnly', value === null); | ||
if (value) { | ||
@@ -315,3 +315,3 @@ value.changed.connect(this._onSourceChanged, this); | ||
var current = this._getContent() || {}; | ||
var old = this._originalValue; | ||
var old = this._originalValue || {}; | ||
var user = JSON.parse(model.value.text); | ||
@@ -321,3 +321,3 @@ var source = this.source; | ||
for (var key in user) { | ||
if (!coreutils_1.JSONExt.deepEqual(user[key], old[key])) { | ||
if (!coreutils_1.JSONExt.deepEqual(user[key], old[key] || null)) { | ||
current[key] = user[key]; | ||
@@ -324,0 +324,0 @@ } |
@@ -71,14 +71,6 @@ import { Message } from '@phosphor/messaging'; | ||
/** | ||
* Whether line numbers should be displayed. Defaults to `false`. | ||
* The configuration options for the editor. | ||
*/ | ||
lineNumbers?: boolean; | ||
config?: Partial<CodeEditor.IConfig>; | ||
/** | ||
* Set to false for horizontal scrolling. Defaults to `true`. | ||
*/ | ||
wordWrap?: boolean; | ||
/** | ||
* Whether the editor is read-only. Defaults to `false`. | ||
*/ | ||
readOnly?: boolean; | ||
/** | ||
* The default selection style for the editor. | ||
@@ -85,0 +77,0 @@ */ |
@@ -35,4 +35,3 @@ "use strict"; | ||
uuid: options.uuid, | ||
wordWrap: options.wordWrap, | ||
readOnly: options.readOnly, | ||
config: options.config, | ||
selectionStyle: options.selectionStyle | ||
@@ -39,0 +38,0 @@ }); |
{ | ||
"name": "@jupyterlab/codeeditor", | ||
"version": "0.7.0", | ||
"version": "0.8.0", | ||
"description": "JupyterLab - Abstract Code Editor", | ||
@@ -16,5 +16,5 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@jupyterlab/coreutils": "^0.7.0", | ||
"@jupyterlab/services": "^0.46.0", | ||
"@phosphor/coreutils": "^1.1.1", | ||
"@jupyterlab/coreutils": "^0.8.0", | ||
"@jupyterlab/services": "^0.47.0", | ||
"@phosphor/coreutils": "^1.2.0", | ||
"@phosphor/disposable": "^1.1.1", | ||
@@ -27,3 +27,3 @@ "@phosphor/messaging": "^1.2.1", | ||
"rimraf": "^2.5.2", | ||
"typescript": "^2.2.1" | ||
"typescript": "~2.3.1" | ||
}, | ||
@@ -30,0 +30,0 @@ "scripts": { |
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
46985
1507
4
48
+ Added@jupyterlab/coreutils@0.8.1(transitive)
+ Added@jupyterlab/services@0.47.1(transitive)
+ Addedajv@5.5.2(transitive)
+ Addedco@4.6.0(transitive)
+ Addedfast-deep-equal@1.1.0(transitive)
+ Addedfast-json-stable-stringify@2.1.0(transitive)
+ Addedjson-schema-traverse@0.3.1(transitive)
- Removed@jupyterlab/coreutils@0.7.1(transitive)
- Removed@jupyterlab/services@0.46.0(transitive)
Updated@jupyterlab/coreutils@^0.8.0
Updated@jupyterlab/services@^0.47.0
Updated@phosphor/coreutils@^1.2.0