@jupyterlab/codeeditor 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.
- package/lib/editor.d.ts +15 -30
- package/lib/editor.js +10 -7
- package/lib/editor.js.map +1 -1
- package/lib/index.d.ts +4 -2
- package/lib/index.js +4 -2
- package/lib/index.js.map +1 -1
- package/lib/jsoneditor.d.ts +0 -8
- package/lib/jsoneditor.js +0 -16
- package/lib/jsoneditor.js.map +1 -1
- package/lib/lineCol.d.ts +92 -0
- package/lib/lineCol.js +207 -0
- package/lib/lineCol.js.map +1 -0
- package/lib/tokens.d.ts +22 -0
- package/lib/tokens.js +4 -1
- package/lib/tokens.js.map +1 -1
- package/lib/viewer.d.ts +48 -0
- package/lib/viewer.js +36 -0
- package/lib/viewer.js.map +1 -0
- package/lib/widget.d.ts +0 -14
- package/lib/widget.js +1 -29
- package/lib/widget.js.map +1 -1
- package/package.json +15 -13
- package/style/base.css +2 -1
- package/style/index.css +1 -0
- package/style/index.js +1 -0
- package/style/linecol.css +79 -0
package/lib/editor.d.ts
CHANGED
|
@@ -44,7 +44,7 @@ export declare namespace CodeEditor {
|
|
|
44
44
|
/**
|
|
45
45
|
* An interface describing editor state coordinates.
|
|
46
46
|
*/
|
|
47
|
-
interface ICoordinate extends
|
|
47
|
+
interface ICoordinate extends DOMRectReadOnly {
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
50
|
* A range.
|
|
@@ -352,7 +352,7 @@ export declare namespace CodeEditor {
|
|
|
352
352
|
/**
|
|
353
353
|
* Set config options for the editor.
|
|
354
354
|
*/
|
|
355
|
-
setOptions
|
|
355
|
+
setOptions(options: Partial<IConfig>): void;
|
|
356
356
|
/**
|
|
357
357
|
* Returns the content for the given line number.
|
|
358
358
|
*
|
|
@@ -407,13 +407,6 @@ export declare namespace CodeEditor {
|
|
|
407
407
|
* Explicitly blur the editor.
|
|
408
408
|
*/
|
|
409
409
|
blur(): void;
|
|
410
|
-
/**
|
|
411
|
-
* Repaint the editor.
|
|
412
|
-
*
|
|
413
|
-
* #### Notes
|
|
414
|
-
* A repainted editor should fit to its host node.
|
|
415
|
-
*/
|
|
416
|
-
refresh(): void;
|
|
417
410
|
/**
|
|
418
411
|
* Resize the editor to fit its host node.
|
|
419
412
|
*/
|
|
@@ -426,15 +419,6 @@ export declare namespace CodeEditor {
|
|
|
426
419
|
* @returns A disposable that can be used to remove the handler.
|
|
427
420
|
*/
|
|
428
421
|
addKeydownHandler(handler: KeydownHandler): IDisposable;
|
|
429
|
-
/**
|
|
430
|
-
* Set the size of the editor.
|
|
431
|
-
*
|
|
432
|
-
* @param size - The desired size.
|
|
433
|
-
*
|
|
434
|
-
* #### Notes
|
|
435
|
-
* Use `null` if the size is unknown.
|
|
436
|
-
*/
|
|
437
|
-
setSize(size: IDimension | null): void;
|
|
438
422
|
/**
|
|
439
423
|
* Reveals the given position in the editor.
|
|
440
424
|
*
|
|
@@ -465,17 +449,21 @@ export declare namespace CodeEditor {
|
|
|
465
449
|
*/
|
|
466
450
|
getPositionForCoordinate(coordinate: ICoordinate): IPosition | null;
|
|
467
451
|
/**
|
|
468
|
-
*
|
|
452
|
+
* Get a list of tokens for the current editor text content.
|
|
469
453
|
*/
|
|
470
|
-
|
|
454
|
+
getTokens(): CodeEditor.IToken[];
|
|
471
455
|
/**
|
|
472
|
-
*
|
|
456
|
+
* Get the token at a given editor position.
|
|
473
457
|
*/
|
|
474
|
-
|
|
458
|
+
getTokenAt(offset: number): CodeEditor.IToken;
|
|
475
459
|
/**
|
|
476
|
-
*
|
|
460
|
+
* Get the token a the cursor position.
|
|
477
461
|
*/
|
|
478
|
-
|
|
462
|
+
getTokenAtCursor(): CodeEditor.IToken;
|
|
463
|
+
/**
|
|
464
|
+
* Inserts a new line at the cursor position and indents it.
|
|
465
|
+
*/
|
|
466
|
+
newIndentedLine(): void;
|
|
479
467
|
/**
|
|
480
468
|
* Replaces selection with the given text.
|
|
481
469
|
*/
|
|
@@ -564,12 +552,6 @@ export declare namespace CodeEditor {
|
|
|
564
552
|
* The default configuration options for an editor.
|
|
565
553
|
*/
|
|
566
554
|
const defaultConfig: IConfig;
|
|
567
|
-
/**
|
|
568
|
-
* The options used to set several options at once with setOptions.
|
|
569
|
-
*/
|
|
570
|
-
interface IConfigOptions<K extends keyof IConfig> {
|
|
571
|
-
K: IConfig[K];
|
|
572
|
-
}
|
|
573
555
|
/**
|
|
574
556
|
* The options used to initialize an editor.
|
|
575
557
|
*/
|
|
@@ -601,6 +583,9 @@ export declare namespace CodeEditor {
|
|
|
601
583
|
}
|
|
602
584
|
namespace Model {
|
|
603
585
|
interface IOptions {
|
|
586
|
+
/**
|
|
587
|
+
* A unique identifier for the model.
|
|
588
|
+
*/
|
|
604
589
|
id?: string;
|
|
605
590
|
/**
|
|
606
591
|
* The initial value of the model.
|
package/lib/editor.js
CHANGED
|
@@ -64,6 +64,7 @@ export var CodeEditor;
|
|
|
64
64
|
this.value.text = sharedModel.getSource();
|
|
65
65
|
}
|
|
66
66
|
this.sharedModel.changed.disconnect(this._onSharedModelChanged, this);
|
|
67
|
+
this.sharedModel.dispose();
|
|
67
68
|
// clone model retrieve a shared (not standalone) model
|
|
68
69
|
this.sharedModel = sharedModel;
|
|
69
70
|
this.sharedModel.changed.connect(this._onSharedModelChanged, this);
|
|
@@ -169,6 +170,7 @@ export var CodeEditor;
|
|
|
169
170
|
return;
|
|
170
171
|
}
|
|
171
172
|
this._isDisposed = true;
|
|
173
|
+
this.modelDB.dispose();
|
|
172
174
|
Signal.clearData(this);
|
|
173
175
|
}
|
|
174
176
|
_onModelDBMimeTypeChanged(mimeType, args) {
|
|
@@ -184,22 +186,23 @@ export var CodeEditor;
|
|
|
184
186
|
* The default configuration options for an editor.
|
|
185
187
|
*/
|
|
186
188
|
CodeEditor.defaultConfig = {
|
|
189
|
+
// Order matters as gutters will be sorted by the configuration order
|
|
190
|
+
autoClosingBrackets: false,
|
|
187
191
|
cursorBlinkRate: 530,
|
|
188
192
|
fontFamily: null,
|
|
189
193
|
fontSize: null,
|
|
194
|
+
handlePaste: true,
|
|
195
|
+
insertSpaces: true,
|
|
190
196
|
lineHeight: null,
|
|
191
197
|
lineNumbers: false,
|
|
192
198
|
lineWrap: 'on',
|
|
193
|
-
|
|
199
|
+
matchBrackets: true,
|
|
194
200
|
readOnly: false,
|
|
195
201
|
tabSize: 4,
|
|
196
|
-
insertSpaces: true,
|
|
197
|
-
matchBrackets: true,
|
|
198
|
-
autoClosingBrackets: false,
|
|
199
|
-
handlePaste: true,
|
|
200
202
|
rulers: [],
|
|
201
|
-
|
|
202
|
-
|
|
203
|
+
showTrailingSpace: false,
|
|
204
|
+
wordWrapColumn: 80,
|
|
205
|
+
codeFolding: false
|
|
203
206
|
};
|
|
204
207
|
})(CodeEditor || (CodeEditor = {}));
|
|
205
208
|
//# sourceMappingURL=editor.js.map
|
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;AAI3D,OAAO,EAKL,OAAO,EAER,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AAIpD,OAAO,EAAW,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,kBAAkB,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;AAEhD;;;;;;;GAOG;AACH,MAAM,KAAW,UAAU,
|
|
1
|
+
{"version":3,"file":"editor.js","sourceRoot":"","sources":["../src/editor.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAI3D,OAAO,EAKL,OAAO,EAER,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AAIpD,OAAO,EAAW,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,kBAAkB,GAA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Y,EAAE,IAAI;QAClB,UAAU,EAAE,IAAI;QAChB,WAAW,EAAE,KAAK;QAClB,QAAQ,EAAE,IAAI;QACd,aAAa,EAAE,IAAI;QACnB,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,CAAC;QACV,MAAM,EAAE,EAAE;QACV,iBAAiB,EAAE,KAAK;QACxB,cAAc,EAAE,EAAE;QAClB,WAAW,EAAE,KAAK;KACnB,CAAC;AA4DJ,CAAC,EAr0BgB,UAAU,KAAV,UAAU,QAq0B1B"}
|
package/lib/index.d.ts
CHANGED
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
* @module codeeditor
|
|
4
4
|
*/
|
|
5
5
|
export * from './editor';
|
|
6
|
-
export * from './jsoneditor';
|
|
7
|
-
export * from './widget';
|
|
8
6
|
export * from './factory';
|
|
7
|
+
export * from './jsoneditor';
|
|
8
|
+
export * from './lineCol';
|
|
9
9
|
export * from './mimetype';
|
|
10
10
|
export * from './tokens';
|
|
11
|
+
export * from './viewer';
|
|
12
|
+
export * from './widget';
|
package/lib/index.js
CHANGED
|
@@ -5,9 +5,11 @@
|
|
|
5
5
|
* @module codeeditor
|
|
6
6
|
*/
|
|
7
7
|
export * from './editor';
|
|
8
|
-
export * from './jsoneditor';
|
|
9
|
-
export * from './widget';
|
|
10
8
|
export * from './factory';
|
|
9
|
+
export * from './jsoneditor';
|
|
10
|
+
export * from './lineCol';
|
|
11
11
|
export * from './mimetype';
|
|
12
12
|
export * from './tokens';
|
|
13
|
+
export * from './viewer';
|
|
14
|
+
export * from './widget';
|
|
13
15
|
//# 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,UAAU,CAAC;AACzB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAC3D;;;GAGG;AAEH,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC"}
|
package/lib/jsoneditor.d.ts
CHANGED
|
@@ -59,14 +59,6 @@ export declare class JSONEditor extends Widget {
|
|
|
59
59
|
* Handle `after-attach` messages for the widget.
|
|
60
60
|
*/
|
|
61
61
|
protected onAfterAttach(msg: Message): void;
|
|
62
|
-
/**
|
|
63
|
-
* Handle `after-show` messages for the widget.
|
|
64
|
-
*/
|
|
65
|
-
protected onAfterShow(msg: Message): void;
|
|
66
|
-
/**
|
|
67
|
-
* Handle `update-request` messages for the widget.
|
|
68
|
-
*/
|
|
69
|
-
protected onUpdateRequest(msg: Message): void;
|
|
70
62
|
/**
|
|
71
63
|
* Handle `before-detach` messages for the widget.
|
|
72
64
|
*/
|
package/lib/jsoneditor.js
CHANGED
|
@@ -121,21 +121,6 @@ export class JSONEditor extends Widget {
|
|
|
121
121
|
this.revertButtonNode.hidden = true;
|
|
122
122
|
this.commitButtonNode.hidden = true;
|
|
123
123
|
this.headerNode.addEventListener('click', this);
|
|
124
|
-
if (this.isVisible) {
|
|
125
|
-
this.update();
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Handle `after-show` messages for the widget.
|
|
130
|
-
*/
|
|
131
|
-
onAfterShow(msg) {
|
|
132
|
-
this.update();
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Handle `update-request` messages for the widget.
|
|
136
|
-
*/
|
|
137
|
-
onUpdateRequest(msg) {
|
|
138
|
-
this.editor.refresh();
|
|
139
124
|
}
|
|
140
125
|
/**
|
|
141
126
|
* Handle `before-detach` messages for the widget.
|
|
@@ -256,7 +241,6 @@ export class JSONEditor extends Widget {
|
|
|
256
241
|
this.editor.setCursorPosition({ line: 0, column: 1 });
|
|
257
242
|
}
|
|
258
243
|
}
|
|
259
|
-
this.editor.refresh();
|
|
260
244
|
this._changeGuard = false;
|
|
261
245
|
this.commitButtonNode.hidden = true;
|
|
262
246
|
this.revertButtonNode.hidden = true;
|
package/lib/jsoneditor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsoneditor.js","sourceRoot":"","sources":["../src/jsoneditor.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAG3D,OAAO,EAEL,cAAc,EAEf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EACL,OAAO,EAGR,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC;;GAEG;AACH,MAAM,gBAAgB,GAAG,eAAe,CAAC;AAEzC;;GAEG;AACH,MAAM,WAAW,GAAG,cAAc,CAAC;AAEnC;;GAEG;AACH,MAAM,UAAU,GAAG,oBAAoB,CAAC;AAExC;;GAEG;AACH,MAAM,YAAY,GAAG,sBAAsB,CAAC;AAE5C;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,MAAM;IACpC;;OAEG;IACH,YAAY,OAA4B;QACtC,KAAK,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"jsoneditor.js","sourceRoot":"","sources":["../src/jsoneditor.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAG3D,OAAO,EAEL,cAAc,EAEf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EACL,OAAO,EAGR,MAAM,mBAAmB,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C/C,KAAK,CAAC,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC;YACzB,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC;YAC9B,uCAAuC;YACvC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;gBACxC,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;aACvD;SACF;QACD,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;QAC1B,IAAI,CAAC,gBAAgB,CAAC,MAAM,GAAG,IAAI,CAAC;QACpC,IAAI,CAAC,gBAAgB,CAAC,MAAM,GAAG,IAAI,CAAC;IACtC,CAAC;CASF"}
|
package/lib/lineCol.d.ts
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { ITranslator } from '@jupyterlab/translation';
|
|
2
|
+
import { VDomModel, VDomRenderer } from '@jupyterlab/ui-components';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { CodeEditor } from './editor';
|
|
5
|
+
/**
|
|
6
|
+
* A namespace for LineColComponent.
|
|
7
|
+
*/
|
|
8
|
+
declare namespace LineColComponent {
|
|
9
|
+
/**
|
|
10
|
+
* Props for LineColComponent.
|
|
11
|
+
*/
|
|
12
|
+
interface IProps {
|
|
13
|
+
/**
|
|
14
|
+
* The current line number.
|
|
15
|
+
*/
|
|
16
|
+
line: number;
|
|
17
|
+
/**
|
|
18
|
+
* The current column number.
|
|
19
|
+
*/
|
|
20
|
+
column: number;
|
|
21
|
+
/**
|
|
22
|
+
* The application language translator.
|
|
23
|
+
*/
|
|
24
|
+
translator?: ITranslator;
|
|
25
|
+
/**
|
|
26
|
+
* A click handler for the LineColComponent, which
|
|
27
|
+
* we use to launch the LineFormComponent.
|
|
28
|
+
*/
|
|
29
|
+
handleClick: () => void;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* A pure functional component for rendering a line/column
|
|
34
|
+
* status item.
|
|
35
|
+
*/
|
|
36
|
+
declare function LineColComponent(props: LineColComponent.IProps): React.ReactElement<LineColComponent.IProps>;
|
|
37
|
+
/**
|
|
38
|
+
* A widget implementing a line/column status item.
|
|
39
|
+
*/
|
|
40
|
+
export declare class LineCol extends VDomRenderer<LineCol.Model> {
|
|
41
|
+
/**
|
|
42
|
+
* Construct a new LineCol status item.
|
|
43
|
+
*/
|
|
44
|
+
constructor(translator?: ITranslator);
|
|
45
|
+
/**
|
|
46
|
+
* Render the status item.
|
|
47
|
+
*/
|
|
48
|
+
render(): React.ReactElement<LineColComponent.IProps> | null;
|
|
49
|
+
/**
|
|
50
|
+
* A click handler for the widget.
|
|
51
|
+
*/
|
|
52
|
+
private _handleClick;
|
|
53
|
+
/**
|
|
54
|
+
* Handle submission for the widget.
|
|
55
|
+
*/
|
|
56
|
+
private _handleSubmit;
|
|
57
|
+
protected translator: ITranslator;
|
|
58
|
+
private _popup;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* A namespace for LineCol statics.
|
|
62
|
+
*/
|
|
63
|
+
export declare namespace LineCol {
|
|
64
|
+
/**
|
|
65
|
+
* A VDom model for a status item tracking the line/column of an editor.
|
|
66
|
+
*/
|
|
67
|
+
class Model extends VDomModel {
|
|
68
|
+
/**
|
|
69
|
+
* The current editor of the model.
|
|
70
|
+
*/
|
|
71
|
+
get editor(): CodeEditor.IEditor | null;
|
|
72
|
+
set editor(editor: CodeEditor.IEditor | null);
|
|
73
|
+
/**
|
|
74
|
+
* The current line of the model.
|
|
75
|
+
*/
|
|
76
|
+
get line(): number;
|
|
77
|
+
/**
|
|
78
|
+
* The current column of the model.
|
|
79
|
+
*/
|
|
80
|
+
get column(): number;
|
|
81
|
+
/**
|
|
82
|
+
* React to a change in the cursors of the current editor.
|
|
83
|
+
*/
|
|
84
|
+
private _onSelectionChanged;
|
|
85
|
+
private _getAllState;
|
|
86
|
+
private _triggerChange;
|
|
87
|
+
private _line;
|
|
88
|
+
private _column;
|
|
89
|
+
private _editor;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
export {};
|
package/lib/lineCol.js
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
// Copyright (c) Jupyter Development Team.
|
|
2
|
+
// Distributed under the terms of the Modified BSD License.
|
|
3
|
+
import { interactiveItem, showPopup, TextItem } from '@jupyterlab/statusbar';
|
|
4
|
+
import { nullTranslator } from '@jupyterlab/translation';
|
|
5
|
+
import { classes, lineFormIcon, ReactWidget, VDomModel, VDomRenderer } from '@jupyterlab/ui-components';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
/**
|
|
8
|
+
* A component for rendering a "go-to-line" form.
|
|
9
|
+
*/
|
|
10
|
+
class LineFormComponent extends React.Component {
|
|
11
|
+
/**
|
|
12
|
+
* Construct a new LineFormComponent.
|
|
13
|
+
*/
|
|
14
|
+
constructor(props) {
|
|
15
|
+
super(props);
|
|
16
|
+
/**
|
|
17
|
+
* Handle a change to the value in the input field.
|
|
18
|
+
*/
|
|
19
|
+
this._handleChange = (event) => {
|
|
20
|
+
this.setState({ value: event.currentTarget.value });
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Handle submission of the input field.
|
|
24
|
+
*/
|
|
25
|
+
this._handleSubmit = (event) => {
|
|
26
|
+
event.preventDefault();
|
|
27
|
+
const value = parseInt(this._textInput.value, 10);
|
|
28
|
+
if (!isNaN(value) &&
|
|
29
|
+
isFinite(value) &&
|
|
30
|
+
1 <= value &&
|
|
31
|
+
value <= this.props.maxLine) {
|
|
32
|
+
this.props.handleSubmit(value);
|
|
33
|
+
}
|
|
34
|
+
return false;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Handle focusing of the input field.
|
|
38
|
+
*/
|
|
39
|
+
this._handleFocus = () => {
|
|
40
|
+
this.setState({ hasFocus: true });
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Handle blurring of the input field.
|
|
44
|
+
*/
|
|
45
|
+
this._handleBlur = () => {
|
|
46
|
+
this.setState({ hasFocus: false });
|
|
47
|
+
};
|
|
48
|
+
this._textInput = null;
|
|
49
|
+
this.translator = props.translator || nullTranslator;
|
|
50
|
+
this._trans = this.translator.load('jupyterlab');
|
|
51
|
+
this.state = {
|
|
52
|
+
value: '',
|
|
53
|
+
hasFocus: false
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Focus the element on mount.
|
|
58
|
+
*/
|
|
59
|
+
componentDidMount() {
|
|
60
|
+
this._textInput.focus();
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Render the LineFormComponent.
|
|
64
|
+
*/
|
|
65
|
+
render() {
|
|
66
|
+
return (React.createElement("div", { className: "jp-lineFormSearch" },
|
|
67
|
+
React.createElement("form", { name: "lineColumnForm", onSubmit: this._handleSubmit, noValidate: true },
|
|
68
|
+
React.createElement("div", { className: classes('jp-lineFormWrapper', 'lm-lineForm-wrapper', this.state.hasFocus ? 'jp-lineFormWrapperFocusWithin' : undefined) },
|
|
69
|
+
React.createElement("input", { type: "text", className: "jp-lineFormInput", onChange: this._handleChange, onFocus: this._handleFocus, onBlur: this._handleBlur, value: this.state.value, ref: input => {
|
|
70
|
+
this._textInput = input;
|
|
71
|
+
} }),
|
|
72
|
+
React.createElement("div", { className: "jp-baseLineForm jp-lineFormButtonContainer" },
|
|
73
|
+
React.createElement(lineFormIcon.react, { className: "jp-baseLineForm jp-lineFormButtonIcon", elementPosition: "center" }),
|
|
74
|
+
React.createElement("input", { type: "submit", className: "jp-baseLineForm jp-lineFormButton", value: "" }))),
|
|
75
|
+
React.createElement("label", { className: "jp-lineFormCaption" }, this._trans.__('Go to line number between 1 and %1', this.props.maxLine)))));
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* A pure functional component for rendering a line/column
|
|
80
|
+
* status item.
|
|
81
|
+
*/
|
|
82
|
+
function LineColComponent(props) {
|
|
83
|
+
const translator = props.translator || nullTranslator;
|
|
84
|
+
const trans = translator.load('jupyterlab');
|
|
85
|
+
return (React.createElement(TextItem, { onClick: props.handleClick, source: trans.__('Ln %1, Col %2', props.line, props.column), title: trans.__('Go to line number…') }));
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* A widget implementing a line/column status item.
|
|
89
|
+
*/
|
|
90
|
+
export class LineCol extends VDomRenderer {
|
|
91
|
+
/**
|
|
92
|
+
* Construct a new LineCol status item.
|
|
93
|
+
*/
|
|
94
|
+
constructor(translator) {
|
|
95
|
+
super(new LineCol.Model());
|
|
96
|
+
this._popup = null;
|
|
97
|
+
this.addClass(interactiveItem);
|
|
98
|
+
this.translator = translator || nullTranslator;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Render the status item.
|
|
102
|
+
*/
|
|
103
|
+
render() {
|
|
104
|
+
if (this.model === null) {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
return (React.createElement(LineColComponent, { line: this.model.line, column: this.model.column, translator: this.translator, handleClick: () => this._handleClick() }));
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* A click handler for the widget.
|
|
113
|
+
*/
|
|
114
|
+
_handleClick() {
|
|
115
|
+
if (this._popup) {
|
|
116
|
+
this._popup.dispose();
|
|
117
|
+
}
|
|
118
|
+
const body = ReactWidget.create(React.createElement(LineFormComponent, { handleSubmit: val => this._handleSubmit(val), currentLine: this.model.line, maxLine: this.model.editor.lineCount, translator: this.translator }));
|
|
119
|
+
this._popup = showPopup({
|
|
120
|
+
body: body,
|
|
121
|
+
anchor: this,
|
|
122
|
+
align: 'right'
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Handle submission for the widget.
|
|
127
|
+
*/
|
|
128
|
+
_handleSubmit(value) {
|
|
129
|
+
this.model.editor.setCursorPosition({ line: value - 1, column: 0 });
|
|
130
|
+
this._popup.dispose();
|
|
131
|
+
this.model.editor.focus();
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* A namespace for LineCol statics.
|
|
136
|
+
*/
|
|
137
|
+
(function (LineCol) {
|
|
138
|
+
/**
|
|
139
|
+
* A VDom model for a status item tracking the line/column of an editor.
|
|
140
|
+
*/
|
|
141
|
+
class Model extends VDomModel {
|
|
142
|
+
constructor() {
|
|
143
|
+
super(...arguments);
|
|
144
|
+
/**
|
|
145
|
+
* React to a change in the cursors of the current editor.
|
|
146
|
+
*/
|
|
147
|
+
this._onSelectionChanged = () => {
|
|
148
|
+
const oldState = this._getAllState();
|
|
149
|
+
const pos = this.editor.getCursorPosition();
|
|
150
|
+
this._line = pos.line + 1;
|
|
151
|
+
this._column = pos.column + 1;
|
|
152
|
+
this._triggerChange(oldState, this._getAllState());
|
|
153
|
+
};
|
|
154
|
+
this._line = 1;
|
|
155
|
+
this._column = 1;
|
|
156
|
+
this._editor = null;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* The current editor of the model.
|
|
160
|
+
*/
|
|
161
|
+
get editor() {
|
|
162
|
+
return this._editor;
|
|
163
|
+
}
|
|
164
|
+
set editor(editor) {
|
|
165
|
+
var _a;
|
|
166
|
+
const oldEditor = this._editor;
|
|
167
|
+
if ((_a = oldEditor === null || oldEditor === void 0 ? void 0 : oldEditor.model) === null || _a === void 0 ? void 0 : _a.selections) {
|
|
168
|
+
oldEditor.model.selections.changed.disconnect(this._onSelectionChanged);
|
|
169
|
+
}
|
|
170
|
+
const oldState = this._getAllState();
|
|
171
|
+
this._editor = editor;
|
|
172
|
+
if (!this._editor) {
|
|
173
|
+
this._column = 1;
|
|
174
|
+
this._line = 1;
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
this._editor.model.selections.changed.connect(this._onSelectionChanged);
|
|
178
|
+
const pos = this._editor.getCursorPosition();
|
|
179
|
+
this._column = pos.column + 1;
|
|
180
|
+
this._line = pos.line + 1;
|
|
181
|
+
}
|
|
182
|
+
this._triggerChange(oldState, this._getAllState());
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* The current line of the model.
|
|
186
|
+
*/
|
|
187
|
+
get line() {
|
|
188
|
+
return this._line;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* The current column of the model.
|
|
192
|
+
*/
|
|
193
|
+
get column() {
|
|
194
|
+
return this._column;
|
|
195
|
+
}
|
|
196
|
+
_getAllState() {
|
|
197
|
+
return [this._line, this._column];
|
|
198
|
+
}
|
|
199
|
+
_triggerChange(oldState, newState) {
|
|
200
|
+
if (oldState[0] !== newState[0] || oldState[1] !== newState[1]) {
|
|
201
|
+
this.stateChanged.emit(void 0);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
LineCol.Model = Model;
|
|
206
|
+
})(LineCol || (LineCol = {}));
|
|
207
|
+
//# sourceMappingURL=lineCol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lineCol.js","sourceRoot":"","sources":["../src/lineCol.tsx"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EACL,eAAe,EAEf,SAAS,EACT,QAAQ,EACT,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAEL,cAAc,EAEf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,OAAO,EACP,YAAY,EACZ,WAAW,EACX,SAAS,EACT,YAAY,EACb,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,MAAM,OAAO,CAAC;AAiD1B;;GAEG;AACH,MAAM,iBAAkB,SAAQ,KAAK,CAAC,SAGrC;IACC;;OAEG;IACH,YAAY,KAA+B;QACzC,KAAK,CAAC,KAAK,CAAC,CAAC;QAgEf;;WAEG;QACK,kBAAa,GAAG,CAAC,KAA0C,EAAE,EAAE;YACrE,IAAI,CAAC,QAAQ,CAAC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CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;aAChC;QACH,CAAC;KAKF;IAvEY,aAAK,QAuEjB,CAAA;AACH,CAAC,EA5EgB,OAAO,KAAP,OAAO,QA4EvB"}
|
package/lib/tokens.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Token } from '@lumino/coreutils';
|
|
2
|
+
import { Widget } from '@lumino/widgets';
|
|
3
|
+
import { CodeEditor } from './editor';
|
|
2
4
|
import { IEditorFactoryService } from './factory';
|
|
3
5
|
import { IEditorMimeTypeService } from './mimetype';
|
|
4
6
|
/**
|
|
@@ -18,3 +20,23 @@ export interface IEditorServices {
|
|
|
18
20
|
*/
|
|
19
21
|
readonly mimeTypeService: IEditorMimeTypeService;
|
|
20
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Code editor cursor position token.
|
|
25
|
+
*/
|
|
26
|
+
export declare const IPositionModel: Token<IPositionModel>;
|
|
27
|
+
/**
|
|
28
|
+
* Code editor cursor position model.
|
|
29
|
+
*/
|
|
30
|
+
export interface IPositionModel {
|
|
31
|
+
/**
|
|
32
|
+
* Add a editor provider.
|
|
33
|
+
*
|
|
34
|
+
* A provider will receive the currently active widget and must return the
|
|
35
|
+
* associated editor if it can or null otherwise.
|
|
36
|
+
*/
|
|
37
|
+
addEditorProvider: (provider: (widget: Widget | null) => CodeEditor.IEditor | null) => void;
|
|
38
|
+
/**
|
|
39
|
+
* Callback to force updating the provider
|
|
40
|
+
*/
|
|
41
|
+
update(): void;
|
|
42
|
+
}
|
package/lib/tokens.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
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
|
* Code editor services token.
|
|
7
6
|
*/
|
|
8
7
|
export const IEditorServices = new Token('@jupyterlab/codeeditor:IEditorServices');
|
|
8
|
+
/**
|
|
9
|
+
* Code editor cursor position token.
|
|
10
|
+
*/
|
|
11
|
+
export const IPositionModel = new Token('@jupyterlab/codeeditor:IPositionModel');
|
|
9
12
|
//# 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;AAE3D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAM1C;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,KAAK,CACtC,wCAAwC,CACzC,CAAC;AAiBF;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,KAAK,CACrC,uCAAuC,CACxC,CAAC"}
|
package/lib/viewer.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Widget } from '@lumino/widgets';
|
|
2
|
+
import { CodeEditor } from './editor';
|
|
3
|
+
export declare class CodeViewerWidget extends Widget {
|
|
4
|
+
/**
|
|
5
|
+
* Construct a new code viewer widget.
|
|
6
|
+
*/
|
|
7
|
+
constructor(options: CodeViewerWidget.IOptions);
|
|
8
|
+
static createCodeViewer(options: CodeViewerWidget.INoModelOptions): CodeViewerWidget;
|
|
9
|
+
get content(): string;
|
|
10
|
+
get mimeType(): string;
|
|
11
|
+
model: CodeEditor.IModel;
|
|
12
|
+
editor: CodeEditor.IEditor;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The namespace for code viewer widget.
|
|
16
|
+
*/
|
|
17
|
+
export declare namespace CodeViewerWidget {
|
|
18
|
+
/**
|
|
19
|
+
* The options used to create an code viewer widget.
|
|
20
|
+
*/
|
|
21
|
+
interface IOptions {
|
|
22
|
+
/**
|
|
23
|
+
* A code editor factory.
|
|
24
|
+
*/
|
|
25
|
+
factory: CodeEditor.Factory;
|
|
26
|
+
/**
|
|
27
|
+
* The content model for the viewer.
|
|
28
|
+
*/
|
|
29
|
+
model: CodeEditor.Model;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The options used to create an code viewer widget without a model.
|
|
33
|
+
*/
|
|
34
|
+
interface INoModelOptions {
|
|
35
|
+
/**
|
|
36
|
+
* A code editor factory.
|
|
37
|
+
*/
|
|
38
|
+
factory: CodeEditor.Factory;
|
|
39
|
+
/**
|
|
40
|
+
* The content to display in the viewer.
|
|
41
|
+
*/
|
|
42
|
+
content: string;
|
|
43
|
+
/**
|
|
44
|
+
* The mime type for the content.
|
|
45
|
+
*/
|
|
46
|
+
mimeType?: string;
|
|
47
|
+
}
|
|
48
|
+
}
|
package/lib/viewer.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Copyright (c) Jupyter Development Team.
|
|
2
|
+
// Distributed under the terms of the Modified BSD License.
|
|
3
|
+
import { StackedLayout, Widget } from '@lumino/widgets';
|
|
4
|
+
import { CodeEditor } from './editor';
|
|
5
|
+
import { CodeEditorWrapper } from './widget';
|
|
6
|
+
export class CodeViewerWidget extends Widget {
|
|
7
|
+
/**
|
|
8
|
+
* Construct a new code viewer widget.
|
|
9
|
+
*/
|
|
10
|
+
constructor(options) {
|
|
11
|
+
super();
|
|
12
|
+
this.model = options.model;
|
|
13
|
+
const editorWidget = new CodeEditorWrapper({
|
|
14
|
+
factory: options.factory,
|
|
15
|
+
model: options.model
|
|
16
|
+
});
|
|
17
|
+
this.editor = editorWidget.editor;
|
|
18
|
+
this.editor.setOption('readOnly', true);
|
|
19
|
+
const layout = (this.layout = new StackedLayout());
|
|
20
|
+
layout.addWidget(editorWidget);
|
|
21
|
+
}
|
|
22
|
+
static createCodeViewer(options) {
|
|
23
|
+
const model = new CodeEditor.Model({
|
|
24
|
+
value: options.content,
|
|
25
|
+
mimeType: options.mimeType
|
|
26
|
+
});
|
|
27
|
+
return new CodeViewerWidget({ factory: options.factory, model });
|
|
28
|
+
}
|
|
29
|
+
get content() {
|
|
30
|
+
return this.model.value.text;
|
|
31
|
+
}
|
|
32
|
+
get mimeType() {
|
|
33
|
+
return this.model.mimeType;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=viewer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewer.js","sourceRoot":"","sources":["../src/viewer.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,MAAM,OAAO,gBAAiB,SAAQ,MAAM;IAC1C;;OAEG;IACH,YAAY,OAAkC;QAC5C,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAE3B,MAAM,YAAY,GAAG,IAAI,iBAAiB,CAAC;YACzC,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,KAAK,EAAE,OAAO,CAAC,KAAK;SACrB,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC;QAClC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QAExC,MAAM,MAAM,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,aAAa,EAAE,CAAC,CAAC;QACnD,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;IACjC,CAAC;IAED,MAAM,CAAC,gBAAgB,CACrB,OAAyC;QAEzC,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC;YACjC,KAAK,EAAE,OAAO,CAAC,OAAO;YACtB,QAAQ,EAAE,OAAO,CAAC,QAAQ;SAC3B,CAAC,CAAC;QACH,OAAO,IAAI,gBAAgB,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;IACnE,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC;IAC/B,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC7B,CAAC;CAIF"}
|
package/lib/widget.d.ts
CHANGED
|
@@ -44,18 +44,10 @@ export declare class CodeEditorWrapper extends Widget {
|
|
|
44
44
|
* Handle `before-detach` messages for the widget.
|
|
45
45
|
*/
|
|
46
46
|
protected onBeforeDetach(msg: Message): void;
|
|
47
|
-
/**
|
|
48
|
-
* A message handler invoked on an `'after-show'` message.
|
|
49
|
-
*/
|
|
50
|
-
protected onAfterShow(msg: Message): void;
|
|
51
47
|
/**
|
|
52
48
|
* A message handler invoked on a `'resize'` message.
|
|
53
49
|
*/
|
|
54
50
|
protected onResize(msg: Widget.ResizeMessage): void;
|
|
55
|
-
/**
|
|
56
|
-
* A message handler invoked on an `'update-request'` message.
|
|
57
|
-
*/
|
|
58
|
-
protected onUpdateRequest(msg: Message): void;
|
|
59
51
|
/**
|
|
60
52
|
* Handle a change in model selections.
|
|
61
53
|
*/
|
|
@@ -76,8 +68,6 @@ export declare class CodeEditorWrapper extends Widget {
|
|
|
76
68
|
* Handle the `'lm-drop'` event for the widget.
|
|
77
69
|
*/
|
|
78
70
|
private _evtDrop;
|
|
79
|
-
private _updateOnShow;
|
|
80
|
-
private _hasRefreshedSinceAttach;
|
|
81
71
|
}
|
|
82
72
|
/**
|
|
83
73
|
* The namespace for the `CodeEditorWrapper` statics.
|
|
@@ -111,9 +101,5 @@ export declare namespace CodeEditorWrapper {
|
|
|
111
101
|
* The default selection style for the editor.
|
|
112
102
|
*/
|
|
113
103
|
selectionStyle?: CodeEditor.ISelectionStyle;
|
|
114
|
-
/**
|
|
115
|
-
* Whether to send an update request to the editor when it is shown.
|
|
116
|
-
*/
|
|
117
|
-
updateOnShow?: boolean;
|
|
118
104
|
}
|
|
119
105
|
}
|
package/lib/widget.js
CHANGED
|
@@ -27,7 +27,6 @@ export class CodeEditorWrapper extends Widget {
|
|
|
27
27
|
*/
|
|
28
28
|
constructor(options) {
|
|
29
29
|
super();
|
|
30
|
-
this._hasRefreshedSinceAttach = false;
|
|
31
30
|
const editor = (this.editor = options.factory({
|
|
32
31
|
host: this.node,
|
|
33
32
|
model: options.model,
|
|
@@ -36,7 +35,6 @@ export class CodeEditorWrapper extends Widget {
|
|
|
36
35
|
selectionStyle: options.selectionStyle
|
|
37
36
|
}));
|
|
38
37
|
editor.model.selections.changed.connect(this._onSelectionsChanged, this);
|
|
39
|
-
this._updateOnShow = options.updateOnShow !== false;
|
|
40
38
|
}
|
|
41
39
|
/**
|
|
42
40
|
* Get the model used by the widget.
|
|
@@ -98,12 +96,6 @@ export class CodeEditorWrapper extends Widget {
|
|
|
98
96
|
node.addEventListener('lm-dragleave', this);
|
|
99
97
|
node.addEventListener('lm-dragover', this);
|
|
100
98
|
node.addEventListener('lm-drop', this);
|
|
101
|
-
// We have to refresh at least once after attaching,
|
|
102
|
-
// while visible.
|
|
103
|
-
this._hasRefreshedSinceAttach = false;
|
|
104
|
-
if (this.isVisible) {
|
|
105
|
-
this.update();
|
|
106
|
-
}
|
|
107
99
|
}
|
|
108
100
|
/**
|
|
109
101
|
* Handle `before-detach` messages for the widget.
|
|
@@ -115,32 +107,12 @@ export class CodeEditorWrapper extends Widget {
|
|
|
115
107
|
node.removeEventListener('lm-dragover', this);
|
|
116
108
|
node.removeEventListener('lm-drop', this);
|
|
117
109
|
}
|
|
118
|
-
/**
|
|
119
|
-
* A message handler invoked on an `'after-show'` message.
|
|
120
|
-
*/
|
|
121
|
-
onAfterShow(msg) {
|
|
122
|
-
if (this._updateOnShow || !this._hasRefreshedSinceAttach) {
|
|
123
|
-
this.update();
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
110
|
/**
|
|
127
111
|
* A message handler invoked on a `'resize'` message.
|
|
128
112
|
*/
|
|
129
113
|
onResize(msg) {
|
|
130
|
-
if (msg.width >= 0 && msg.height >= 0) {
|
|
131
|
-
this.editor.setSize(msg);
|
|
132
|
-
}
|
|
133
|
-
else if (this.isVisible) {
|
|
134
|
-
this.editor.resizeToFit();
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* A message handler invoked on an `'update-request'` message.
|
|
139
|
-
*/
|
|
140
|
-
onUpdateRequest(msg) {
|
|
141
114
|
if (this.isVisible) {
|
|
142
|
-
this.
|
|
143
|
-
this.editor.refresh();
|
|
115
|
+
this.editor.resizeToFit();
|
|
144
116
|
}
|
|
145
117
|
}
|
|
146
118
|
/**
|
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;AAK3D,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAGzC;;GAEG;AACH,MAAM,mBAAmB,GAAG,8BAA8B,CAAC;AAE3D;;;GAGG;AACH,MAAM,+BAA+B,GAAG,8BAA8B,CAAC;AAEvE;;GAEG;AACH,MAAM,iBAAiB,GAAG,mBAAmB,CAAC;AAE9C;;GAEG;AACH,MAAM,mBAAmB,GAAG,OAAO,CAAC;AAEpC;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,MAAM;IAC3C;;OAEG;IACH,YAAY,OAAmC;QAC7C,KAAK,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"widget.js","sourceRoot":"","sources":["../src/widget.ts"],"names":[],"mappings":"AAAA,0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2
2
|
"name": "@jupyterlab/codeeditor",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.12",
|
|
4
4
|
"description": "JupyterLab - Abstract Code Editor",
|
|
5
5
|
"homepage": "https://github.com/jupyterlab/jupyterlab",
|
|
6
6
|
"bugs": {
|
|
@@ -41,27 +41,29 @@
|
|
|
41
41
|
"watch": "tsc -b --watch"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@jupyterlab/coreutils": "^6.0.0-alpha.
|
|
45
|
-
"@jupyterlab/nbformat": "^4.0.0-alpha.
|
|
46
|
-
"@jupyterlab/observables": "^5.0.0-alpha.
|
|
47
|
-
"@jupyterlab/shared-models": "^4.0.0-alpha.
|
|
48
|
-
"@jupyterlab/
|
|
49
|
-
"@jupyterlab/
|
|
50
|
-
"@
|
|
44
|
+
"@jupyterlab/coreutils": "^6.0.0-alpha.12",
|
|
45
|
+
"@jupyterlab/nbformat": "^4.0.0-alpha.12",
|
|
46
|
+
"@jupyterlab/observables": "^5.0.0-alpha.12",
|
|
47
|
+
"@jupyterlab/shared-models": "^4.0.0-alpha.12",
|
|
48
|
+
"@jupyterlab/statusbar": "^4.0.0-alpha.12",
|
|
49
|
+
"@jupyterlab/translation": "^4.0.0-alpha.12",
|
|
50
|
+
"@jupyterlab/ui-components": "^4.0.0-alpha.27",
|
|
51
|
+
"@lumino/coreutils": "^1.12.0",
|
|
51
52
|
"@lumino/disposable": "^1.10.1",
|
|
52
|
-
"@lumino/dragdrop": "^1.
|
|
53
|
+
"@lumino/dragdrop": "^1.14.0",
|
|
53
54
|
"@lumino/messaging": "^1.10.1",
|
|
54
55
|
"@lumino/signaling": "^1.10.1",
|
|
55
|
-
"@lumino/widgets": "^1.
|
|
56
|
+
"@lumino/widgets": "^1.33.0",
|
|
57
|
+
"react": "^17.0.1"
|
|
56
58
|
},
|
|
57
59
|
"devDependencies": {
|
|
58
|
-
"@jupyterlab/testutils": "^4.0.0-alpha.
|
|
60
|
+
"@jupyterlab/testutils": "^4.0.0-alpha.12",
|
|
59
61
|
"@types/jest": "^26.0.10",
|
|
60
62
|
"jest": "^26.4.2",
|
|
61
63
|
"rimraf": "~3.0.0",
|
|
62
64
|
"ts-jest": "^26.3.0",
|
|
63
|
-
"typedoc": "~0.
|
|
64
|
-
"typescript": "~4.
|
|
65
|
+
"typedoc": "~0.22.10",
|
|
66
|
+
"typescript": "~4.7.3"
|
|
65
67
|
},
|
|
66
68
|
"publishConfig": {
|
|
67
69
|
"access": "public"
|
package/style/base.css
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
|
4
4
|
| Distributed under the terms of the Modified BSD License.
|
|
5
5
|
|----------------------------------------------------------------------------*/
|
|
6
|
+
@import url('./linecol.css');
|
|
6
7
|
|
|
7
8
|
.jp-JSONEditor {
|
|
8
9
|
display: flex;
|
|
@@ -13,7 +14,7 @@
|
|
|
13
14
|
.jp-JSONEditor-host {
|
|
14
15
|
flex: 1 1 auto;
|
|
15
16
|
border: var(--jp-border-width) solid var(--jp-input-border-color);
|
|
16
|
-
border-radius:
|
|
17
|
+
border-radius: 0;
|
|
17
18
|
background: var(--jp-layout-color0);
|
|
18
19
|
min-height: 50px;
|
|
19
20
|
padding: 1px;
|
package/style/index.css
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
/* This file was auto-generated by ensurePackage() in @jupyterlab/buildutils */
|
|
7
7
|
@import url('~@lumino/widgets/style/index.css');
|
|
8
8
|
@import url('~@jupyterlab/ui-components/style/index.css');
|
|
9
|
+
@import url('~@jupyterlab/statusbar/style/index.css');
|
|
9
10
|
@import url('~@lumino/dragdrop/style/index.css');
|
|
10
11
|
|
|
11
12
|
@import url('./base.css');
|
package/style/index.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
/* This file was auto-generated by ensurePackage() in @jupyterlab/buildutils */
|
|
7
7
|
import '@lumino/widgets/style/index.js';
|
|
8
8
|
import '@jupyterlab/ui-components/style/index.js';
|
|
9
|
+
import '@jupyterlab/statusbar/style/index.js';
|
|
9
10
|
import '@lumino/dragdrop/style/index.js';
|
|
10
11
|
|
|
11
12
|
import './base.css';
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Jupyter Development Team.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
.jp-lineFormSearch {
|
|
7
|
+
padding: 4px 12px;
|
|
8
|
+
background-color: var(--jp-layout-color2);
|
|
9
|
+
box-shadow: var(--jp-toolbar-box-shadow);
|
|
10
|
+
z-index: 2;
|
|
11
|
+
font-size: var(--jp-ui-font-size1);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.jp-lineFormCaption {
|
|
15
|
+
font-size: var(--jp-ui-font-size0);
|
|
16
|
+
line-height: var(--jp-ui-font-size1);
|
|
17
|
+
margin-top: 4px;
|
|
18
|
+
color: var(--jp-ui-font-color0);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.jp-baseLineForm {
|
|
22
|
+
border: none;
|
|
23
|
+
border-radius: 0;
|
|
24
|
+
position: absolute;
|
|
25
|
+
background-size: 16px;
|
|
26
|
+
background-repeat: no-repeat;
|
|
27
|
+
background-position: center;
|
|
28
|
+
outline: none;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.jp-lineFormButtonContainer {
|
|
32
|
+
top: 4px;
|
|
33
|
+
right: 8px;
|
|
34
|
+
height: 24px;
|
|
35
|
+
padding: 0 12px;
|
|
36
|
+
width: 12px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.jp-lineFormButtonIcon {
|
|
40
|
+
top: 0;
|
|
41
|
+
right: 0;
|
|
42
|
+
background-color: var(--jp-brand-color1);
|
|
43
|
+
height: 100%;
|
|
44
|
+
width: 100%;
|
|
45
|
+
box-sizing: border-box;
|
|
46
|
+
padding: 4px 6px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.jp-lineFormButton {
|
|
50
|
+
top: 0;
|
|
51
|
+
right: 0;
|
|
52
|
+
background-color: transparent;
|
|
53
|
+
height: 100%;
|
|
54
|
+
width: 100%;
|
|
55
|
+
box-sizing: border-box;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.jp-lineFormWrapper {
|
|
59
|
+
overflow: hidden;
|
|
60
|
+
padding: 0 8px;
|
|
61
|
+
border: 1px solid var(--jp-border-color0);
|
|
62
|
+
background-color: var(--jp-input-active-background);
|
|
63
|
+
height: 22px;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.jp-lineFormWrapperFocusWithin {
|
|
67
|
+
border: var(--jp-border-width) solid var(--md-blue-500);
|
|
68
|
+
box-shadow: inset 0 0 4px var(--md-blue-300);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.jp-lineFormInput {
|
|
72
|
+
background: transparent;
|
|
73
|
+
width: 200px;
|
|
74
|
+
height: 100%;
|
|
75
|
+
border: none;
|
|
76
|
+
outline: none;
|
|
77
|
+
color: var(--jp-ui-font-color0);
|
|
78
|
+
line-height: 28px;
|
|
79
|
+
}
|