@jupyterlab/fileeditor 4.0.0-alpha.1 → 4.0.0-alpha.12

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.
@@ -0,0 +1,44 @@
1
+ import { DocumentRegistry, IDocumentWidget } from '@jupyterlab/docregistry';
2
+ import { TableOfContents, TableOfContentsModel } from '@jupyterlab/toc';
3
+ import { Widget } from '@lumino/widgets';
4
+ import { FileEditor } from '../widget';
5
+ import { EditorTableOfContentsFactory, IEditorHeading } from './factory';
6
+ /**
7
+ * Table of content model for Markdown files.
8
+ */
9
+ export declare class MarkdownTableOfContentsModel extends TableOfContentsModel<IEditorHeading, IDocumentWidget<FileEditor, DocumentRegistry.IModel>> {
10
+ /**
11
+ * Type of document supported by the model.
12
+ *
13
+ * #### Notes
14
+ * A `data-document-type` attribute with this value will be set
15
+ * on the tree view `.jp-TableOfContents-content[data-document-type="..."]`
16
+ */
17
+ get documentType(): string;
18
+ /**
19
+ * Produce the headings for a document.
20
+ *
21
+ * @returns The list of new headings or `null` if nothing needs to be updated.
22
+ */
23
+ protected getHeadings(): Promise<IEditorHeading[] | null>;
24
+ }
25
+ /**
26
+ * Table of content model factory for Markdown files.
27
+ */
28
+ export declare class MarkdownTableOfContentsFactory extends EditorTableOfContentsFactory {
29
+ /**
30
+ * Whether the factory can handle the widget or not.
31
+ *
32
+ * @param widget - widget
33
+ * @returns boolean indicating a ToC can be generated
34
+ */
35
+ isApplicable(widget: Widget): boolean;
36
+ /**
37
+ * Create a new table of contents model for the widget
38
+ *
39
+ * @param widget - widget
40
+ * @param configuration - Table of contents configuration
41
+ * @returns The table of contents model
42
+ */
43
+ protected _createNew(widget: IDocumentWidget<FileEditor, DocumentRegistry.IModel>, configuration?: TableOfContents.IConfig): MarkdownTableOfContentsModel;
44
+ }
@@ -0,0 +1,66 @@
1
+ // Copyright (c) Jupyter Development Team.
2
+ // Distributed under the terms of the Modified BSD License.
3
+ import { TableOfContentsModel, TableOfContentsUtils } from '@jupyterlab/toc';
4
+ import { EditorTableOfContentsFactory } from './factory';
5
+ /**
6
+ * Table of content model for Markdown files.
7
+ */
8
+ export class MarkdownTableOfContentsModel extends TableOfContentsModel {
9
+ /**
10
+ * Type of document supported by the model.
11
+ *
12
+ * #### Notes
13
+ * A `data-document-type` attribute with this value will be set
14
+ * on the tree view `.jp-TableOfContents-content[data-document-type="..."]`
15
+ */
16
+ get documentType() {
17
+ return 'markdown';
18
+ }
19
+ /**
20
+ * Produce the headings for a document.
21
+ *
22
+ * @returns The list of new headings or `null` if nothing needs to be updated.
23
+ */
24
+ getHeadings() {
25
+ if (!this.isActive) {
26
+ return Promise.resolve(null);
27
+ }
28
+ const content = this.widget.content.model.value.text;
29
+ const headings = TableOfContentsUtils.Markdown.getHeadings(content, Object.assign(Object.assign({}, this.configuration), {
30
+ // Force removing numbering as they cannot be displayed
31
+ // in the document
32
+ numberHeaders: false }));
33
+ return Promise.resolve(headings);
34
+ }
35
+ }
36
+ /**
37
+ * Table of content model factory for Markdown files.
38
+ */
39
+ export class MarkdownTableOfContentsFactory extends EditorTableOfContentsFactory {
40
+ /**
41
+ * Whether the factory can handle the widget or not.
42
+ *
43
+ * @param widget - widget
44
+ * @returns boolean indicating a ToC can be generated
45
+ */
46
+ isApplicable(widget) {
47
+ var _a, _b;
48
+ const isApplicable = super.isApplicable(widget);
49
+ if (isApplicable) {
50
+ let mime = (_b = (_a = widget.content) === null || _a === void 0 ? void 0 : _a.model) === null || _b === void 0 ? void 0 : _b.mimeType;
51
+ return mime && TableOfContentsUtils.Markdown.isMarkdown(mime);
52
+ }
53
+ return false;
54
+ }
55
+ /**
56
+ * Create a new table of contents model for the widget
57
+ *
58
+ * @param widget - widget
59
+ * @param configuration - Table of contents configuration
60
+ * @returns The table of contents model
61
+ */
62
+ _createNew(widget, configuration) {
63
+ return new MarkdownTableOfContentsModel(widget, configuration);
64
+ }
65
+ }
66
+ //# sourceMappingURL=markdown.js.map
@@ -0,0 +1 @@
1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B,MAA4D,EAC5D,aAAuC;QAEvC,OAAO,IAAI,4BAA4B,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACjE,CAAC;CACF"}
@@ -0,0 +1,44 @@
1
+ import { DocumentRegistry, IDocumentWidget } from '@jupyterlab/docregistry';
2
+ import { TableOfContents, TableOfContentsModel } from '@jupyterlab/toc';
3
+ import { Widget } from '@lumino/widgets';
4
+ import { FileEditor } from '../widget';
5
+ import { EditorTableOfContentsFactory, IEditorHeading } from './factory';
6
+ /**
7
+ * Table of content model for Python files.
8
+ */
9
+ export declare class PythonTableOfContentsModel extends TableOfContentsModel<IEditorHeading, IDocumentWidget<FileEditor, DocumentRegistry.IModel>> {
10
+ /**
11
+ * Type of document supported by the model.
12
+ *
13
+ * #### Notes
14
+ * A `data-document-type` attribute with this value will be set
15
+ * on the tree view `.jp-TableOfContents-content[data-document-type="..."]`
16
+ */
17
+ get documentType(): string;
18
+ /**
19
+ * Produce the headings for a document.
20
+ *
21
+ * @returns The list of new headings or `null` if nothing needs to be updated.
22
+ */
23
+ protected getHeadings(): Promise<IEditorHeading[] | null>;
24
+ }
25
+ /**
26
+ * Table of content model factory for Python files.
27
+ */
28
+ export declare class PythonTableOfContentsFactory extends EditorTableOfContentsFactory {
29
+ /**
30
+ * Whether the factory can handle the widget or not.
31
+ *
32
+ * @param widget - widget
33
+ * @returns boolean indicating a ToC can be generated
34
+ */
35
+ isApplicable(widget: Widget): boolean;
36
+ /**
37
+ * Create a new table of contents model for the widget
38
+ *
39
+ * @param widget - widget
40
+ * @param configuration - Table of contents configuration
41
+ * @returns The table of contents model
42
+ */
43
+ protected _createNew(widget: IDocumentWidget<FileEditor>, configuration?: TableOfContents.IConfig): PythonTableOfContentsModel;
44
+ }
@@ -0,0 +1,114 @@
1
+ // Copyright (c) Jupyter Development Team.
2
+ // Distributed under the terms of the Modified BSD License.
3
+ import { TableOfContentsModel } from '@jupyterlab/toc';
4
+ import { EditorTableOfContentsFactory } from './factory';
5
+ /**
6
+ * Regular expression to create the outline
7
+ */
8
+ let KEYWORDS;
9
+ try {
10
+ // https://github.com/tc39/proposal-regexp-match-indices was accepted
11
+ // in May 2021 (https://github.com/tc39/proposals/blob/main/finished-proposals.md)
12
+ // So we will fallback to the polyfill regexp-match-indices if not available
13
+ KEYWORDS = new RegExp('^\\s*(class |def |from |import )', 'd');
14
+ }
15
+ catch (_a) {
16
+ KEYWORDS = new RegExp('^\\s*(class |def |from |import )');
17
+ }
18
+ /**
19
+ * Table of content model for Python files.
20
+ */
21
+ export class PythonTableOfContentsModel extends TableOfContentsModel {
22
+ /**
23
+ * Type of document supported by the model.
24
+ *
25
+ * #### Notes
26
+ * A `data-document-type` attribute with this value will be set
27
+ * on the tree view `.jp-TableOfContents-content[data-document-type="..."]`
28
+ */
29
+ get documentType() {
30
+ return 'python';
31
+ }
32
+ /**
33
+ * Produce the headings for a document.
34
+ *
35
+ * @returns The list of new headings or `null` if nothing needs to be updated.
36
+ */
37
+ async getHeadings() {
38
+ if (!this.isActive) {
39
+ return Promise.resolve(null);
40
+ }
41
+ // Split the text into lines:
42
+ const lines = this.widget.content.model.value.text.split('\n');
43
+ // Iterate over the lines to get the heading level and text for each line:
44
+ let headings = new Array();
45
+ let processingImports = false;
46
+ let indent = 1;
47
+ let lineIdx = -1;
48
+ for (const line of lines) {
49
+ lineIdx++;
50
+ let hasKeyword;
51
+ if (KEYWORDS.flags.includes('d')) {
52
+ hasKeyword = KEYWORDS.exec(line);
53
+ }
54
+ else {
55
+ const { default: execWithIndices } = await import('regexp-match-indices');
56
+ hasKeyword = execWithIndices(KEYWORDS, line);
57
+ }
58
+ if (hasKeyword) {
59
+ // Index 0 contains the spaces, index 1 is the keyword group
60
+ const [start] = hasKeyword.indices[1];
61
+ if (indent === 1 && start > 0) {
62
+ indent = start;
63
+ }
64
+ const isImport = ['from ', 'import '].includes(hasKeyword[1]);
65
+ if (isImport && processingImports) {
66
+ continue;
67
+ }
68
+ processingImports = isImport;
69
+ const level = 1 + start / indent;
70
+ if (level > this.configuration.maximalDepth) {
71
+ continue;
72
+ }
73
+ headings.push({
74
+ text: line.slice(start),
75
+ level,
76
+ line: lineIdx
77
+ });
78
+ }
79
+ }
80
+ return Promise.resolve(headings);
81
+ }
82
+ }
83
+ /**
84
+ * Table of content model factory for Python files.
85
+ */
86
+ export class PythonTableOfContentsFactory extends EditorTableOfContentsFactory {
87
+ /**
88
+ * Whether the factory can handle the widget or not.
89
+ *
90
+ * @param widget - widget
91
+ * @returns boolean indicating a ToC can be generated
92
+ */
93
+ isApplicable(widget) {
94
+ var _a, _b;
95
+ const isApplicable = super.isApplicable(widget);
96
+ if (isApplicable) {
97
+ let mime = (_b = (_a = widget.content) === null || _a === void 0 ? void 0 : _a.model) === null || _b === void 0 ? void 0 : _b.mimeType;
98
+ return (mime &&
99
+ (mime === 'application/x-python-code' || mime === 'text/x-python'));
100
+ }
101
+ return false;
102
+ }
103
+ /**
104
+ * Create a new table of contents model for the widget
105
+ *
106
+ * @param widget - widget
107
+ * @param configuration - Table of contents configuration
108
+ * @returns The table of contents model
109
+ */
110
+ _createNew(widget, configuration) {
111
+ return new PythonTableOfContentsModel(widget, configuration);
112
+ }
113
+ }
114
+ //# sourceMappingURL=python.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"python.js","sourceRoot":"","sources":["../../src/toc/python.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAK3D,OAAO,EAAmB,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAGxE,OAAO,EAAE,4BAA4B,EAAkB,MAAM,WAAW,CAAC;AAEzE;;GAEG;AACH,IAAI,QAAgB,CAAC;AACrB,IAAI;IACF,qEAAqE;IACrE,kFAAkF;IAClF,4EAA4E;IAC5E,QAAQ,GAAG,IAAI,MAAM,CAAC,kCAAkC,EAAE,GAAG,CAAC,CAAC;CAChE;AAAC,WAAM;IACN,QAAQ,GAAG,IAAI,MAAM,CAAC,kCAAkC,CAAC,CAAC;CAC3D;AAED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AAO,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC9D,IAAI,QAAQ,IAAI,iBAAiB,EAAE;oBACjC,SAAS;iBACV;gBACD,iBAAiB,GAAG,QAAQ,CAAC;gBAE7B,MAAM,KAAK,GAAG,CAAC,GAAG,KAAK,GAAG,MAAM,CAAC;gBAEjC,IAAI,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,YAAY,EAAE;oBAC3C,SAAS;iBACV;gBAED,QAAQ,CAAC,IAAI,CAAC;oBACZ,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;oBACvB,KAAK;oBACL,IAAI,EAAE,OAAO;iBACd,CAAC,CAAC;aACJ;SACF;QAED,OAAO,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,4BAA6B,SAAQ,4BAA4B;IAC5E;;;;;OAKG;IACH,YAAY,CAAC,MAAc;;QACzB,MAAM,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QAEhD,IAAI,YAAY,EAAE;YAChB,IAAI,IAAI,GAAG,MAAA,MAAC,MAAc,CAAC,OAAO,0CAAE,KAAK,0CAAE,QAAQ,CAAC;YACpD,OAAO,CACL,IAAI;gBACJ,CAAC,IAAI,KAAK,2BAA2B,IAAI,IAAI,KAAK,eAAe,CAAC,CACnE,CAAC;SACH;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;;OAMG;IACO,UAAU,CAClB,MAAmC,EACnC,aAAuC;QAEvC,OAAO,IAAI,0BAA0B,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC/D,CAAC;CACF"}
package/lib/tokens.js CHANGED
@@ -1,10 +1,8 @@
1
1
  // Copyright (c) Jupyter Development Team.
