Skip to content

Commit 8bac302

Browse files
committed
-
1 parent 86f2a78 commit 8bac302

File tree

8 files changed

+13
-181
lines changed

8 files changed

+13
-181
lines changed

packages/collaboration-extension/src/collaboration.ts

Lines changed: 3 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,16 @@ import { ITranslator, nullTranslator, TranslationBundle } from '@jupyterlab/tran
4141

4242
import { Menu, MenuBar } from '@lumino/widgets';
4343

44-
import { IAwareness, ISharedNotebook, ISuggestions, NotebookChange } from '@jupyter/ydoc';
44+
import { IAwareness, ISharedNotebook, NotebookChange } from '@jupyter/ydoc';
4545

4646
import {
4747
CollaboratorsPanel,
48-
SuggestionsPanel,
4948
IGlobalAwareness,
5049
IUserMenu,
5150
remoteUserCursors,
5251
RendererUserMenu,
5352
UserInfoPanel,
54-
UserMenu,
53+
UserMenu
5554
} from '@jupyter/collaboration';
5655

5756
import * as Y from 'yjs';
@@ -148,12 +147,11 @@ export const rtcPanelPlugin: JupyterFrontEndPlugin<void> = {
148147
id: '@jupyter/collaboration-extension:rtcPanel',
149148
description: 'Add side panel to display all currently connected users.',
150149
autoStart: true,
151-
requires: [IGlobalAwareness, ISuggestions],
150+
requires: [IGlobalAwareness],
152151
optional: [ITranslator],
153152
activate: (
154153
app: JupyterFrontEnd,
155154
awareness: Awareness,
156-
suggestions: ISuggestions,
157155
translator: ITranslator | null
158156
): void => {
159157
const { user } = app.serviceManager;
@@ -185,10 +183,6 @@ export const rtcPanelPlugin: JupyterFrontEndPlugin<void> = {
185183
);
186184
collaboratorsPanel.title.label = trans.__('Online Collaborators');
187185
userPanel.addWidget(collaboratorsPanel);
188-
189-
const suggestionsPanel = new SuggestionsPanel(fileopener, suggestions);
190-
suggestionsPanel.title.label = trans.__('Suggestions');
191-
userPanel.addWidget(suggestionsPanel);
192186
}
193187
};
194188

@@ -306,8 +300,6 @@ export class EditingModeExtension implements DocumentRegistry.IWidgetExtension<N
306300
reviewCommands.addCommand('merge', {
307301
label: 'Merge',
308302
execute: () => {
309-
console.log('currentRoomId', context.model.sharedModel.currentRoomId);
310-
console.log('rootRoomId', context.model.sharedModel.rootRoomId);
311303
requestDocMerge(context.model.sharedModel.currentRoomId, context.model.sharedModel.rootRoomId);
312304
}
313305
});
@@ -396,42 +388,3 @@ export class EditingModeExtension implements DocumentRegistry.IWidgetExtension<N
396388
});
397389
}
398390
}
399-
400-
/**
401-
* A plugin to provide shared document suggestions.
402-
*/
403-
export const suggestions: JupyterFrontEndPlugin<ISuggestions> = {
404-
id: '@jupyter/collaboration-extension:rtcGlobalSuggestions',
405-
description: 'A plugin to provide shared document suggestions.',
406-
autoStart: true,
407-
provides: ISuggestions,
408-
activate: (app: JupyterFrontEnd): ISuggestions => {
409-
console.log('suggestions plugin activated');
410-
return new Suggestions();
411-
},
412-
};
413-
414-
export class Suggestions implements ISuggestions {
415-
private _forkIds: string[];
416-
private _callbacks: any[];
417-
418-
constructor() {
419-
this._forkIds = [];
420-
this._callbacks = [];
421-
}
422-
423-
addFork(forkId: string) {
424-
this._forkIds.push(forkId);
425-
for (const callback of this._callbacks) {
426-
callback(forkId);
427-
}
428-
}
429-
430-
addCallback(callback: any) {
431-
this._callbacks.push(callback);
432-
}
433-
434-
get forks(): string[] {
435-
return this._forkIds;
436-
}
437-
}

