@jupyter/ydoc
Advanced tools
Comparing version 3.0.0-a2 to 3.0.0-a3
@@ -417,2 +417,3 @@ /** | ||
} | ||
export type IExecutionState = 'running' | 'idle'; | ||
/** | ||
@@ -431,2 +432,6 @@ * Implements an API for nbformat.ICodeCell. | ||
/** | ||
* The code cell's execution state. | ||
*/ | ||
executionState: IExecutionState; | ||
/** | ||
* Cell outputs | ||
@@ -637,2 +642,9 @@ */ | ||
/** | ||
* Cell execution state change | ||
*/ | ||
executionStateChange?: { | ||
oldValue?: IExecutionState; | ||
newValue?: IExecutionState; | ||
}; | ||
/** | ||
* Cell metadata change | ||
@@ -639,0 +651,0 @@ */ |
@@ -6,3 +6,3 @@ import type * as nbformat from '@jupyterlab/nbformat'; | ||
import * as Y from 'yjs'; | ||
import type { CellChange, IMapChange, ISharedAttachmentsCell, ISharedBaseCell, ISharedCodeCell, ISharedMarkdownCell, ISharedRawCell, SharedCell } from './api.js'; | ||
import type { CellChange, IExecutionState, IMapChange, ISharedAttachmentsCell, ISharedBaseCell, ISharedCodeCell, ISharedMarkdownCell, ISharedRawCell, SharedCell } from './api.js'; | ||
import { IYText } from './ytext.js'; | ||
@@ -273,2 +273,7 @@ import { YNotebook } from './ynotebook.js'; | ||
/** | ||
* The code cell's execution state. | ||
*/ | ||
get executionState(): IExecutionState; | ||
set executionState(state: IExecutionState); | ||
/** | ||
* Cell outputs. | ||
@@ -275,0 +280,0 @@ */ |
@@ -617,2 +617,16 @@ /* ----------------------------------------------------------------------------- | ||
/** | ||
* The code cell's execution state. | ||
*/ | ||
get executionState() { | ||
var _a; | ||
return (_a = this.ymodel.get('execution_state')) !== null && _a !== void 0 ? _a : 'idle'; | ||
} | ||
set executionState(state) { | ||
if (this.ymodel.get('execution_state') !== state) { | ||
this.transact(() => { | ||
this.ymodel.set('execution_state', state); | ||
}, false); | ||
} | ||
} | ||
/** | ||
* Cell outputs. | ||
@@ -742,2 +756,9 @@ */ | ||
} | ||
if (modelEvent && modelEvent.keysChanged.has('execution_state')) { | ||
const change = modelEvent.changes.keys.get('execution_state'); | ||
changes.executionStateChange = { | ||
oldValue: change.oldValue, | ||
newValue: this.ymodel.get('execution_state') | ||
}; | ||
} | ||
return changes; | ||
@@ -744,0 +765,0 @@ } |
{ | ||
"name": "@jupyter/ydoc", | ||
"version": "3.0.0-a2", | ||
"version": "3.0.0-a3", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "description": "Jupyter document structures for collaborative editing using YJS", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
138901
3175