2
2
  // Distributed under the terms of the Modified BSD License.
3
3
  import { Token } from '@lumino/coreutils';
4
- /* tslint:disable */
5
4
  /**
6
5
  * The editor tracker token.
7
6
  */
8
7
  export const IEditorTracker = new Token('@jupyterlab/fileeditor:IEditorTracker');
9
- /* tslint:enable */
10
8
  //# sourceMappingURL=tokens.js.map
package/lib/tokens.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"tokens.js","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAI3D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAS1C,oBAAoB;AACpB;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,KAAK,CACrC,uCAAuC,CACxC,CAAC;AACF,mBAAmB"}
1
+ {"version":3,"file":"tokens.js","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAI3D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAS1C;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,KAAK,CACrC,uCAAuC,CACxC,CAAC"}
package/lib/widget.d.ts CHANGED
@@ -1,39 +1,7 @@
1
- import { CodeEditor, CodeEditorWrapper, IEditorMimeTypeService, IEditorServices } from '@jupyterlab/codeeditor';
1
+ import { CodeEditor, IEditorMimeTypeService, IEditorServices } from '@jupyterlab/codeeditor';
2
2
  import { ABCWidgetFactory, DocumentRegistry, IDocumentWidget } from '@jupyterlab/docregistry';
3
3
  import { Message } from '@lumino/messaging';
