-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Description
The public API does not expose ymodel nor propagate the cell ID changes.
jupyter_ydoc/javascript/src/ycell.ts
Lines 367 to 369 in 7234533
| getId(): string { | |
| return this.ymodel.get('id'); | |
| } |
jupyter_ydoc/javascript/src/ycell.ts
Line 190 in 7234533
| this.ymodel.observeDeep(this._modelObserver); |
jupyter_ydoc/javascript/src/ycell.ts
Lines 570 to 625 in 7234533
| protected getChanges(events: Y.YEvent<any>[]): Partial<CellChange> { | |
| const changes: CellChange = {}; | |
| const sourceEvent = events.find( | |
| event => event.target === this.ymodel.get('source') | |
| ); | |
| if (sourceEvent) { | |
| changes.sourceChange = sourceEvent.changes.delta as any; | |
| } | |
| const metadataEvents = events.find( | |
| event => event.target === this._ymetadata | |
| ); | |
| if (metadataEvents) { | |
| changes.metadataChange = metadataEvents.changes.keys; | |
| metadataEvents.changes.keys.forEach((change, key) => { | |
| switch (change.action) { | |
| case 'add': | |
| this._metadataChanged.emit({ | |
| key, | |
| newValue: this._ymetadata.get(key), | |
| type: 'add' | |
| }); | |
| break; | |
| case 'delete': | |
| this._metadataChanged.emit({ | |
| key, | |
| oldValue: change.oldValue, | |
| type: 'remove' | |
| }); | |
| break; | |
| case 'update': | |
| { | |
| const newValue = this._ymetadata.get(key); | |
| const oldValue = change.oldValue; | |
| let equal = true; | |
| if (typeof oldValue == 'object' && typeof newValue == 'object') { | |
| equal = JSONExt.deepEqual(oldValue, newValue); | |
| } else { | |
| equal = oldValue === newValue; | |
| } | |
| if (!equal) { | |
| this._metadataChanged.emit({ | |
| key, | |
| type: 'change', | |
| oldValue, | |
| newValue | |
| }); | |
| } | |
| } | |
| break; | |
| } | |
| }); | |
| } |
There is also no way to listen to cell_type changes. If we assume that either or both are immutable then we should document it.
This came up in jupyterlab/jupyterlab#18101.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working