I have a notebook cell containing JavaScript code, and I would like the code to select this particular cell. Unfortunately, the behavior of get_selected_cell depends on whether I execute the cell in place, or execute and select the cell below.
Example:
%%javascript
var cell = Jupyter.notebook.get_selected_cell();
console.log(Jupyter.notebook.find_cell_index(cell));
When executing this cell, the console output will be different whether I execute with Ctrl+Enter or Shift+Enter. In one case it logs the index of the cell that contains the JavaScript code, in the other the index of the cell below.
Is there a way to select the cell I want?
selected_cellmeans the one that is selected in the UI. Inside Javascript added to the output area of a cell,thisis the output area. I can't currently find a way back from that to the cell it belongs to, though.