packages/collaboration-extension/src/filebrowser.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { ITranslator, nullTranslator } from '@jupyterlab/translation';
2424

2525
import { CommandRegistry } from '@lumino/commands';
2626

27-
import { ISuggestions, YFile, YNotebook } from '@jupyter/ydoc';
27+
import { YFile, YNotebook } from '@jupyter/ydoc';
2828

2929
import { ICollaborativeDrive, YDrive } from '@jupyter/docprovider';
3030

@@ -42,15 +42,14 @@ export const drive: JupyterFrontEndPlugin<ICollaborativeDrive> = {
4242
id: '@jupyter/collaboration-extension:drive',
4343
description: 'The default collaborative drive provider',
4444
provides: ICollaborativeDrive,
45-
requires: [ITranslator, ISuggestions],
45+
requires: [ITranslator],
4646
optional: [],
4747
activate: (
4848
app: JupyterFrontEnd,
49-
translator: ITranslator,
50-
suggestions: ISuggestions
49+
translator: ITranslator
5150
): ICollaborativeDrive => {
5251
const trans = translator.load('jupyter_collaboration');
53-
const drive = new YDrive(app.serviceManager.user, trans, suggestions);
52+
const drive = new YDrive(app.serviceManager.user, trans);
5453
app.serviceManager.contents.addDrive(drive);
5554
return drive;
5655
}

packages/collaboration-extension/src/index.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ import {
2020
rtcGlobalAwarenessPlugin,
2121
rtcPanelPlugin,
2222
userEditorCursors,
23-
editingMode,
24-
suggestions
23+
editingMode
2524
} from './collaboration';
2625
import { sharedLink } from './sharedlink';
2726

@@ -40,8 +39,7 @@ const plugins: JupyterFrontEndPlugin<any>[] = [
4039
rtcPanelPlugin,
4140
sharedLink,
4241
userEditorCursors,
43-
editingMode,
44-
suggestions
42+
editingMode
4543
];
4644

4745
export default plugins;

packages/collaboration/src/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
export * from './tokens';
99
export * from './collaboratorspanel';
10-
export * from './suggestionspanel';
11-
//export * from './suggestions';
1210
export * from './cursors';
1311
export * from './menu';
1412
export * from './sharedlink';

packages/collaboration/src/suggestionspanel.tsx

Lines changed: 0 additions & 92 deletions
This file was deleted.

packages/collaboration/src/tokens.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,6 @@ export const IGlobalAwareness = new Token<IAwareness>(
2424
'@jupyter/collaboration:IGlobalAwareness'
2525
);
2626

27-
///**
28-
// * The global suggestions token.
29-
// */
30-
//export const IGlobalSuggestions = new Token<ISuggestions>(
31-
// '@jupyter/collaboration:IGlobalSuggestions'
32-
//);
33-
//
3427
/**
3528
* An interface describing the user menu.
3629
*/

packages/docprovider/src/ydrive.ts

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { PageConfig, URLExt } from '@jupyterlab/coreutils';
55
import { TranslationBundle } from '@jupyterlab/translation';
66
import { Contents, Drive, User } from '@jupyterlab/services';
77

8-
import { DocumentChange, ISharedDocument, YDocument, ISuggestions } from '@jupyter/ydoc';
8+
import { DocumentChange, ISharedDocument, YDocument } from '@jupyter/ydoc';
99

1010
import { WebSocketProvider } from './yprovider';
1111
import {
@@ -14,8 +14,6 @@ import {
1414
SharedDocumentFactory
1515
} from './tokens';
1616

17-
import * as Y from 'yjs';
18-
1917
const DISABLE_RTC =
2018
PageConfig.getOption('disableRTC') === 'true' ? true : false;
2119

@@ -34,12 +32,11 @@ export class YDrive extends Drive implements ICollaborativeDrive {
3432
*
3533
* @param user - The user manager to add the identity to the awareness of documents.
3634
*/
37-
constructor(user: User.IManager, translator: TranslationBundle, suggestions: ISuggestions) {
35+
constructor(user: User.IManager, translator: TranslationBundle) {
3836
super({ name: 'RTC' });
3937
this._user = user;
4038
this._trans = translator;
4139
this._providers = new Map<string, WebSocketProvider>();
42-
this._suggestions = suggestions;
4340

4441
this.sharedModelFactory = new SharedModelFactory(this._onCreate);
4542
}
@@ -129,18 +126,6 @@ export class YDrive extends Drive implements ICollaborativeDrive {
129126
return super.save(localPath, options);
130127
}
131128

132-
private _handleForks = (event: Y.YMapEvent<string>) => {
133-
const forkPrefix = 'fork_';
134-
event.changes.keys.forEach((change, key) => {
135-
if (change.action === 'add') {
136-
if (key.startsWith(forkPrefix)) {
137-
const forkId = key.slice(forkPrefix.length);
138-
this._suggestions.addFork(forkId);
139-
}
140-
}
141-
});
142-
};
143-
144129
private _onCreate = (
145130
options: Contents.ISharedFactoryOptions,
146131
sharedModel: YDocument<DocumentChange>
@@ -162,7 +147,6 @@ export class YDrive extends Drive implements ICollaborativeDrive {
162147
const key = `${options.format}:${options.contentType}:${options.path}`;
163148
this._providers.set(key, provider);
164149

165-
sharedModel.ystate.observe(this._handleForks);
166150
sharedModel.provider = provider;
167151
sharedModel.disposed.connect(() => {
168152
const provider = this._providers.get(key);
@@ -183,7 +167,6 @@ export class YDrive extends Drive implements ICollaborativeDrive {
183167
private _user: User.IManager;
184168
private _trans: TranslationBundle;
185169
private _providers: Map<string, WebSocketProvider>;
186-
private _suggestions: ISuggestions;
187170
}
188171

189172
/**

yarn.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2156,7 +2156,7 @@ __metadata:
21562156

21572157
"@jupyter/ydoc@file:.yalc/@jupyter/ydoc::locator=%40jupyter%2Freal-time-collaboration%40workspace%3A.":
21582158
version: 2.0.1
2159-
resolution: "@jupyter/ydoc@file:.yalc/@jupyter/ydoc#.yalc/@jupyter/ydoc::hash=7b1261&locator=%40jupyter%2Freal-time-collaboration%40workspace%3A."
2159+
resolution: "@jupyter/ydoc@file:.yalc/@jupyter/ydoc#.yalc/@jupyter/ydoc::hash=63b59a&locator=%40jupyter%2Freal-time-collaboration%40workspace%3A."
21602160
dependencies:
21612161
"@jupyterlab/application": ^4.0.0
21622162
"@jupyterlab/nbformat": ^3.0.0 || ^4.0.0-alpha.21 || ^4.0.0
@@ -2165,7 +2165,7 @@ __metadata:
21652165
"@lumino/signaling": ^1.10.0 || ^2.0.0
21662166
y-protocols: ^1.0.5
21672167
yjs: ^13.5.40
2168-
checksum: c1f8d5c6854f5854b2754200be67f117586736c08deb5edc6dc7ce419d734d8797e0d009554479ab340ac02cf94f6bd60cce0186f2d1e2df8097a6b9c607b14c
2168+
checksum: 9e034badb962ea9d26e8ed279feb7fb85130d11920841e8cdeb930586c23c1b27071a32bf78211043c6dcc1f303736e3abe11f2bfc33cfbc024a2f2cf8e7bd2f
21692169
languageName: node
21702170
linkType: hard
21712171

0 commit comments

Comments
 (0)