@jupyter/docprovider-extension 3.0.0 → 3.1.0-alpha.0

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.
@@ -105,21 +105,23 @@ export const statusBarTimeline = {
105
105
  let sliderItem = null;
106
106
  let timelineWidget = null;
107
107
  const updateTimelineForDocument = async (documentPath, documentId) => {
108
- if (drive) {
109
- // Remove 'RTC:' from document path
110
- documentPath = documentPath.slice(drive.name.length + 1);
111
- // Dispose of the previous timelineWidget if it exists
112
- if (timelineWidget) {
113
- timelineWidget.dispose();
114
- timelineWidget = null;
115
- }
116
- const [format, type] = documentId.split(':');
117
- const provider = drive.providers.get(`${format}:${type}:${documentPath}`);
118
- const fullPath = URLExt.join(app.serviceManager.serverSettings.baseUrl, DOCUMENT_TIMELINE_URL, documentPath);
119
- timelineWidget = new TimelineWidget(fullPath, provider, provider.contentType, provider.format);
120
- const elt = document.getElementById('jp-slider-status-bar');
121
- if (elt && !timelineWidget.isAttached) {
122
- Widget.attach(timelineWidget, elt);
108
+ if (documentId && documentPath.split(':')[0] === 'RTC') {
109
+ if (drive) {
110
+ // Remove 'RTC:' from document path
111
+ documentPath = documentPath.slice(drive.name.length + 1);
112
+ // Dispose of the previous timelineWidget if it exists
113
+ if (timelineWidget) {
114
+ timelineWidget.dispose();
115
+ timelineWidget = null;
116
+ }
117
+ const [format, type] = documentId.split(':');
118
+ const provider = drive.providers.get(`${format}:${type}:${documentPath}`);
119
+ const fullPath = URLExt.join(app.serviceManager.serverSettings.baseUrl, DOCUMENT_TIMELINE_URL, documentPath);
120
+ timelineWidget = new TimelineWidget(fullPath, provider, provider.contentType, provider.format, DOCUMENT_TIMELINE_URL);
121
+ const elt = document.getElementById('jp-slider-status-bar');
122
+ if (elt && !timelineWidget.isAttached) {
123
+ Widget.attach(timelineWidget, elt);
124
+ }
123
125
  }
124
126
  }
125
127
  };
@@ -148,8 +150,16 @@ export const statusBarTimeline = {
148
150
  align: 'left',
149
151
  rank: 4,
150
152
  isActive: () => {
151
- const currentWidget = app.shell.currentWidget;
152
- return !!currentWidget && 'context' in currentWidget;
153
+ const currentWidget = app.shell
154
+ .currentWidget;
155
+ if (currentWidget &&
156
+ currentWidget.context &&
157
+ typeof currentWidget.context.path === 'string') {
158
+ const documentPath = currentWidget.context.path;
159
+ const documentId = currentWidget.context.model.sharedModel.getState('document_id');
160
+ return !!documentId && documentPath.split(':')[0] === 'RTC';
161
+ }
162
+ return false;
153
163
  }
154
164
  });
155
165
  }
@@ -0,0 +1,3 @@
1
+ import { IForkManager } from '@jupyter/docprovider';
2
+ import { JupyterFrontEndPlugin } from '@jupyterlab/application';
3
+ export declare const forkManagerPlugin: JupyterFrontEndPlugin<IForkManager>;
@@ -0,0 +1,17 @@
1
+ /*
2
+ * Copyright (c) Jupyter Development Team.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ import { ICollaborativeDrive } from '@jupyter/collaborative-drive';
6
+ import { ForkManager, IForkManagerToken } from '@jupyter/docprovider';
7
+ export const forkManagerPlugin = {
8
+ id: '@jupyter/docprovider-extension:forkManager',
9
+ autoStart: true,
10
+ requires: [ICollaborativeDrive],
11
+ provides: IForkManagerToken,
12
+ activate: (app, drive) => {
13
+ const eventManager = app.serviceManager.events;
14
+ const manager = new ForkManager({ drive, eventManager });
15
+ return manager;
16
+ }
17
+ };
package/lib/index.js CHANGED
@@ -6,6 +6,7 @@
6
6
  */
7
7
  import { drive, yfile, ynotebook, defaultFileBrowser, logger, statusBarTimeline } from './filebrowser';
8
8
  import { notebookCellExecutor } from './executor';
9
+ import { forkManagerPlugin } from './forkManager';
9
10
  /**
10
11
  * Export the plugins as default.
11
12
  */
@@ -16,6 +17,7 @@ const plugins = [
16
17
  defaultFileBrowser,
17
18
  logger,
18
19
  notebookCellExecutor,
19
- statusBarTimeline
20
+ statusBarTimeline,
21
+ forkManagerPlugin
20
22
  ];
21
23
  export default plugins;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupyter/docprovider-extension",
3
- "version": "3.0.0",
3
+ "version": "3.1.0-alpha.0",
4
4
  "description": "JupyterLab - Collaborative Shared Models",
5
5
  "keywords": [
6
6
  "jupyter",
@@ -53,8 +53,8 @@
53
53
  "watch:labextension": "jupyter labextension watch ."
54
54
  },
55
55
  "dependencies": {
56
- "@jupyter/collaborative-drive": "^3.0.0",
57
- "@jupyter/docprovider": "^3.0.0",
56
+ "@jupyter/collaborative-drive": "^3.1.0-alpha.0",
57
+ "@jupyter/docprovider": "^3.1.0-alpha.0",
58
58
  "@jupyter/ydoc": "^2.0.0 || ^3.0.0",
59
59
  "@jupyterlab/application": "^4.2.0",
60
60
  "@jupyterlab/apputils": "^4.2.0",