Hi guys,
for my add on project I need to track all the changes in a notebook and, depending on the changes, performing some actions.
I managed to track text changes in the active cell with the on(“change”) method of codemirror:
notebook.activeCellChanged.connect(() => {
(<CodeMirrorEditor>currentCell.editor).editor.on("change", changeHandler);
});
in changeHandler
I’m able to analyze the change object.
Trying to handle the changes in the model in general (cells added/removed, cell type changed, cell executed, text in cell changed), I’ve found the modelContentChanged
property of the notebook object, which is fired exactly every time I need it. My problem is that I can’t find how to know in what the change consists.
For example I can save the number of cells in a variable and after the event is fired I can check if the number is still the same or not, but in that case I don’t know how to find out which cell has been removed or where it has been inserted.
I hope I’ve explained the problem clear enough,
thanks,
Lorenzo