@jupyterlab/codeeditor 4.1.0-alpha.1 → 4.1.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/editor.d.ts +4 -1
- package/lib/editor.js +4 -2
- package/lib/editor.js.map +1 -1
- package/lib/mimetype.d.ts +4 -0
- package/lib/mimetype.js.map +1 -1
- package/package.json +12 -12
- package/src/editor.ts +9 -3
- package/src/mimetype.ts +4 -0
- package/style/base.css +1 -2
package/lib/editor.d.ts
CHANGED
|
@@ -191,11 +191,14 @@ export declare namespace CodeEditor {
|
|
|
191
191
|
* Set the primary position of the cursor.
|
|
192
192
|
*
|
|
193
193
|
* @param position - The new primary position.
|
|
194
|
+
* @param options - Adjustment options allowing to disable scrolling.
|
|
194
195
|
*
|
|
195
196
|
* #### Notes
|
|
196
197
|
* This will remove any secondary cursors.
|
|
197
198
|
*/
|
|
198
|
-
setCursorPosition(position: IPosition
|
|
199
|
+
setCursorPosition(position: IPosition, options?: {
|
|
200
|
+
scroll?: boolean;
|
|
201
|
+
}): void;
|
|
199
202
|
/**
|
|
200
203
|
* Returns the primary selection, never `null`.
|
|
201
204
|
*/
|
package/lib/editor.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { YFile } from '@jupyter/ydoc';
|
|
4
4
|
import { ObservableMap } from '@jupyterlab/observables';
|
|
5
5
|
import { Signal } from '@lumino/signaling';
|
|
6
|
+
import { IEditorMimeTypeService } from './mimetype';
|
|
6
7
|
/**
|
|
7
8
|
* A namespace for code editors.
|
|
8
9
|
*
|
|
@@ -28,12 +29,13 @@ export var CodeEditor;
|
|
|
28
29
|
this.standaloneModel = false;
|
|
29
30
|
this._isDisposed = false;
|
|
30
31
|
this._selections = new ObservableMap();
|
|
31
|
-
this._mimeType =
|
|
32
|
+
this._mimeType = IEditorMimeTypeService.defaultMimeType;
|
|
32
33
|
this._mimeTypeChanged = new Signal(this);
|
|
33
34
|
// Track if we need to dispose the model or not.
|
|
34
35
|
this.standaloneModel = typeof options.sharedModel === 'undefined';
|
|
35
36
|
this.sharedModel = (_a = options.sharedModel) !== null && _a !== void 0 ? _a : new YFile();
|
|
36
|
-
this._mimeType =
|
|
37
|
+
this._mimeType =
|
|
38
|
+
(_b = options.mimeType) !== null && _b !== void 0 ? _b : IEditorMimeTypeService.defaultMimeType;
|
|
37
39
|
}
|
|
38
40
|
/**
|
|
39
41
|
* A signal emitted when a mimetype changes.
|
package/lib/editor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.js","sourceRoot":"","sources":["../src/editor.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAG3D,OAAO,EAAe,KAAK,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAkB,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAIxE,OAAO,EAAW,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEpD;;;;;;;GAOG;AACH,MAAM,KAAW,UAAU,
|
|
1
|
+
{"version":3,"file":"editor.js","sourceRoot":"","sources":["../src/editor.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAG3D,OAAO,EAAe,KAAK,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAkB,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAIxE,OAAO,EAAW,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEpD;;;;;;;GAOG;AACH,MAAM,KAAW,UAAU,CAgiB1B;AAhiBD,WAAiB,UAAU;IAsIzB;;OAEG;IACH,MAAa,KAAK;QAChB;;WAEG;QACH,YAAY,UAA0B,EAAE;;YAoExC;;eAEG;YACO,oBAAe,GAAG,KAAK,CAAC;YAE1B,gBAAW,GAAG,KAAK,CAAC;YACpB,gBAAW,GAAG,IAAI,aAAa,EAAoB,CAAC;YACpD,cAAS,GAAG,sB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C,WAAW,CAAC,OAAO,EAAE,CAAC;aAC5B;YACD,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC;KAWF;IAjFY,gBAAK,QAiFjB,CAAA;AAsUH,CAAC,EAhiBgB,UAAU,KAAV,UAAU,QAgiB1B"}
|
package/lib/mimetype.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export interface IEditorMimeTypeService {
|
|
|
12
12
|
*
|
|
13
13
|
* #### Notes
|
|
14
14
|
* If a mime type cannot be found returns the default mime type `text/plain`, never `null`.
|
|
15
|
+
* There may be more than one mime type, but only the first one will be returned.
|
|
16
|
+
* To access all mime types, use `IEditorLanguageRegistry` instead.
|
|
15
17
|
*/
|
|
16
18
|
getMimeTypeByLanguage(info: nbformat.ILanguageInfoMetadata): string;
|
|
17
19
|
/**
|
|
@@ -23,6 +25,8 @@ export interface IEditorMimeTypeService {
|
|
|
23
25
|
*
|
|
24
26
|
* #### Notes
|
|
25
27
|
* If a mime type cannot be found returns the default mime type `text/plain`, never `null`.
|
|
28
|
+
* There may be more than one mime type, but only the first one will be returned.
|
|
29
|
+
* To access all mime types, use `IEditorLanguageRegistry` instead.
|
|
26
30
|
*/
|
|
27
31
|
getMimeTypeByFilePath(filePath: string): string;
|
|
28
32
|
}
|
package/lib/mimetype.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mimetype.js","sourceRoot":"","sources":["../src/mimetype.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;
|
|
1
|
+
{"version":3,"file":"mimetype.js","sourceRoot":"","sources":["../src/mimetype.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAqC3D;;GAEG;AACH,MAAM,KAAW,sBAAsB,CAKtC;AALD,WAAiB,sBAAsB;IACrC;;OAEG;IACU,sCAAe,GAAW,YAAY,CAAC;AACtD,CAAC,EALgB,sBAAsB,KAAtB,sBAAsB,QAKtC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jupyterlab/codeeditor",
|
|
3
|
-
"version": "4.1.0-alpha.
|
|
3
|
+
"version": "4.1.0-alpha.3",
|
|
4
4
|
"description": "JupyterLab - Abstract Code Editor",
|
|
5
5
|
"homepage": "https://github.com/jupyterlab/jupyterlab",
|
|
6
6
|
"bugs": {
|
|
@@ -43,28 +43,28 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@codemirror/state": "^6.2.0",
|
|
46
|
-
"@jupyter/ydoc": "^1.
|
|
47
|
-
"@jupyterlab/coreutils": "^6.1.0-alpha.
|
|
48
|
-
"@jupyterlab/nbformat": "^4.1.0-alpha.
|
|
49
|
-
"@jupyterlab/observables": "^5.1.0-alpha.
|
|
50
|
-
"@jupyterlab/statusbar": "^4.1.0-alpha.
|
|
51
|
-
"@jupyterlab/translation": "^4.1.0-alpha.
|
|
52
|
-
"@jupyterlab/ui-components": "^4.1.0-alpha.
|
|
46
|
+
"@jupyter/ydoc": "^1.1.1",
|
|
47
|
+
"@jupyterlab/coreutils": "^6.1.0-alpha.3",
|
|
48
|
+
"@jupyterlab/nbformat": "^4.1.0-alpha.3",
|
|
49
|
+
"@jupyterlab/observables": "^5.1.0-alpha.3",
|
|
50
|
+
"@jupyterlab/statusbar": "^4.1.0-alpha.3",
|
|
51
|
+
"@jupyterlab/translation": "^4.1.0-alpha.3",
|
|
52
|
+
"@jupyterlab/ui-components": "^4.1.0-alpha.3",
|
|
53
53
|
"@lumino/coreutils": "^2.1.2",
|
|
54
54
|
"@lumino/disposable": "^2.1.2",
|
|
55
55
|
"@lumino/dragdrop": "^2.1.3",
|
|
56
56
|
"@lumino/messaging": "^2.0.1",
|
|
57
57
|
"@lumino/signaling": "^2.1.2",
|
|
58
|
-
"@lumino/widgets": "^2.3.0",
|
|
58
|
+
"@lumino/widgets": "^2.3.1-alpha.0",
|
|
59
59
|
"react": "^18.2.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@jupyterlab/testing": "^4.1.0-alpha.
|
|
62
|
+
"@jupyterlab/testing": "^4.1.0-alpha.3",
|
|
63
63
|
"@types/jest": "^29.2.0",
|
|
64
64
|
"jest": "^29.2.0",
|
|
65
|
-
"rimraf": "~
|
|
65
|
+
"rimraf": "~5.0.5",
|
|
66
66
|
"typedoc": "~0.24.7",
|
|
67
|
-
"typescript": "~5.
|
|
67
|
+
"typescript": "~5.1.6"
|
|
68
68
|
},
|
|
69
69
|
"publishConfig": {
|
|
70
70
|
"access": "public"
|
package/src/editor.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { ITranslator } from '@jupyterlab/translation';
|
|
|
9
9
|
import { JSONObject } from '@lumino/coreutils';
|
|
10
10
|
import { IDisposable } from '@lumino/disposable';
|
|
11
11
|
import { ISignal, Signal } from '@lumino/signaling';
|
|
12
|
+
import { IEditorMimeTypeService } from './mimetype';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* A namespace for code editors.
|
|
@@ -163,7 +164,8 @@ export namespace CodeEditor {
|
|
|
163
164
|
// Track if we need to dispose the model or not.
|
|
164
165
|
this.standaloneModel = typeof options.sharedModel === 'undefined';
|
|
165
166
|
this.sharedModel = options.sharedModel ?? new YFile();
|
|
166
|
-
this._mimeType =
|
|
167
|
+
this._mimeType =
|
|
168
|
+
options.mimeType ?? IEditorMimeTypeService.defaultMimeType;
|
|
167
169
|
}
|
|
168
170
|
|
|
169
171
|
/**
|
|
@@ -233,7 +235,7 @@ export namespace CodeEditor {
|
|
|
233
235
|
|
|
234
236
|
private _isDisposed = false;
|
|
235
237
|
private _selections = new ObservableMap<ITextSelection[]>();
|
|
236
|
-
private _mimeType =
|
|
238
|
+
private _mimeType = IEditorMimeTypeService.defaultMimeType;
|
|
237
239
|
private _mimeTypeChanged = new Signal<this, IChangedArgs<string>>(this);
|
|
238
240
|
}
|
|
239
241
|
|
|
@@ -255,11 +257,15 @@ export namespace CodeEditor {
|
|
|
255
257
|
* Set the primary position of the cursor.
|
|
256
258
|
*
|
|
257
259
|
* @param position - The new primary position.
|
|
260
|
+
* @param options - Adjustment options allowing to disable scrolling.
|
|
258
261
|
*
|
|
259
262
|
* #### Notes
|
|
260
263
|
* This will remove any secondary cursors.
|
|
261
264
|
*/
|
|
262
|
-
setCursorPosition(
|
|
265
|
+
setCursorPosition(
|
|
266
|
+
position: IPosition,
|
|
267
|
+
options?: { scroll?: boolean }
|
|
268
|
+
): void;
|
|
263
269
|
|
|
264
270
|
/**
|
|
265
271
|
* Returns the primary selection, never `null`.
|
package/src/mimetype.ts
CHANGED
|
@@ -16,6 +16,8 @@ export interface IEditorMimeTypeService {
|
|
|
16
16
|
*
|
|
17
17
|
* #### Notes
|
|
18
18
|
* If a mime type cannot be found returns the default mime type `text/plain`, never `null`.
|
|
19
|
+
* There may be more than one mime type, but only the first one will be returned.
|
|
20
|
+
* To access all mime types, use `IEditorLanguageRegistry` instead.
|
|
19
21
|
*/
|
|
20
22
|
getMimeTypeByLanguage(info: nbformat.ILanguageInfoMetadata): string;
|
|
21
23
|
|
|
@@ -28,6 +30,8 @@ export interface IEditorMimeTypeService {
|
|
|
28
30
|
*
|
|
29
31
|
* #### Notes
|
|
30
32
|
* If a mime type cannot be found returns the default mime type `text/plain`, never `null`.
|
|
33
|
+
* There may be more than one mime type, but only the first one will be returned.
|
|
34
|
+
* To access all mime types, use `IEditorLanguageRegistry` instead.
|
|
31
35
|
*/
|
|
32
36
|
getMimeTypeByFilePath(filePath: string): string;
|
|
33
37
|
}
|
package/style/base.css
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/*-----------------------------------------------------------------------------
|
|
2
|
-
| Copyright (c)
|
|
3
|
-
|
|
|
2
|
+
| Copyright (c) Jupyter Development Team.
|
|
4
3
|
| Distributed under the terms of the Modified BSD License.
|
|
5
4
|
|----------------------------------------------------------------------------*/
|
|
6
5
|
@import url('./linecol.css');
|