@jupyter/collaboration-extension 1.0.0-alpha.6 → 1.0.0-alpha.7
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/filebrowser.d.ts +13 -0
- package/lib/filebrowser.js +67 -22
- package/lib/index.js +4 -1
- package/package.json +14 -14
package/lib/filebrowser.d.ts
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import { JupyterFrontEndPlugin } from '@jupyterlab/application';
|
|
2
2
|
import { IDefaultFileBrowser } from '@jupyterlab/filebrowser';
|
|
3
|
+
import { ICollaborativeDrive } from '@jupyter/docprovider';
|
|
4
|
+
/**
|
|
5
|
+
* The default file browser factory provider.
|
|
6
|
+
*/
|
|
7
|
+
export declare const drive: JupyterFrontEndPlugin<ICollaborativeDrive>;
|
|
8
|
+
/**
|
|
9
|
+
* The default file browser factory provider.
|
|
10
|
+
*/
|
|
11
|
+
export declare const yfile: JupyterFrontEndPlugin<void>;
|
|
12
|
+
/**
|
|
13
|
+
* The default file browser factory provider.
|
|
14
|
+
*/
|
|
15
|
+
export declare const ynotebook: JupyterFrontEndPlugin<void>;
|
|
3
16
|
/**
|
|
4
17
|
* The default file browser factory provider.
|
|
5
18
|
*/
|
package/lib/filebrowser.js
CHANGED
|
@@ -2,7 +2,8 @@ import { ILabShell, IRouter, JupyterFrontEnd } from '@jupyterlab/application';
|
|
|
2
2
|
import { IDefaultFileBrowser, IFileBrowserFactory } from '@jupyterlab/filebrowser';
|
|
3
3
|
import { ITranslator } from '@jupyterlab/translation';
|
|
4
4
|
import { ISettingRegistry } from '@jupyterlab/settingregistry';
|
|
5
|
-
import {
|
|
5
|
+
import { YFile, YNotebook } from '@jupyter/ydoc';
|
|
6
|
+
import { ICollaborativeDrive, YDrive } from '@jupyter/docprovider';
|
|
6
7
|
/**
|
|
7
8
|
* The command IDs used by the file browser plugin.
|
|
8
9
|
*/
|
|
@@ -10,47 +11,91 @@ var CommandIDs;
|
|
|
10
11
|
(function (CommandIDs) {
|
|
11
12
|
CommandIDs.openPath = 'filebrowser:open-path';
|
|
12
13
|
})(CommandIDs || (CommandIDs = {}));
|
|
14
|
+
/**
|
|
15
|
+
* The default file browser factory provider.
|
|
16
|
+
*/
|
|
17
|
+
export const drive = {
|
|
18
|
+
id: '@jupyter/collaboration-extension:drive',
|
|
19
|
+
provides: ICollaborativeDrive,
|
|
20
|
+
requires: [ITranslator],
|
|
21
|
+
optional: [],
|
|
22
|
+
activate: (app, translator) => {
|
|
23
|
+
const trans = translator.load('jupyter_collaboration');
|
|
24
|
+
const drive = new YDrive(app.serviceManager.user, trans);
|
|
25
|
+
app.serviceManager.contents.addDrive(drive);
|
|
26
|
+
return drive;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* The default file browser factory provider.
|
|
31
|
+
*/
|
|
32
|
+
export const yfile = {
|
|
33
|
+
id: '@jupyter/collaboration-extension:yfile',
|
|
34
|
+
autoStart: true,
|
|
35
|
+
requires: [ICollaborativeDrive],
|
|
36
|
+
optional: [],
|
|
37
|
+
activate: (app, drive) => {
|
|
38
|
+
const yFileFactory = () => {
|
|
39
|
+
return new YFile();
|
|
40
|
+
};
|
|
41
|
+
drive.sharedModelFactory.registerDocumentFactory('file', yFileFactory);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* The default file browser factory provider.
|
|
46
|
+
*/
|
|
47
|
+
export const ynotebook = {
|
|
48
|
+
id: '@jupyter/collaboration-extension:ynotebook',
|
|
49
|
+
autoStart: true,
|
|
50
|
+
requires: [ICollaborativeDrive],
|
|
51
|
+
optional: [ISettingRegistry],
|
|
52
|
+
activate: (app, drive, settingRegistry) => {
|
|
53
|
+
let disableDocumentWideUndoRedo = true;
|
|
54
|
+
// Fetch settings if possible.
|
|
55
|
+
if (settingRegistry) {
|
|
56
|
+
settingRegistry
|
|
57
|
+
.load('@jupyterlab/notebook-extension:tracker')
|
|
58
|
+
.then(settings => {
|
|
59
|
+
const updateSettings = (settings) => {
|
|
60
|
+
var _a;
|
|
61
|
+
const enableDocWideUndo = settings === null || settings === void 0 ? void 0 : settings.get('experimentalEnableDocumentWideUndoRedo').composite;
|
|
62
|
+
disableDocumentWideUndoRedo = (_a = !enableDocWideUndo) !== null && _a !== void 0 ? _a : true;
|
|
63
|
+
};
|
|
64
|
+
updateSettings(settings);
|
|
65
|
+
settings.changed.connect((settings) => updateSettings(settings));
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
const yNotebookFactory = () => {
|
|
69
|
+
return new YNotebook({
|
|
70
|
+
disableDocumentWideUndoRedo
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
drive.sharedModelFactory.registerDocumentFactory('notebook', yNotebookFactory);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
13
76
|
/**
|
|
14
77
|
* The default file browser factory provider.
|
|
15
78
|
*/
|
|
16
79
|
export const defaultFileBrowser = {
|
|
17
80
|
id: '@jupyter/collaboration-extension:defaultFileBrowser',
|
|
18
81
|
provides: IDefaultFileBrowser,
|
|
19
|
-
requires: [
|
|
82
|
+
requires: [ICollaborativeDrive, IFileBrowserFactory],
|
|
20
83
|
optional: [
|
|
21
84
|
IRouter,
|
|
22
85
|
JupyterFrontEnd.ITreeResolver,
|
|
23
86
|
ILabShell,
|
|
24
87
|
ISettingRegistry
|
|
25
88
|
],
|
|
26
|
-
activate: async (app,
|
|
89
|
+
activate: async (app, drive, fileBrowserFactory, router, tree, labShell) => {
|
|
27
90
|
const { commands } = app;
|
|
28
|
-
const trans = translator.load('jupyter_collaboration');
|
|
29
|
-
const drive = new YDrive(app.serviceManager.user, trans);
|
|
30
91
|
app.serviceManager.contents.addDrive(drive);
|
|
31
92
|
// Manually restore and load the default file browser.
|
|
32
93
|
const defaultBrowser = fileBrowserFactory.createFileBrowser('filebrowser', {
|
|
33
94
|
auto: false,
|
|
34
95
|
restore: false,
|
|
35
|
-
driveName:
|
|
96
|
+
driveName: drive.name
|
|
36
97
|
});
|
|
37
98
|
void Private.restoreBrowser(defaultBrowser, commands, router, tree, labShell);
|
|
38
|
-
// Fetch settings if possible.
|
|
39
|
-
if (settingRegistry) {
|
|
40
|
-
settingRegistry
|
|
41
|
-
.load('@jupyterlab/notebook-extension:tracker')
|
|
42
|
-
.then(settings => {
|
|
43
|
-
const updateSettings = (settings) => {
|
|
44
|
-
var _a;
|
|
45
|
-
const enableDocWideUndo = settings === null || settings === void 0 ? void 0 : settings.get('experimentalEnableDocumentWideUndoRedo').composite;
|
|
46
|
-
drive.sharedModelFactory.setDocumentOptions('notebook', {
|
|
47
|
-
disableDocumentWideUndoRedo: (_a = !enableDocWideUndo) !== null && _a !== void 0 ? _a : true
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
|
-
updateSettings(settings);
|
|
51
|
-
settings.changed.connect((settings) => updateSettings(settings));
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
99
|
return defaultBrowser;
|
|
55
100
|
}
|
|
56
101
|
};
|
package/lib/index.js
CHANGED
|
@@ -4,12 +4,15 @@
|
|
|
4
4
|
* @packageDocumentation
|
|
5
5
|
* @module collaboration-extension
|
|
6
6
|
*/
|
|
7
|
-
import { defaultFileBrowser } from './filebrowser';
|
|
7
|
+
import { drive, yfile, ynotebook, defaultFileBrowser } from './filebrowser';
|
|
8
8
|
import { userMenuPlugin, menuBarPlugin, rtcGlobalAwarenessPlugin, rtcPanelPlugin, userEditorCursors } from './collaboration';
|
|
9
9
|
/**
|
|
10
10
|
* Export the plugins as default.
|
|
11
11
|
*/
|
|
12
12
|
const plugins = [
|
|
13
|
+
drive,
|
|
14
|
+
yfile,
|
|
15
|
+
ynotebook,
|
|
13
16
|
defaultFileBrowser,
|
|
14
17
|
userMenuPlugin,
|
|
15
18
|
menuBarPlugin,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jupyter/collaboration-extension",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.7",
|
|
4
4
|
"description": "JupyterLab - Real-Time Collaboration Extension",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jupyter",
|
|
@@ -53,18 +53,18 @@
|
|
|
53
53
|
"watch:labextension": "jupyter labextension watch ."
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@jupyter/collaboration": "^1.0.0-alpha.
|
|
57
|
-
"@jupyter/docprovider": "^1.0.0-alpha.
|
|
58
|
-
"@jupyterlab/application": "^4.0.0-
|
|
59
|
-
"@jupyterlab/apputils": "^4.0.0-
|
|
60
|
-
"@jupyterlab/codemirror": "^4.0.0-
|
|
61
|
-
"@jupyterlab/coreutils": "^6.0.0-
|
|
62
|
-
"@jupyterlab/filebrowser": "^4.0.0-
|
|
63
|
-
"@jupyterlab/services": "^7.0.0-
|
|
64
|
-
"@jupyterlab/settingregistry": "^4.0.0-
|
|
65
|
-
"@jupyterlab/statedb": "^4.0.0-
|
|
66
|
-
"@jupyterlab/translation": "^4.0.0-
|
|
67
|
-
"@jupyterlab/ui-components": "^4.0.0-
|
|
56
|
+
"@jupyter/collaboration": "^1.0.0-alpha.7",
|
|
57
|
+
"@jupyter/docprovider": "^1.0.0-alpha.7",
|
|
58
|
+
"@jupyterlab/application": "^4.0.0-beta.0",
|
|
59
|
+
"@jupyterlab/apputils": "^4.0.0-beta.0",
|
|
60
|
+
"@jupyterlab/codemirror": "^4.0.0-beta.0",
|
|
61
|
+
"@jupyterlab/coreutils": "^6.0.0-beta.0",
|
|
62
|
+
"@jupyterlab/filebrowser": "^4.0.0-beta.0",
|
|
63
|
+
"@jupyterlab/services": "^7.0.0-beta.0",
|
|
64
|
+
"@jupyterlab/settingregistry": "^4.0.0-beta.0",
|
|
65
|
+
"@jupyterlab/statedb": "^4.0.0-beta.0",
|
|
66
|
+
"@jupyterlab/translation": "^4.0.0-beta.0",
|
|
67
|
+
"@jupyterlab/ui-components": "^4.0.0-beta.0",
|
|
68
68
|
"@lumino/commands": "^2.0.0",
|
|
69
69
|
"@lumino/widgets": "^2.0.0",
|
|
70
70
|
"y-protocols": "^1.0.5",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"yjs": "^13.5.40"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
|
-
"@jupyterlab/builder": "^4.0.0-
|
|
75
|
+
"@jupyterlab/builder": "^4.0.0-beta.0",
|
|
76
76
|
"@types/react": "^18.0.27",
|
|
77
77
|
"npm-run-all": "^4.1.5",
|
|
78
78
|
"rimraf": "^4.1.2",
|