diff --git a/packages/jupyterlab-fonts/src/labcompat.ts b/packages/jupyterlab-fonts/src/labcompat.ts index b844365a..05893246 100644 --- a/packages/jupyterlab-fonts/src/labcompat.ts +++ b/packages/jupyterlab-fonts/src/labcompat.ts @@ -69,3 +69,16 @@ export function setCellMetadata(cellModel: ICellModel, key: string, value: any): console.error('cell', cellModel); throw new Error('no metadata for cell'); } + +export function deleteMetadata(cellModel: ICellModel, key: string): void { + if (typeof cellModel.metadata.delete === 'function') { + return (cellModel as any).metadata.delete(key); + } + + if (cellModel.sharedModel) { + return cellModel.sharedModel.deleteMetadata(key); + } + + console.error('cell', cellModel); + throw new Error('no metadata for cell'); +}