4
4
  import { Widget } from '@lumino/widgets';
5
- /**
6
- * A code editor wrapper for the file editor.
7
- */
8
- export declare class FileEditorCodeWrapper extends CodeEditorWrapper {
9
- /**
10
- * Construct a new editor widget.
11
- */
12
- constructor(options: FileEditor.IOptions);
13
- /**
14
- * Get the context for the editor widget.
15
- */
16
- get context(): DocumentRegistry.Context;
17
- /**
18
- * A promise that resolves when the file editor is ready.
19
- */
20
- get ready(): Promise<void>;
21
- /**
22
- * Handle actions that should be taken when the context is ready.
23
- */
24
- private _onContextReady;
25
- /**
26
- * Handle a change in context model content.
27
- */
28
- private _onContentChanged;
29
- /**
30
- * Handle a change to the collaborators on the model
31
- * by updating UI elements associated with them.
32
- */
33
- private _onCollaboratorsChanged;
34
- protected _context: DocumentRegistry.Context;
35
- private _ready;
36
- }
37
5
  /**
38
6
  * A widget for editors.
39
7
  */
@@ -77,15 +45,20 @@ export declare class FileEditor extends Widget {
77
45
  * Ensure that the widget has focus.
78
46
  */
79
47
  private _ensureFocus;
48
+ /**
49
+ * Handle actions that should be taken when the context is ready.
50
+ */
51
+ private _onContextReady;
80
52
  /**
81
53
  * Handle a change to the path.
82
54
  */
83
55
  private _onPathChanged;
84
- private editorWidget;
85
56
  model: CodeEditor.IModel;
86
57
  editor: CodeEditor.IEditor;
87
- protected _context: DocumentRegistry.Context;
58
+ private _context;
59
+ private _editorWidget;
88
60
  private _mimeTypeService;
61
+ private _ready;
89
62
  }
