Hello Tony,
I am currently working on a project doing something similar where I iterate over the entire notebooks cells to check for a certain key on the cells metadata.
Firstly I am importing LabShell and NotebookPanel
Then inside my plugin I do:
const labShell = app.shell as LabShell;
labShell.currentChanged.connect(() => {
const notebook = app.shell.currentWidget as NotebookPanel;
const cellList = notebook.content.model.cells;
for (const cell of cellList) {
console.log('METADATA: ', cell.metadata)
}
});
The LabShell part is to detect when users switch between notebooks or open a new notebook.
Hopefully this is enough to get you started. If you have any questions please let me know.
– Luke