@@ -7,7 +7,6 @@ import { TranslationBundle } from '@jupyterlab/translation';
77import {
88 Contents ,
99 IContentProvider ,
10- RestContentProvider ,
1110 SharedDocumentFactory ,
1211 User
1312} from '@jupyterlab/services' ;
@@ -21,26 +20,24 @@ import {
2120} from '@jupyter/collaborative-drive' ;
2221
2322namespace RtcContentProvider {
24- export interface IOptions extends RestContentProvider . IOptions {
23+ export interface IOptions {
24+ currentDrive : Contents . IDrive ;
2525 user : User . IManager ;
2626 trans : TranslationBundle ;
2727 }
2828}
2929
30- export class RtcContentProvider
31- extends RestContentProvider
32- implements IContentProvider
33- {
30+ export class RtcContentProvider implements IContentProvider {
3431 /**
3532 * Construct a new drive object.
3633 *
3734 * @param user - The user manager to add the identity to the awareness of documents.
3835 */
3936 constructor ( app : JupyterFrontEnd , options : RtcContentProvider . IOptions ) {
40- super ( options ) ;
4137 this . _app = app ;
4238 this . _user = options . user ;
4339 this . _trans = options . trans ;
40+ this . _currentDrive = options . currentDrive ;
4441 this . _providers = new Map < string , MyProvider > ( ) ;
4542 this . sharedModelFactory = new SharedModelFactory ( this . _onCreate ) ;
4643 this . _saveLock = new AsyncLock ( ) ;
@@ -80,7 +77,11 @@ export class RtcContentProvider
8077 // Use `Promise.all` to reject as soon as possible. The Context will
8178 // show a dialog to the user.
8279 const [ model ] = await Promise . all ( [
83- super . get ( localPath , { ...options , content : false } ) ,
80+ this . _currentDrive . get ( localPath , {
81+ ...options ,
82+ content : false ,
83+ contentProviderId : undefined
84+ } ) ,
8485 provider . ready
8586 ] ) ;
8687 // The server doesn't return a model with a format when content is false,
@@ -89,7 +90,10 @@ export class RtcContentProvider
8990 }
9091 }
9192
92- return await super . get ( localPath , options ) ;
93+ return await this . _currentDrive . get ( localPath , {
94+ ...options ,
95+ contentProviderId : undefined
96+ } ) ;
9397 }
9498
9599 async listCheckpoints ( path : string ) : Promise < Contents . ICheckpointModel [ ] > {
@@ -132,7 +136,7 @@ export class RtcContentProvider
132136 */
133137 async save (
134138 localPath : string ,
135- options : Partial < Contents . IModel > = { }
139+ options : Partial < Contents . IModel > & Contents . IContentProvisionOptions = { }
136140 ) : Promise < Contents . IModel > {
137141 // Check that there is a provider - it won't e.g. if the document model is not collaborative.
138142 if ( options . format && options . type ) {
@@ -150,7 +154,10 @@ export class RtcContentProvider
150154 }
151155 }
152156
153- return await super . save ( localPath , options ) ;
157+ return await this . _currentDrive . save ( localPath , {
158+ ...options ,
159+ contentProviderId : undefined
160+ } ) ;
154161 }
155162
156163 /**
@@ -254,6 +261,7 @@ export class RtcContentProvider
254261 return sharedModel ;
255262 } ;
256263
264+ private _currentDrive : Contents . IDrive ;
257265 private _app : JupyterFrontEnd ;
258266 private _user : User . IManager ;
259267 private _trans : TranslationBundle ;
0 commit comments