90
63
  /**
91
64
  * The namespace for editor widget statics.
package/lib/widget.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // Copyright (c) Jupyter Development Team.
2
2
  // Distributed under the terms of the Modified BSD License.
3
- import { CodeEditor, CodeEditorWrapper } from '@jupyterlab/codeeditor';
3
+ import { CodeEditorWrapper } from '@jupyterlab/codeeditor';
4
4
  import { ABCWidgetFactory, DocumentWidget } from '@jupyterlab/docregistry';
5
5
  import { textEditorIcon } from '@jupyterlab/ui-components';
6
6
  import { PromiseDelegate } from '@lumino/coreutils';
@@ -13,105 +13,6 @@ const CODE_RUNNER = 'jpCodeRunner';
13
13
  * The data attribute added to a widget that can undo.
14
14
  */
15
15
  const UNDOER = 'jpUndoer';
16
- /**
17
- * A code editor wrapper for the file editor.
18
- */
19
- export class FileEditorCodeWrapper extends CodeEditorWrapper {
20
- /**
21
- * Construct a new editor widget.
22
- */
23
- constructor(options) {
24
- super({
25
- factory: options.factory,
26
- model: options.context.model
27
- });
28
- this._ready = new PromiseDelegate();
29
- const context = (this._context = options.context);
30
- const editor = this.editor;
31
- this.addClass('jp-FileEditorCodeWrapper');
32
- this.node.dataset[CODE_RUNNER] = 'true';
33
- this.node.dataset[UNDOER] = 'true';
34
- editor.model.value.text = context.model.toString();
35
- void context.ready.then(() => {
36
- this._onContextReady();
37
- });
38
- if (context.model.modelDB.isCollaborative) {
39
- const modelDB = context.model.modelDB;
40
- void modelDB.connected.then(() => {
41
- const collaborators = modelDB.collaborators;
42
- if (!collaborators) {
43
- return;
44
- }
45
- // Setup the selection style for collaborators
46
- const localCollaborator = collaborators.localCollaborator;
47
- this.editor.uuid = localCollaborator.sessionId;
48
- this.editor.selectionStyle = Object.assign(Object.assign({}, CodeEditor.defaultSelectionStyle), { color: localCollaborator.color });
49
- collaborators.changed.connect(this._onCollaboratorsChanged, this);
50
- // Trigger an initial onCollaboratorsChanged event.
51
- this._onCollaboratorsChanged();
52
- });
53
- }
54
- }
55
- /**
56
- * Get the context for the editor widget.
57
- */
58
- get context() {
59
- return this._context;
60
- }
61
- /**
62
- * A promise that resolves when the file editor is ready.
63
- */
64
- get ready() {
65
- return this._ready.promise;
66
- }
67
- /**
68
- * Handle actions that should be taken when the context is ready.
69
- */
70
- _onContextReady() {
71
- if (this.isDisposed) {
72
- return;
73
- }
74
- const contextModel = this._context.model;
75
- const editor = this.editor;
76
- const editorModel = editor.model;
77
- // Set the editor model value.
78
- editorModel.value.text = contextModel.toString();
79
- // Prevent the initial loading from disk from being in the editor history.
80
- editor.clearHistory();
81
- // Wire signal connections.
82
- contextModel.contentChanged.connect(this._onContentChanged, this);
83
- // Resolve the ready promise.
84
- this._ready.resolve(undefined);
85
- }
86
- /**
87
- * Handle a change in context model content.
88
- */
89
- _onContentChanged() {
90
- const editorModel = this.editor.model;
91
- const oldValue = editorModel.value.text;
92
- const newValue = this._context.model.toString();
93
- if (oldValue !== newValue) {
94
- editorModel.value.text = newValue;
95
- }
96
- }
97
- /**
98
- * Handle a change to the collaborators on the model
99
- * by updating UI elements associated with them.
100
- */
101
- _onCollaboratorsChanged() {
102
- // If there are selections corresponding to non-collaborators,
103
- // they are stale and should be removed.
104
- const collaborators = this._context.model.modelDB.collaborators;
105
- if (!collaborators) {
106
- return;
107
- }
108
- for (const key of this.editor.model.selections.keys()) {
109
- if (!collaborators.has(key)) {
110
- this.editor.model.selections.delete(key);
111
- }
112
- }
113
- }
114
- }
115
16
  /**
116
17
  * A widget for editors.
117
18
  */
