@jupyterlab/codemirror 4.0.4 → 4.0.6
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/mimetype.d.ts +4 -0
- package/lib/mimetype.js +8 -1
- package/lib/mimetype.js.map +1 -1
- package/package.json +10 -10
- package/src/mimetype.ts +7 -1
package/lib/mimetype.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export declare class CodeMirrorMimeTypeService implements 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
|
/**
|
|
@@ -19,6 +21,8 @@ export declare class CodeMirrorMimeTypeService implements IEditorMimeTypeService
|
|
|
19
21
|
*
|
|
20
22
|
* #### Notes
|
|
21
23
|
* If a mime type cannot be found returns the default mime type `text/plain`, never `null`.
|
|
24
|
+
* There may be more than one mime type, but only the first one will be returned.
|
|
25
|
+
* To access all mime types, use `IEditorLanguageRegistry` instead.
|
|
22
26
|
*/
|
|
23
27
|
getMimeTypeByFilePath(path: string): string;
|
|
24
28
|
}
|
package/lib/mimetype.js
CHANGED
|
@@ -14,8 +14,11 @@ export class CodeMirrorMimeTypeService {
|
|
|
14
14
|
*
|
|
15
15
|
* #### Notes
|
|
16
16
|
* If a mime type cannot be found returns the default mime type `text/plain`, never `null`.
|
|
17
|
+
* There may be more than one mime type, but only the first one will be returned.
|
|
18
|
+
* To access all mime types, use `IEditorLanguageRegistry` instead.
|
|
17
19
|
*/
|
|
18
20
|
getMimeTypeByLanguage(info) {
|
|
21
|
+
var _a;
|
|
19
22
|
const ext = info.file_extension || '';
|
|
20
23
|
const mode = this.languages.findBest(info.codemirror_mode || {
|
|
21
24
|
mimetype: info.mimetype,
|
|
@@ -23,7 +26,9 @@ export class CodeMirrorMimeTypeService {
|
|
|
23
26
|
ext: [ext.split('.').slice(-1)[0]]
|
|
24
27
|
});
|
|
25
28
|
return mode
|
|
26
|
-
? mode.mime
|
|
29
|
+
? Array.isArray(mode.mime)
|
|
30
|
+
? (_a = mode.mime[0]) !== null && _a !== void 0 ? _a : IEditorMimeTypeService.defaultMimeType
|
|
31
|
+
: mode.mime
|
|
27
32
|
: IEditorMimeTypeService.defaultMimeType;
|
|
28
33
|
}
|
|
29
34
|
/**
|
|
@@ -31,6 +36,8 @@ export class CodeMirrorMimeTypeService {
|
|
|
31
36
|
*
|
|
32
37
|
* #### Notes
|
|
33
38
|
* If a mime type cannot be found returns the default mime type `text/plain`, never `null`.
|
|
39
|
+
* There may be more than one mime type, but only the first one will be returned.
|
|
40
|
+
* To access all mime types, use `IEditorLanguageRegistry` instead.
|
|
34
41
|
*/
|
|
35
42
|
getMimeTypeByFilePath(path) {
|
|
36
43
|
var _a;
|
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;AAE3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAIhD;;GAEG;AACH,MAAM,OAAO,yBAAyB;IACpC,YAAsB,SAAkC;QAAlC,cAAS,GAAT,SAAS,CAAyB;IAAG,CAAC;IAC5D
|
|
1
|
+
{"version":3,"file":"mimetype.js","sourceRoot":"","sources":["../src/mimetype.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAIhD;;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AC,mCAAI,sBAAsB,CAAC,eAAe;gBACxD,CAAC,CAAC,IAAI,CAAC,IAAI;YACb,CAAC,CAAC,sBAAsB,CAAC,eAAe,CAAC;IAC7C,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jupyterlab/codemirror",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.6",
|
|
4
4
|
"description": "JupyterLab - CodeMirror Editor Provider",
|
|
5
5
|
"homepage": "https://github.com/jupyterlab/jupyterlab",
|
|
6
6
|
"bugs": {
|
|
@@ -59,22 +59,22 @@
|
|
|
59
59
|
"@codemirror/state": "^6.2.0",
|
|
60
60
|
"@codemirror/view": "^6.9.6",
|
|
61
61
|
"@jupyter/ydoc": "^1.0.2",
|
|
62
|
-
"@jupyterlab/codeeditor": "^4.0.
|
|
63
|
-
"@jupyterlab/coreutils": "^6.0.
|
|
64
|
-
"@jupyterlab/documentsearch": "^4.0.
|
|
65
|
-
"@jupyterlab/nbformat": "^4.0.
|
|
66
|
-
"@jupyterlab/translation": "^4.0.
|
|
62
|
+
"@jupyterlab/codeeditor": "^4.0.6",
|
|
63
|
+
"@jupyterlab/coreutils": "^6.0.6",
|
|
64
|
+
"@jupyterlab/documentsearch": "^4.0.6",
|
|
65
|
+
"@jupyterlab/nbformat": "^4.0.6",
|
|
66
|
+
"@jupyterlab/translation": "^4.0.6",
|
|
67
67
|
"@lezer/common": "^1.0.2",
|
|
68
68
|
"@lezer/generator": "^1.2.2",
|
|
69
69
|
"@lezer/highlight": "^1.1.4",
|
|
70
70
|
"@lezer/markdown": "^1.0.2",
|
|
71
|
-
"@lumino/coreutils": "^2.1.
|
|
72
|
-
"@lumino/disposable": "^2.1.
|
|
73
|
-
"@lumino/signaling": "^2.1.
|
|
71
|
+
"@lumino/coreutils": "^2.1.2",
|
|
72
|
+
"@lumino/disposable": "^2.1.2",
|
|
73
|
+
"@lumino/signaling": "^2.1.2",
|
|
74
74
|
"yjs": "^13.5.40"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
|
-
"@jupyterlab/testing": "^4.0.
|
|
77
|
+
"@jupyterlab/testing": "^4.0.6",
|
|
78
78
|
"@lezer/generator": "^1.2.2",
|
|
79
79
|
"@lezer/lr": "^1.3.3",
|
|
80
80
|
"@types/jest": "^29.2.0",
|
package/src/mimetype.ts
CHANGED
|
@@ -16,6 +16,8 @@ export class CodeMirrorMimeTypeService implements 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
|
const ext = info.file_extension || '';
|
|
@@ -27,7 +29,9 @@ export class CodeMirrorMimeTypeService implements IEditorMimeTypeService {
|
|
|
27
29
|
}
|
|
28
30
|
);
|
|
29
31
|
return mode
|
|
30
|
-
? (mode.mime
|
|
32
|
+
? Array.isArray(mode.mime)
|
|
33
|
+
? mode.mime[0] ?? IEditorMimeTypeService.defaultMimeType
|
|
34
|
+
: mode.mime
|
|
31
35
|
: IEditorMimeTypeService.defaultMimeType;
|
|
32
36
|
}
|
|
33
37
|
|
|
@@ -36,6 +40,8 @@ export class CodeMirrorMimeTypeService implements IEditorMimeTypeService {
|
|
|
36
40
|
*
|
|
37
41
|
* #### Notes
|
|
38
42
|
* If a mime type cannot be found returns the default mime type `text/plain`, never `null`.
|
|
43
|
+
* There may be more than one mime type, but only the first one will be returned.
|
|
44
|
+
* To access all mime types, use `IEditorLanguageRegistry` instead.
|
|
39
45
|
*/
|
|
40
46
|
getMimeTypeByFilePath(path: string): string {
|
|
41
47
|
const ext = PathExt.extname(path);
|