mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-30 06:11:38 +00:00
Initial Move from Azure DevOps to GitHub
This commit is contained in:
22
src/Explorer/Notebook/NTeractUtil.ts
Normal file
22
src/Explorer/Notebook/NTeractUtil.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { NotebookContentRecordProps, selectors } from "@nteract/core";
|
||||
|
||||
/**
|
||||
* A bunch of utilities to interact with nteract
|
||||
*/
|
||||
export default class NTeractUtil {
|
||||
public static getCurrentCellType(content: NotebookContentRecordProps): "markdown" | "code" | "raw" {
|
||||
if (!content) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const cellFocusedId = selectors.notebook.cellFocused(content.model);
|
||||
if (cellFocusedId) {
|
||||
const cell = selectors.notebook.cellById(content.model, { id: cellFocusedId });
|
||||
if (cell) {
|
||||
return cell.cell_type;
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user