@@ -121,12 +22,22 @@ export class FileEditor extends Widget {
121
22
  */
122
23
  constructor(options) {
123
24
  super();
25
+ this._ready = new PromiseDelegate();
124
26
  this.addClass('jp-FileEditor');
125
27
  const context = (this._context = options.context);
126
28
  this._mimeTypeService = options.mimeTypeService;
127
- const editorWidget = (this.editorWidget = new FileEditorCodeWrapper(options));
29
+ const editorWidget = (this._editorWidget = new CodeEditorWrapper({
30
+ factory: options.factory,
31
+ model: context.model
32
+ }));
33
+ this._editorWidget.addClass('jp-FileEditorCodeWrapper');
34
+ this._editorWidget.node.dataset[CODE_RUNNER] = 'true';
35
+ this._editorWidget.node.dataset[UNDOER] = 'true';
128
36
  this.editor = editorWidget.editor;
129
37
  this.model = editorWidget.model;
38
+ void context.ready.then(() => {
39
+ this._onContextReady();
40
+ });
130
41
  // Listen for changes to the path.
131
42
  context.pathChanged.connect(this._onPathChanged, this);
132
43
  this._onPathChanged();
@@ -137,13 +48,13 @@ export class FileEditor extends Widget {
137
48
  * Get the context for the editor widget.
138
49
  */
139
50
  get context() {
140
- return this.editorWidget.context;
51
+ return this._context;
141
52
  }
142
53
  /**
143
54
  * A promise that resolves when the file editor is ready.
144
55
  */
145
56
  get ready() {
146
- return this.editorWidget.ready;
57
+ return this.ready;
147
58
  }
148
59
  /**
149
60
  * Handle the DOM events for the widget.
@@ -196,13 +107,26 @@ export class FileEditor extends Widget {
196
107
  this.editor.focus();
197
108
  }
198
109
  }
110
+ /**
111
+ * Handle actions that should be taken when the context is ready.
112
+ */
113
+ _onContextReady() {
114
+ if (this.isDisposed) {
115
+ return;
116
+ }
117
+ // Prevent the initial loading from disk from being in the editor history.
118
+ this.editor.clearHistory();
119
+ // Resolve the ready promise.
120
+ this._ready.resolve(undefined);
121
+ }
199
122
  /**
200
123
  * Handle a change to the path.
201
124
  */
202
125
  _onPathChanged() {
203
126
  const editor = this.editor;
204
127
  const localPath = this._context.localPath;
205
- editor.model.mimeType = this._mimeTypeService.getMimeTypeByFilePath(localPath);
128
+ editor.model.mimeType =
129
+ this._mimeTypeService.getMimeTypeByFilePath(localPath);
206
130
  }
207
131
  }
208
132
  /**
package/lib/widget.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"widget.js","sourceRoot":"","sources":["../src/widget.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EACL,UAAU,EACV,iBAAiB,EAGlB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,gBAAgB,EAEhB,cAAc,EAEf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,GAAG,cAAc,CAAC;AAEnC;;GAEG;AACH,MAAM,MAAM,GAAG,UAAU,CAAC;AAE1B;;GAEG;AACH,MAAM,OAAO,qBAAsB,SAAQ,iBAAiB;IAC1D;;OAEG;IACH,YAAY,OAA4B;QACtC,KAAK,CAAC;YACJ,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,KAAK;SAC7B,CAAC,CAAC;QA4GG,WAAM,GAAG,IAAI,eAAe,EAAQ,CAAC;QA1G3C,MAAM,OAAO,GAAG,CAAC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;QAClD,MAAM,MAAM,GAAG,IAAI,CAAC,MA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gB,CAAC,qBAAqB,CAAC,SAAS,CAAC,CAAC;IAC3D,CAAC;CAQF;AA2BD;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,gBAGtC;IACC;;OAEG;IACH,YAAY,OAAmC;QAC7C,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;QAC9B,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,cAAc,CAAC;IAC1C,CAAC;IAED;;OAEG;IACO,eAAe,CACvB,OAAqC;QAErC,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,iBAAiB,CAAC;QAC7D,MAAM,OAAO,GAAuB,OAAO,CAAC,EAAE;YAC5C,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC,CAAC;QACF,MAAM,OAAO,GAAG,IAAI,UAAU,CAAC;YAC7B,OAAO;YACP,OAAO;YACP,eAAe,EAAE,IAAI,CAAC,SAAS,CAAC,eAAe;SAChD,CAAC,CAAC;QAEH,OAAO,CAAC,KAAK,CAAC,IAAI,GAAG,cAAc,CAAC;QACpC,MAAM,MAAM,GAAG,IAAI,cAAc,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;QACxD,OAAO,MAAM,CAAC;IAChB,CAAC;CAGF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupyterlab/fileeditor",
3
- "version": "4.0.0-alpha.1",
3
+ "version": "4.0.0-alpha.12",
4
4
  "description": "JupyterLab - Editor Widget",
5
5
  "homepage": "https://github.com/jupyterlab/jupyterlab",
6
6
  "bugs": {
@@ -23,9 +23,7 @@
23
23
  "lib": "lib/"
24
24
  },
25
25
  "files": [
26
- "lib/*.d.ts",
27
- "lib/*.js.map",
28
- "lib/*.js",
26
+ "lib/**/*.{d.ts,js,js.map}",
29
27
  "style/*.css",
30
28
  "style/index.js"
31
29
  ],
@@ -41,25 +39,30 @@
41
39
  "watch": "tsc -b --watch"
42
40
  },
43
41
  "dependencies": {
44
- "@jupyterlab/apputils": "^4.0.0-alpha.1",
45
- "@jupyterlab/codeeditor": "^4.0.0-alpha.1",
46
- "@jupyterlab/docregistry": "^4.0.0-alpha.1",
47
- "@jupyterlab/statusbar": "^4.0.0-alpha.1",
48
- "@jupyterlab/translation": "^4.0.0-alpha.1",
49
- "@jupyterlab/ui-components": "^4.0.0-alpha.16",
50
- "@lumino/coreutils": "^1.11.1",
42
+ "@jupyterlab/apputils": "^4.0.0-alpha.12",
43
+ "@jupyterlab/codeeditor": "^4.0.0-alpha.12",
44
+ "@jupyterlab/codemirror": "^4.0.0-alpha.12",
45
+ "@jupyterlab/docregistry": "^4.0.0-alpha.12",
46
+ "@jupyterlab/documentsearch": "^4.0.0-alpha.12",
47
+ "@jupyterlab/lsp": "^4.0.0-alpha.12",
48
+ "@jupyterlab/statusbar": "^4.0.0-alpha.12",
49
+ "@jupyterlab/toc": "^6.0.0-alpha.12",
50
+ "@jupyterlab/translation": "^4.0.0-alpha.12",
51
+ "@jupyterlab/ui-components": "^4.0.0-alpha.27",
52
+ "@lumino/coreutils": "^1.12.0",
51
53
  "@lumino/messaging": "^1.10.1",
52
- "@lumino/widgets": "^1.30.0",
53
- "react": "^17.0.1"
54
+ "@lumino/widgets": "^1.33.0",
55
+ "react": "^17.0.1",
56
+ "regexp-match-indices": "^1.0.2"
54
57
  },
55
58
  "devDependencies": {
56
- "@jupyterlab/testutils": "^4.0.0-alpha.1",
59
+ "@jupyterlab/testutils": "^4.0.0-alpha.12",
57
60
  "@types/jest": "^26.0.10",
58
61
  "jest": "^26.4.2",
59
62
  "rimraf": "~3.0.0",
60
63
  "ts-jest": "^26.3.0",
61
- "typedoc": "~0.21.2",
62
- "typescript": "~4.1.3"
64
+ "typedoc": "~0.22.10",
65
+ "typescript": "~4.7.3"
63
66
  },
64
67
  "publishConfig": {
65
68
  "access": "public"
package/style/base.css CHANGED
@@ -3,9 +3,6 @@
3
3
  | Distributed under the terms of the Modified BSD License.
4
4
  |----------------------------------------------------------------------------*/
5
5
 
6
- .jp-FileEditor {
7
- }
8
-
9
6
  /*-----------------------------------------------------------------------------
10
7
  | Presentation Mode (.jp-mod-presentationMode)
11
8
  |----------------------------------------------------------------------------*/
@@ -13,3 +10,11 @@
13
10
  .jp-mod-presentationMode .jp-FileEditor {
14
11
  --jp-code-font-size: var(--jp-code-presentation-font-size);
15
12
  }
13
+
14
+ .jp-FileEditorCodeWrapper {
15
+ overflow: auto;
16
+ }
17
+
18
+ .jp-FileEditorCodeWrapper .cm-editor {
19
+ height: 100%;
20
+ }
package/style/index.css CHANGED
@@ -8,6 +8,10 @@
8
8
  @import url('~@jupyterlab/ui-components/style/index.css');
9
9
  @import url('~@jupyterlab/apputils/style/index.css');
10
10
  @import url('~@jupyterlab/codeeditor/style/index.css');
11
+ @import url('~@jupyterlab/documentsearch/style/index.css');
12
+ @import url('~@jupyterlab/codemirror/style/index.css');
11
13
  @import url('~@jupyterlab/docregistry/style/index.css');
14
+ @import url('~@jupyterlab/lsp/style/index.css');
15
+ @import url('~@jupyterlab/toc/style/index.css');
12
16
 
13
17
  @import url('./base.css');