@jupyterlab/fileeditor 3.4.3 → 4.0.0-alpha.11

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/index.d.ts CHANGED
@@ -2,6 +2,8 @@
2
2
  * @packageDocumentation
3
3
  * @module fileeditor
4
4
  */
5
+ export * from './searchprovider';
5
6
  export * from './tabspacestatus';
7
+ export * from './toc';
6
8
  export * from './tokens';
7
9
  export * from './widget';
package/lib/index.js CHANGED
@@ -4,7 +4,9 @@
4
4
  * @packageDocumentation
5
5
  * @module fileeditor
6
6
  */
7
+ export * from './searchprovider';
7
8
  export * from './tabspacestatus';
9
+ export * from './toc';
8
10
  export * from './tokens';
9
11
  export * from './widget';
10
12
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAC3D;;;GAGG;AAEH,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAC3D;;;GAGG;AAEH,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC"}
@@ -0,0 +1,44 @@
1
+ import { MainAreaWidget } from '@jupyterlab/apputils';
2
+ import { CodeMirrorSearchProvider } from '@jupyterlab/codemirror';
3
+ import { ISearchProvider } from '@jupyterlab/documentsearch';
4
+ import { ITranslator } from '@jupyterlab/translation';
5
+ import { Widget } from '@lumino/widgets';
6
+ import { FileEditor } from './widget';
7
+ /**
8
+ * Helper type
9
+ */
10
+ export declare type FileEditorPanel = MainAreaWidget<FileEditor>;
11
+ /**
12
+ * File editor search provider
13
+ */
14
+ export declare class FileEditorSearchProvider extends CodeMirrorSearchProvider implements ISearchProvider {
15
+ /**
16
+ * Constructor
17
+ * @param widget File editor panel
18
+ */
19
+ constructor(widget: FileEditorPanel);
20
+ /**
21
+ * Instantiate a search provider for the widget.
22
+ *
23
+ * #### Notes
24
+ * The widget provided is always checked using `isApplicable` before calling
25
+ * this factory.
26
+ *
27
+ * @param widget The widget to search on
28
+ * @param translator [optional] The translator object
29
+ *
30
+ * @returns The search provider on the widget
31
+ */
32
+ static createNew(widget: FileEditorPanel, translator?: ITranslator): ISearchProvider;
33
+ /**
34
+ * Report whether or not this provider has the ability to search on the given object
35
+ */
36
+ static isApplicable(domain: Widget): domain is FileEditorPanel;
37
+ /**
38
+ * Get an initial query value if applicable so that it can be entered
39
+ * into the search box as an initial query
40
+ *
41
+ * @returns Initial value used to populate the search box.
42
+ */
43
+ getInitialQuery(): string;
44
+ }
@@ -0,0 +1,54 @@
1
+ // Copyright (c) Jupyter Development Team.
2
+ // Distributed under the terms of the Modified BSD License.
3
+ import { MainAreaWidget } from '@jupyterlab/apputils';
4
+ import { CodeMirrorEditor, CodeMirrorSearchProvider } from '@jupyterlab/codemirror';
5
+ import { FileEditor } from './widget';
6
+ /**
7
+ * File editor search provider
8
+ */
9
+ export class FileEditorSearchProvider extends CodeMirrorSearchProvider {
10
+ /**
11
+ * Constructor
12
+ * @param widget File editor panel
13
+ */
14
+ constructor(widget) {
15
+ super();
16
+ this.editor = widget.content.editor;
17
+ }
18
+ /**
19
+ * Instantiate a search provider for the widget.
20
+ *
21
+ * #### Notes
22
+ * The widget provided is always checked using `isApplicable` before calling
23
+ * this factory.
24
+ *
25
+ * @param widget The widget to search on
26
+ * @param translator [optional] The translator object
27
+ *
28
+ * @returns The search provider on the widget
29
+ */
30
+ static createNew(widget, translator) {
31
+ return new FileEditorSearchProvider(widget);
32
+ }
33
+ /**
34
+ * Report whether or not this provider has the ability to search on the given object
35
+ */
36
+ static isApplicable(domain) {
37
+ return (domain instanceof MainAreaWidget &&
38
+ domain.content instanceof FileEditor &&
39
+ domain.content.editor instanceof CodeMirrorEditor);
40
+ }
41
+ /**
42
+ * Get an initial query value if applicable so that it can be entered
43
+ * into the search box as an initial query
44
+ *
45
+ * @returns Initial value used to populate the search box.
46
+ */
47
+ getInitialQuery() {
48
+ const cm = this.editor;
49
+ const selection = cm.doc.getSelection();
50
+ // if there are newlines, just return empty string
51
+ return selection.search(/\r?\n|\r/g) === -1 ? selection : '';
52
+ }
53
+ }
54
+ //# sourceMappingURL=searchprovider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"searchprovider.js","sourceRoot":"","sources":["../src/searchprovider.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EACzB,MAAM,wBAAwB,CAAC;AAIhC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAOtC;;GAEG;AACH,MAAM,OAAO,wBACX,SAAQ,wBAAwB;IAGhC;;;OAGG;IACH,YAAY,MAAuB;QACjC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,MAA0B,CAAC;IAC1D,CAAC;IAED;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,SAAS,CACd,MAAuB,EACvB,UAAwB;QAExB,OAAO,IAAI,wBAAwB,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,YAAY,CAAC,MAAc;QAChC,OAAO,CACL,MAAM,YAAY,cAAc;YAChC,MAAM,CAAC,OAAO,YAAY,UAAU;YACpC,MAAM,CAAC,OAAO,CAAC,MAAM,YAAY,gBAAgB,CAClD,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,eAAe;QACb,MAAM,EAAE,GAAG,IAAI,CAAC,MAA0B,CAAC;QAC3C,MAAM,SAAS,GAAG,EAAE,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC;QACxC,kDAAkD;QAClD,OAAO,SAAS,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/D,CAAC;CACF"}
@@ -1,6 +1,6 @@
1
- import { VDomModel, VDomRenderer } from '@jupyterlab/apputils';
2
1
  import { CodeEditor } from '@jupyterlab/codeeditor';
3
2
  import { ITranslator } from '@jupyterlab/translation';
3
+ import { VDomModel, VDomRenderer } from '@jupyterlab/ui-components';
4
4
  import { Menu } from '@lumino/widgets';
5
5
  import React from 'react';
6
6
  /**
@@ -1,8 +1,8 @@
1
1
  // Copyright (c) Jupyter Development Team.
2
2
  // Distributed under the terms of the Modified BSD License.
3
- import { VDomModel, VDomRenderer } from '@jupyterlab/apputils';
4
3
  import { clickedItem, interactiveItem, showPopup, TextItem } from '@jupyterlab/statusbar';
5
4
  import { nullTranslator } from '@jupyterlab/translation';
5
+ import { VDomModel, VDomRenderer } from '@jupyterlab/ui-components';
6
6
  import React from 'react';
7
7
  /**
8
8
  * A pure functional component for rendering the TabSpace status.
@@ -1 +1 @@
1
- {"version":3,"file":"tabspacestatus.js","sourceRoot":"","sources":["../src/tabspacestatus.tsx"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAE/D,OAAO,EACL,WAAW,EACX,eAAe,EAEf,SAAS,EACT,QAAQ,EACT,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAe,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEtE,OAAO,KAAK,MAAM,OAAO,CAAC;AAiC1B;;GAEG;AACH,SAAS,iBAAiB,CACxB,KAA+B;IAE/B,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,IAAI,cAAc,CAAC;IACtD,MAAM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AAI,CAAC,OAAO,CAAC;QACtB,CAAC;QACD,IAAI,MAAM,CAAC,GAA8B;YACvC,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC;YAC/B,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC;YACnB,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC/C,CAAC;QAEO,cAAc,CACpB,QAAmC,EACnC,QAAmC;YAEnC,MAAM,SAAS,GAAG,QAAQ,IAAI,QAAQ,CAAC,YAAY,CAAC;YACpD,MAAM,OAAO,GAAG,QAAQ,IAAI,QAAQ,CAAC,OAAO,CAAC;YAC7C,MAAM,SAAS,GAAG,QAAQ,IAAI,QAAQ,CAAC,YAAY,CAAC;YACpD,MAAM,OAAO,GAAG,QAAQ,IAAI,QAAQ,CAAC,OAAO,CAAC;YAC7C,IAAI,SAAS,KAAK,SAAS,IAAI,OAAO,KAAK,OAAO,EAAE;gBAClD,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;aAChC;QACH,CAAC;KAGF;IA3BY,oBAAK,QA2BjB,CAAA;AAiBH,CAAC,EAhDgB,cAAc,KAAd,cAAc,QAgD9B"}
@@ -0,0 +1,25 @@
1
+ import { DocumentRegistry, IDocumentWidget } from '@jupyterlab/docregistry';
2
+ import { TableOfContents, TableOfContentsFactory, TableOfContentsModel } from '@jupyterlab/toc';
3
+ import { FileEditor } from '../widget';
4
+ /**
5
+ * Interface describing a file editor heading.
6
+ */
7
+ export interface IEditorHeading extends TableOfContents.IHeading {
8
+ /**
9
+ * Heading line number.
10
+ */
11
+ line: number;
12
+ }
13
+ /**
14
+ * Base table of contents model factory for file editor
15
+ */
16
+ export declare abstract class EditorTableOfContentsFactory extends TableOfContentsFactory<IDocumentWidget<FileEditor>> {
17
+ /**
18
+ * Create a new table of contents model for the widget
19
+ *
20
+ * @param widget - widget
21
+ * @param configuration - Table of contents configuration
22
+ * @returns The table of contents model
23
+ */
24
+ createNew(widget: IDocumentWidget<FileEditor, DocumentRegistry.IModel>, configuration?: TableOfContents.IConfig): TableOfContentsModel<IEditorHeading, IDocumentWidget<FileEditor, DocumentRegistry.IModel>>;
25
+ }
@@ -0,0 +1,32 @@
1
+ // Copyright (c) Jupyter Development Team.
2
+ // Distributed under the terms of the Modified BSD License.
3
+ import { TableOfContentsFactory } from '@jupyterlab/toc';
4
+ /**
5
+ * Base table of contents model factory for file editor
6
+ */
7
+ export class EditorTableOfContentsFactory extends TableOfContentsFactory {
8
+ /**
9
+ * Create a new table of contents model for the widget
10
+ *
11
+ * @param widget - widget
12
+ * @param configuration - Table of contents configuration
13
+ * @returns The table of contents model
14
+ */
15
+ createNew(widget, configuration) {
16
+ const model = super.createNew(widget, configuration);
17
+ const onActiveHeadingChanged = (model, heading) => {
18
+ if (heading) {
19
+ widget.content.editor.setCursorPosition({
20
+ line: heading.line,
21
+ column: 0
22
+ });
23
+ }
24
+ };
25
+ model.activeHeadingChanged.connect(onActiveHeadingChanged);
26
+ widget.disposed.connect(() => {
27
+ model.activeHeadingChanged.disconnect(onActiveHeadingChanged);
28
+ });
29
+ return model;
30
+ }
31
+ }
32
+ //# sourceMappingURL=factory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factory.js","sourceRoot":"","sources":["../../src/toc/factory.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAG3D,OAAO,EAEL,sBAAsB,EAEvB,MAAM,iBAAiB,CAAC;AAazB;;GAEG;AACH,MAAM,OAAgB,4BAA6B,SAAQ,sBAE1D;IACC;;;;;;OAMG;IACH,SAAS,CACP,MAA4D,EAC5D,aAAuC;QAKvC,MAAM,KAAK,GAAG,KAAK,CAAC,SAAS,CAC3B,MAAM,EACN,aAAa,CAId,CAAC;QAEF,MAAM,sBAAsB,GAAG,CAC7B,KAGC,EACD,OAA8B,EAC9B,EAAE;YACF,IAAI,OAAO,EAAE;gBACX,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC;oBACtC,IAAI,EAAE,OAAO,CAAC,IAAI;oBAClB,MAAM,EAAE,CAAC;iBACV,CAAC,CAAC;aACJ;QACH,CAAC,CAAC;QAEF,KAAK,CAAC,oBAAoB,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC;QAC3D,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE;YAC3B,KAAK,CAAC,oBAAoB,CAAC,UAAU,CAAC,sBAAsB,CAAC,CAAC;QAChE,CAAC,CAAC,CAAC;QAEH,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
@@ -0,0 +1,4 @@
1
+ export * from './factory';
2
+ export * from './latex';
3
+ export * from './markdown';
4
+ export * from './python';
@@ -0,0 +1,7 @@
1
+ // Copyright (c) Jupyter Development Team.
2
+ // Distributed under the terms of the Modified BSD License.
3
+ export * from './factory';
4
+ export * from './latex';
5
+ export * from './markdown';
6
+ export * from './python';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/toc/index.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC"}
@@ -0,0 +1,48 @@
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 LaTeX files.
8
+ */
9
+ export declare class LaTeXTableOfContentsModel 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
+ * List of configuration options supported by the model.
20
+ */
21
+ get supportedOptions(): (keyof TableOfContents.IConfig)[];
22
+ /**
23
+ * Produce the headings for a document.
24
+ *
25
+ * @returns The list of new headings or `null` if nothing needs to be updated.
26
+ */
27
+ protected getHeadings(): Promise<IEditorHeading[] | null>;
28
+ }
29
+ /**
30
+ * Table of content model factory for LaTeX files.
31
+ */
32
+ export declare class LaTeXTableOfContentsFactory extends EditorTableOfContentsFactory {
33
+ /**
34
+ * Whether the factory can handle the widget or not.
35
+ *
36
+ * @param widget - widget
37
+ * @returns boolean indicating a ToC can be generated
38
+ */
39
+ isApplicable(widget: Widget): boolean;
40
+ /**
41
+ * Create a new table of contents model for the widget
42
+ *
43
+ * @param widget - widget
44
+ * @param configuration - Table of contents configuration
45
+ * @returns The table of contents model
46
+ */
47
+ protected _createNew(widget: IDocumentWidget<FileEditor, DocumentRegistry.IModel>, configuration?: TableOfContents.IConfig): LaTeXTableOfContentsModel;
48
+ }
@@ -0,0 +1,112 @@
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
+ * Maps LaTeX section headings to HTML header levels.
7
+ *
8
+ * ## Notes
9
+ *
10
+ * - As `part` and `chapter` section headings appear to be less common, assign them to heading level 1.
11
+ *
12
+ * @private
13
+ */
14
+ const LATEX_LEVELS = {
15
+ part: 1,
16
+ chapter: 1,
17
+ section: 1,
18
+ subsection: 2,
19
+ subsubsection: 3,
20
+ paragraph: 4,
21
+ subparagraph: 5
22
+ };
23
+ /**
24
+ * Regular expression to create the outline
25
+ */
26
+ const SECTIONS = /^\s*\\(section|subsection|subsubsection){(.+)}/;
27
+ /**
28
+ * Table of content model for LaTeX files.
29
+ */
30
+ export class LaTeXTableOfContentsModel extends TableOfContentsModel {
31
+ /**
32
+ * Type of document supported by the model.
33
+ *
34
+ * #### Notes
35
+ * A `data-document-type` attribute with this value will be set
36
+ * on the tree view `.jp-TableOfContents-content[data-document-type="..."]`
37
+ */
38
+ get documentType() {
39
+ return 'latex';
40
+ }
41
+ /**
42
+ * List of configuration options supported by the model.
43
+ */
44
+ get supportedOptions() {
45
+ return ['maximalDepth', 'numberHeaders'];
46
+ }
47
+ /**
48
+ * Produce the headings for a document.
49
+ *
50
+ * @returns The list of new headings or `null` if nothing needs to be updated.
51
+ */
52
+ getHeadings() {
53
+ if (!this.isActive) {
54
+ return Promise.resolve(null);
55
+ }
56
+ // Split the text into lines:
57
+ const lines = this.widget.content.model.value.text.split('\n');
58
+ const levels = new Array();
59
+ let previousLevel = levels.length;
60
+ const headings = new Array();
61
+ for (let i = 0; i < lines.length; i++) {
62
+ const match = lines[i].match(SECTIONS);
63
+ if (match) {
64
+ const level = LATEX_LEVELS[match[1]];
65
+ if (level <= this.configuration.maximalDepth) {
66
+ const prefix = TableOfContentsUtils.getPrefix(level, previousLevel, levels, Object.assign(Object.assign({}, this.configuration), {
67
+ // Force base numbering and numbering first level
68
+ baseNumbering: 1, numberingH1: true }));
69
+ previousLevel = level;
70
+ headings.push({
71
+ text: match[2],
72
+ prefix: prefix,
73
+ level,
74
+ line: i
75
+ });
76
+ }
77
+ }
78
+ }
79
+ return Promise.resolve(headings);
80
+ }
81
+ }
82
+ /**
83
+ * Table of content model factory for LaTeX files.
84
+ */
85
+ export class LaTeXTableOfContentsFactory extends EditorTableOfContentsFactory {
86
+ /**
87
+ * Whether the factory can handle the widget or not.
88
+ *
89
+ * @param widget - widget
90
+ * @returns boolean indicating a ToC can be generated
91
+ */
92
+ isApplicable(widget) {
93
+ var _a, _b;
94
+ const isApplicable = super.isApplicable(widget);
95
+ if (isApplicable) {
96
+ let mime = (_b = (_a = widget.content) === null || _a === void 0 ? void 0 : _a.model) === null || _b === void 0 ? void 0 : _b.mimeType;
97
+ return mime && (mime === 'text/x-latex' || mime === 'text/x-stex');
98
+ }
99
+ return false;
100
+ }
101
+ /**
102
+ * Create a new table of contents model for the widget
103
+ *
104
+ * @param widget - widget
105
+ * @param configuration - Table of contents configuration
106
+ * @returns The table of contents model
107
+ */
108
+ _createNew(widget, configuration) {
109
+ return new LaTeXTableOfContentsModel(widget, configuration);
110
+ }
111
+ }
112
+ //# sourceMappingURL=latex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"latex.js","sourceRoot":"","sources":["../../src/toc/latex.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAG3D,OAAO,EAEL,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,4BAA4B,EAAkB,MAAM,WAAW,CAAC;AAEzE;;;;;;;;GAQG;AACH,MAAM,YAAY,GAAgC;IAChD,IAAI,EAAE,CAAC;IACP,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,CAAC;IACV,UAAU,EAAE,CAAC;IACb,aAAa,EAAE,CAAC;IAChB,SAAS,EAAE,CAAC;IACZ,YAAY,EAAE,CAAC;CAChB,CAAC;AAEF;;GAEG;AACH,MAAM,QAAQ,GAAG,gDAAgD,CAAC;AAElE;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,oBAG9C;IACC;;;;;;OAMG;IACH,IAAI,YAAY;QACd,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;OAEG;IACH,IAAI,gBAAgB;QAClB,OAAO,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;IAC3C,CAAC;IAED;;;;OAIG;IACO,WAAW;QACnB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAClB,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;SAC9B;QAED,6BAA6B;QAC7B,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAA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AAE,KAAK,0CAAE,QAAQ,CAAC;YACpD,OAAO,IAAI,IAAI,CAAC,IAAI,KAAK,cAAc,IAAI,IAAI,KAAK,aAAa,CAAC,CAAC;SACpE;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;;OAMG;IACO,UAAU,CAClB,MAA4D,EAC5D,aAAuC;QAEvC,OAAO,IAAI,yBAAyB,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC9D,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 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
+ {"version":3,"file":"markdown.js","sourceRoot":"","sources":["../../src/toc/markdown.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAG3D,OAAO,EAEL,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,4BAA4B,EAAkB,MAAM,WAAW,CAAC;AAEzE;;GAEG;AACH,MAAM,OAAO,4BAA6B,SAAQ,oBAGjD;IACC;;;;;;OAMG;IACH,IAAI,YAAY;QACd,OAAO,UAAU,CAAC;IACpB,CAAC;IAED;;;;OAIG;IACO,WAAW;QACnB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAClB,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;SAC9B;QAED,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC;QAErD,MAAM,QAAQ,GAAG,oBAAoB,CAAC,QAAQ,CAAC,WAAW,CAAC,OAAO,kCAC7D,IAAI,CAAC,aAAa;YACrB,uDAAuD;YACvD,kBAAkB;YAClB,aAAa,EAAE,KAAK,IACpB,CAAC;QACH,OAAO,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,8BAA+B,SAAQ,4BAA4B;IAC9E;;;;;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,IAAI,IAAI,oBAAoB,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;SAC/D;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;;OAMG;IACO,UAAU,CAClB,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,4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AC;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,40 +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
- * @deprecated since v3.4
9
- * Note: This class will be removed in v4.0.
10
- * From now on, you can directly use the class
11
- * `CodeEditorWrapper` instead on `FileEditorCodeWrapper`.
12
- */
13
- export declare class FileEditorCodeWrapper extends CodeEditorWrapper {
14
- /**
15
- * Construct a new editor widget.
16
- */
17
- constructor(options: FileEditor.IOptions);
18
- /**
19
- * Get the context for the editor widget.
20
- */
21
- get context(): DocumentRegistry.Context;
22
- /**
23
- * A promise that resolves when the file editor is ready.
24
- */
25
- get ready(): Promise<void>;
26
- /**
27
- * Handle actions that should be taken when the context is ready.
28
- */
29
- private _onContextReady;
30
- /**
31
- * Handle a change to the collaborators on the model
32
- * by updating UI elements associated with them.
33
- */
34
- private _onCollaboratorsChanged;
35
- protected _context: DocumentRegistry.Context;
36
- private _ready;
37
- }
38
5
  /**
39
6
  * A widget for editors.
40
7
  */
@@ -78,15 +45,20 @@ export declare class FileEditor extends Widget {
78
45
  * Ensure that the widget has focus.
79
46
  */
80
47
  private _ensureFocus;
48
+ /**
49
+ * Handle actions that should be taken when the context is ready.
50
+ */
51
+ private _onContextReady;
81
52
  /**
82
53
  * Handle a change to the path.
83
54
  */
84
55
  private _onPathChanged;
85
- private editorWidget;
86
56
  model: CodeEditor.IModel;
87
57
  editor: CodeEditor.IEditor;
88
- protected _context: DocumentRegistry.Context;
58
+ private _context;
59
+ private _editorWidget;
89
60
  private _mimeTypeService;
61
+ private _ready;
90
62
  }
91
63
  /**
92
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,92 +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
- * @deprecated since v3.4
20
- * Note: This class will be removed in v4.0.
21
- * From now on, you can directly use the class
22
- * `CodeEditorWrapper` instead on `FileEditorCodeWrapper`.
23
- */
24
- export class FileEditorCodeWrapper extends CodeEditorWrapper {
25
- /**
26
- * Construct a new editor widget.
27
- */
28
- constructor(options) {
29
- super({
30
- factory: options.factory,
31
- model: options.context.model
32
- });
33
- this._ready = new PromiseDelegate();
34
- const context = (this._context = options.context);
35
- // TODO: move this to the FileEditor when removing the
36
- // `FileEditorCodeWrapper`
37
- this.addClass('jp-FileEditorCodeWrapper');
38
- this.node.dataset[CODE_RUNNER] = 'true';
39
- this.node.dataset[UNDOER] = 'true';
40
- void context.ready.then(() => {
41
- this._onContextReady();
42
- });
43
- if (context.model.modelDB.isCollaborative) {
44
- const modelDB = context.model.modelDB;
45
- void modelDB.connected.then(() => {
46
- const collaborators = modelDB.collaborators;
47
- if (!collaborators) {
48
- return;
49
- }
50
- // Setup the selection style for collaborators
51
- const localCollaborator = collaborators.localCollaborator;
52
- this.editor.uuid = localCollaborator.sessionId;
53
- this.editor.selectionStyle = Object.assign(Object.assign({}, CodeEditor.defaultSelectionStyle), { color: localCollaborator.color });
54
- collaborators.changed.connect(this._onCollaboratorsChanged, this);
55
- // Trigger an initial onCollaboratorsChanged event.
56
- this._onCollaboratorsChanged();
57
- });
58
- }
59
- }
60
- /**
61
- * Get the context for the editor widget.
62
- */
63
- get context() {
64
- return this._context;
65
- }
66
- /**
67
- * A promise that resolves when the file editor is ready.
68
- */
69
- get ready() {
70
- return this._ready.promise;
71
- }
72
- /**
73
- * Handle actions that should be taken when the context is ready.
74
- */
75
- _onContextReady() {
76
- if (this.isDisposed) {
77
- return;
78
- }
79
- // Prevent the initial loading from disk from being in the editor history.
80
- this.editor.clearHistory();
81
- // Resolve the ready promise.
82
- this._ready.resolve(undefined);
83
- }
84
- /**
85
- * Handle a change to the collaborators on the model
86
- * by updating UI elements associated with them.
87
- */
88
- _onCollaboratorsChanged() {
89
- // If there are selections corresponding to non-collaborators,
90
- // they are stale and should be removed.
91
- const collaborators = this._context.model.modelDB.collaborators;
92
- if (!collaborators) {
93
- return;
94
- }
95
- for (const key of this.editor.model.selections.keys()) {
96
- if (!collaborators.has(key)) {
97
- this.editor.model.selections.delete(key);
98
- }
99
- }
100
- }
101
- }
102
16
  /**
103
17
  * A widget for editors.
104
18
  */
@@ -108,12 +22,22 @@ export class FileEditor extends Widget {
108
22
  */
109
23
  constructor(options) {
110
24
  super();
25
+ this._ready = new PromiseDelegate();
111
26
  this.addClass('jp-FileEditor');
112
27
  const context = (this._context = options.context);
113
28
  this._mimeTypeService = options.mimeTypeService;
114
- 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';
115
36
  this.editor = editorWidget.editor;
116
37
  this.model = editorWidget.model;
38
+ void context.ready.then(() => {
39
+ this._onContextReady();
40
+ });
117
41
  // Listen for changes to the path.
118
42
  context.pathChanged.connect(this._onPathChanged, this);
119
43
  this._onPathChanged();
@@ -124,13 +48,13 @@ export class FileEditor extends Widget {
124
48
  * Get the context for the editor widget.
125
49
  */
126
50
  get context() {
127
- return this.editorWidget.context;
51
+ return this._context;
128
52
  }
129
53
  /**
130
54
  * A promise that resolves when the file editor is ready.
131
55
  */
132
56
  get ready() {
133
- return this.editorWidget.ready;
57
+ return this.ready;
134
58
  }
135
59
  /**
136
60
  * Handle the DOM events for the widget.
@@ -183,13 +107,26 @@ export class FileEditor extends Widget {
183
107
  this.editor.focus();
184
108
  }
185
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
+ }
186
122
  /**
187
123
  * Handle a change to the path.
188
124
  */
189
125
  _onPathChanged() {
190
126
  const editor = this.editor;
191
127
  const localPath = this._context.localPath;
192
- editor.model.mimeType = this._mimeTypeService.getMimeTypeByFilePath(localPath);
128
+ editor.model.mimeType =
129
+ this._mimeTypeService.getMimeTypeByFilePath(localPath);
193
130
  }
194
131
  }
195
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;;;;;;;GAOG;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;QAqFG,WAAM,GAAG,IAAI,eAAe,EAAQ,CAAC;QAnF3C,MAAM,OAAO,GAAG,CAAC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,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D,OAAO,MAAM,CAAC;IAChB,CAAC;CAGF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupyterlab/fileeditor",
3
- "version": "3.4.3",
3
+ "version": "4.0.0-alpha.11",
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,29 @@
41
39
  "watch": "tsc -b --watch"
42
40
  },
43
41
  "dependencies": {
44
- "@jupyterlab/apputils": "^3.4.3",
45
- "@jupyterlab/codeeditor": "^3.4.3",
46
- "@jupyterlab/docregistry": "^3.4.3",
47
- "@jupyterlab/statusbar": "^3.4.3",
48
- "@jupyterlab/translation": "^3.4.3",
49
- "@jupyterlab/ui-components": "^3.4.3",
50
- "@lumino/coreutils": "^1.11.0",
51
- "@lumino/messaging": "^1.10.0",
52
- "@lumino/widgets": "^1.30.0",
53
- "react": "^17.0.1"
42
+ "@jupyterlab/apputils": "^4.0.0-alpha.11",
43
+ "@jupyterlab/codeeditor": "^4.0.0-alpha.11",
44
+ "@jupyterlab/codemirror": "^4.0.0-alpha.11",
45
+ "@jupyterlab/docregistry": "^4.0.0-alpha.11",
46
+ "@jupyterlab/documentsearch": "^4.0.0-alpha.11",
47
+ "@jupyterlab/statusbar": "^4.0.0-alpha.11",
48
+ "@jupyterlab/toc": "^6.0.0-alpha.11",
49
+ "@jupyterlab/translation": "^4.0.0-alpha.11",
50
+ "@jupyterlab/ui-components": "^4.0.0-alpha.26",
51
+ "@lumino/coreutils": "^1.12.0",
52
+ "@lumino/messaging": "^1.10.1",
53
+ "@lumino/widgets": "^1.32.0",
54
+ "react": "^17.0.1",
55
+ "regexp-match-indices": "^1.0.2"
54
56
  },
55
57
  "devDependencies": {
56
- "@jupyterlab/testutils": "^3.4.3",
58
+ "@jupyterlab/testutils": "^4.0.0-alpha.11",
57
59
  "@types/jest": "^26.0.10",
58
60
  "jest": "^26.4.2",
59
61
  "rimraf": "~3.0.0",
60
62
  "ts-jest": "^26.3.0",
61
- "typedoc": "~0.21.2",
62
- "typescript": "~4.1.3"
63
+ "typedoc": "~0.22.10",
64
+ "typescript": "~4.6.3"
63
65
  },
64
66
  "publishConfig": {
65
67
  "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
  |----------------------------------------------------------------------------*/
package/style/index.css CHANGED
@@ -8,6 +8,9 @@
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/toc/style/index.css');
12
15
 
13
16
  @import url('./base.css');
package/style/index.js CHANGED
@@ -8,6 +8,9 @@ import '@lumino/widgets/style/index.js';
8
8
  import '@jupyterlab/ui-components/style/index.js';
9
9
  import '@jupyterlab/apputils/style/index.js';
10
10
  import '@jupyterlab/codeeditor/style/index.js';
11
+ import '@jupyterlab/documentsearch/style/index.js';
12
+ import '@jupyterlab/codemirror/style/index.js';
11
13
  import '@jupyterlab/docregistry/style/index.js';
14
+ import '@jupyterlab/toc/style/index.js';
12
15
 
13
16
  import './base.css';