Tracking when cells are edited, but not executed

41 views
Skip to first unread message

Adam Rule

unread,
Apr 27, 2017, 11:25:47 AM4/27/17
to Project Jupyter
I'm working on a notebook + server extension that keeps a detailed history of notebook edits. I would like to track changes that occur when users edit a cell, but don't execute it. I'm looking for an event that gets triggered (or a function that gets called) after a user navigates away from a cell so that I can check if the cell's input has changed.

My current method is to patch `Cell.prototype.unselect` with tracking code, but this function is called as a part of other actions, like copy-paste, that I am tracking in other ways. I have also tried `Notebook.prototype.select` and listening for the event `select.Cell` but these also get called more frequently than I would like. I've also tried listening to the cell's on change events but these get fired for every character that is typed. I'd like to look for changes only once users navigate away from the cell.

Is there a more targeted way to track these cell edits?

MinRK

unread,
May 3, 2017, 8:32:56 AM5/3/17
to Project Jupyter

The editors are codemirror, so you can track the ‘change’ CodeMirror events for this. You would need to also track the creation of new cells in order to connect to the events of each CM instance, I suspect.

-Min

--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+unsubscribe@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/3fe3bfbf-9a69-4f72-a884-be49ec2ce221%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Adam Rule

unread,
May 3, 2017, 11:20:43 AM5/3/17
to Project Jupyter
Wonderful. Thanks!


On Wednesday, May 3, 2017 at 5:32:56 AM UTC-7, Min RK wrote:

The editors are codemirror, so you can track the ‘change’ CodeMirror events for this. You would need to also track the creation of new cells in order to connect to the events of each CM instance, I suspect.

-Min

On Thu, Apr 27, 2017 at 5:25 PM, Adam Rule <acr...@gmail.com> wrote:

I'm working on a notebook + server extension that keeps a detailed history of notebook edits. I would like to track changes that occur when users edit a cell, but don't execute it. I'm looking for an event that gets triggered (or a function that gets called) after a user navigates away from a cell so that I can check if the cell's input has changed.

My current method is to patch `Cell.prototype.unselect` with tracking code, but this function is called as a part of other actions, like copy-paste, that I am tracking in other ways. I have also tried `Notebook.prototype.select` and listening for the event `select.Cell` but these also get called more frequently than I would like. I've also tried listening to the cell's on change events but these get fired for every character that is typed. I'd like to look for changes only once users navigate away from the cell.

Is there a more targeted way to track these cell edits?

--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages