@jupyterlab/cells 4.0.0-alpha.9 → 4.0.0-beta.1
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/celldragutils.d.ts +1 -7
- package/lib/celldragutils.js +12 -13
- package/lib/celldragutils.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/inputarea.d.ts +5 -19
- package/lib/inputarea.js +10 -29
- package/lib/inputarea.js.map +1 -1
- package/lib/model.d.ts +118 -81
- package/lib/model.js +178 -395
- package/lib/model.js.map +1 -1
- package/lib/placeholder.d.ts +36 -17
- package/lib/placeholder.js +48 -35
- package/lib/placeholder.js.map +1 -1
- package/lib/resizeHandle.d.ts +0 -1
- package/lib/resizeHandle.js +9 -11
- package/lib/resizeHandle.js.map +1 -1
- package/lib/searchprovider.d.ts +31 -0
- package/lib/searchprovider.js +359 -0
- package/lib/searchprovider.js.map +1 -0
- package/lib/testutils.d.ts +22 -0
- package/lib/testutils.js +48 -0
- package/lib/testutils.js.map +1 -0
- package/lib/widget.d.ts +216 -46
- package/lib/widget.js +701 -289
- package/lib/widget.js.map +1 -1
- package/package.json +37 -35
- package/src/celldragutils.ts +214 -0
- package/src/collapser.tsx +150 -0
- package/src/headerfooter.ts +52 -0
- package/src/index.ts +17 -0
- package/src/inputarea.ts +292 -0
- package/src/model.ts +845 -0
- package/src/placeholder.ts +153 -0
- package/src/resizeHandle.ts +96 -0
- package/src/searchprovider.ts +436 -0
- package/src/testutils.ts +57 -0
- package/src/widget.ts +2363 -0
- package/style/index.css +2 -0
- package/style/index.js +2 -0
- package/style/placeholder.css +31 -7
- package/style/widget.css +16 -6
package/src/testutils.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// Copyright (c) Jupyter Development Team.
|
|
2
|
+
// Distributed under the terms of the Modified BSD License.
|
|
3
|
+
|
|
4
|
+
import { CodeEditorWrapper, IEditorServices } from '@jupyterlab/codeeditor';
|
|
5
|
+
import {
|
|
6
|
+
CodeMirrorEditorFactory,
|
|
7
|
+
CodeMirrorMimeTypeService,
|
|
8
|
+
EditorLanguageRegistry
|
|
9
|
+
} from '@jupyterlab/codemirror';
|
|
10
|
+
import { CodeCellModel } from './model';
|
|
11
|
+
import { Cell } from './widget';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The default notebook content.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export namespace NBTestUtils {
|
|
18
|
+
const editorServices: IEditorServices = (function () {
|
|
19
|
+
const languages = new EditorLanguageRegistry();
|
|
20
|
+
const factoryService = new CodeMirrorEditorFactory({ languages });
|
|
21
|
+
const mimeTypeService = new CodeMirrorMimeTypeService(languages);
|
|
22
|
+
return {
|
|
23
|
+
factoryService,
|
|
24
|
+
mimeTypeService
|
|
25
|
+
};
|
|
26
|
+
})();
|
|
27
|
+
|
|
28
|
+
export const editorFactory =
|
|
29
|
+
editorServices.factoryService.newInlineEditor.bind(
|
|
30
|
+
editorServices.factoryService
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
export const mimeTypeService = editorServices.mimeTypeService;
|
|
34
|
+
/**
|
|
35
|
+
* Create a base cell content factory.
|
|
36
|
+
*/
|
|
37
|
+
export function createBaseCellFactory(): Cell.IContentFactory {
|
|
38
|
+
return new Cell.ContentFactory({ editorFactory });
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Create a new code cell content factory.
|
|
43
|
+
*/
|
|
44
|
+
export function createCodeCellFactory(): Cell.IContentFactory {
|
|
45
|
+
return new Cell.ContentFactory({ editorFactory });
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Create a cell editor widget.
|
|
50
|
+
*/
|
|
51
|
+
export function createCellEditor(model?: CodeCellModel): CodeEditorWrapper {
|
|
52
|
+
return new CodeEditorWrapper({
|
|
53
|
+
model: model ?? new CodeCellModel(),
|
|
54
|
+
factory: editorFactory
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|