Show More
@@ -141,10 +141,7 b' define(["../../components/underscore/underscore-min.js",' | |||||
141 | var method = msg.content.data.method; |
|
141 | var method = msg.content.data.method; | |
142 | switch (method){ |
|
142 | switch (method){ | |
143 | case 'display': |
|
143 | case 'display': | |
144 |
|
144 | var cell_index = this._get_cell_index(msg.parent_header.msg_id); | ||
145 | ////////////////////////// TODO: Get cell index via currently executing cell. |
|
|||
146 | var cell_index = IPython.notebook.get_selected_index()-1; |
|
|||
147 |
|
||||
148 | this.display_view(msg.content.data.view_name, |
|
145 | this.display_view(msg.content.data.view_name, | |
149 | msg.content.data.parent, |
|
146 | msg.content.data.parent, | |
150 | cell_index); |
|
147 | cell_index); | |
@@ -262,15 +259,27 b' define(["../../components/underscore/underscore-min.js",' | |||||
262 | }, |
|
259 | }, | |
263 |
|
260 | |||
264 |
|
261 | |||
|
262 | // Get the cell index corresponding to the msg_id. | |||
|
263 | _get_cell_index: function (msg_id) { | |||
|
264 | var cells = IPython.notebook.get_cells(); | |||
|
265 | for (cell_index in cells) { | |||
|
266 | if (cells[cell_index].last_msg_id == msg_id) { | |||
|
267 | return cell_index; | |||
|
268 | } | |||
|
269 | } | |||
|
270 | return -1; | |||
|
271 | }, | |||
|
272 | ||||
|
273 | ||||
265 | // Get the cell output area corresponding to the view. |
|
274 | // Get the cell output area corresponding to the view. | |
266 | _get_view_output_area: function (view) { |
|
275 | _get_view_output_area: function (view) { | |
267 | return this._get_cell_output_area(view.cell_index); |
|
276 | return this._get_cell_output_area(view.cell_index); | |
268 | }, |
|
277 | }, | |
269 |
|
278 | |||
270 |
|
279 | |||
271 | // Get the cell output area corresponding to the cell id. |
|
280 | // Get the cell output area corresponding to the cell index. | |
272 | _get_cell_output_area: function (cell_id) { |
|
281 | _get_cell_output_area: function (cell_index) { | |
273 | var cell = IPython.notebook.get_cell(cell_id) |
|
282 | var cell = IPython.notebook.get_cell(cell_index) | |
274 | return cell.output_area; |
|
283 | return cell.output_area; | |
275 | }, |
|
284 | }, | |
276 | }); |
|
285 | }); |
General Comments 0
You need to be logged in to leave comments.
Login now