Skip to content

Commit

Permalink
Add rootRoomId and currentRoomId attributes to shared document
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbrochart committed Mar 7, 2024
1 parent 7f6d9d4 commit cff42e1
Show file tree
Hide file tree
Showing 4 changed files with 2,376 additions and 1,710 deletions.
1 change: 1 addition & 0 deletions javascript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"watch": "tsc -b --watch"
},
"dependencies": {
"@jupyterlab/application": "^4.0.0",
"@jupyterlab/nbformat": "^3.0.0 || ^4.0.0-alpha.21 || ^4.0.0",
"@lumino/coreutils": "^1.11.0 || ^2.0.0",
"@lumino/disposable": "^1.10.0 || ^2.0.0",
Expand Down
9 changes: 7 additions & 2 deletions javascript/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,14 @@ export interface ISharedDocument extends ISharedBase {
addFork(forkId: string): void;

/**
* The document room ID
* The document root room ID
*/
roomId: string;
rootRoomId: string;

/**
* The document current room ID
*/
currentRoomId: string;
}

/**
Expand Down
15 changes: 11 additions & 4 deletions javascript/src/ydocument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ export abstract class YDocument<T extends DocumentChange>
{
constructor(options?: YDocument.IOptions) {
this._ydoc = options?.ydoc ?? new Y.Doc();
this.roomId = options?.roomId ?? '';
this.rootRoomId = options?.rootRoomId ?? '';
this.currentRoomId = options?.currentRoomId ?? ''

this._ystate = this._ydoc.getMap('state');

Expand Down Expand Up @@ -217,7 +218,8 @@ export abstract class YDocument<T extends DocumentChange>
private _isDisposed = false;
private _disposed = new Signal<this, void>(this);
private _provider: IDocumentProvider;
public roomId: string;
public rootRoomId: string;
public currentRoomId: string;
}

/**
Expand All @@ -234,8 +236,13 @@ export namespace YDocument {
ydoc?: Y.Doc;

/**
* The document room ID, defaults to ''.
* The document root room ID, defaults to ''.
*/
roomId?: string;
rootRoomId?: string;

/**
* The document current room ID, defaults to ''.
*/
currentRoomId?: string;
}
}
Loading

0 comments on commit cff42e1

Please sign in to comment.