diff --git a/IPython/frontend/html/notebook/static/js/fulleditwidget.js b/IPython/frontend/html/notebook/static/js/fulleditwidget.js index a37b932..546f849 100644 --- a/IPython/frontend/html/notebook/static/js/fulleditwidget.js +++ b/IPython/frontend/html/notebook/static/js/fulleditwidget.js @@ -82,14 +82,19 @@ var IPython = (function (IPython) { if (this.opened) { $('#fulledit_widget').hide(); $('#main_app').show(); + // We may need to add a refresh to all CM based cells after + // showing them. $('#menubar').show(); $('body').css({overflow : 'hidden'}); var code = this.ace_editor.getSession().getValue(); var cell = IPython.notebook.get_selected_cell(); if (cell instanceof IPython.CodeCell) { + cell.code_mirror.refresh(); cell.set_text(code); } else if (cell instanceof IPython.MarkdownCell || cell instanceof IPython.HTMLCell) { cell.edit(); + // If the cell was already in edit mode, we need to refresh/focus. + cell.code_mirror.refresh(); cell.code_mirror.focus(); cell.set_text(code); }; diff --git a/IPython/frontend/html/notebook/static/js/notebook.js b/IPython/frontend/html/notebook/static/js/notebook.js index b1fb9f3..b4a67fb 100644 --- a/IPython/frontend/html/notebook/static/js/notebook.js +++ b/IPython/frontend/html/notebook/static/js/notebook.js @@ -550,7 +550,6 @@ var IPython = (function (IPython) { text = ''; }; if (target_cell !== null) { - //if (text === "") {text = target_cell.placeholder;}; // The edit must come before the set_text. target_cell.edit(); target_cell.set_text(text); @@ -575,7 +574,6 @@ var IPython = (function (IPython) { text = ''; }; if (target_cell !== null) { - if (text === "") {text = target_cell.placeholder;}; // The edit must come before the set_text. target_cell.edit(); target_cell.set_text(text); @@ -1167,7 +1165,7 @@ var IPython = (function (IPython) { this.start_kernel(); } this.select(0); - this.notebook.scroll_to_top(); + this.scroll_to_top(); IPython.save_widget.update_url(); IPython.layout_manager.do_resize(); }; diff --git a/IPython/frontend/html/notebook/static/js/textcell.js b/IPython/frontend/html/notebook/static/js/textcell.js index c5421b8..eb8bdbf 100644 --- a/IPython/frontend/html/notebook/static/js/textcell.js +++ b/IPython/frontend/html/notebook/static/js/textcell.js @@ -100,7 +100,8 @@ var IPython = (function (IPython) { // refresh/focus/refresh, the to_markdown method won't work. this.code_mirror.refresh(); this.code_mirror.focus(); - this.code_mirror.refresh(); + // In some wierd cases we seem to need this extra refresh. + //this.code_mirror.refresh(); this.rendered = false; if (this.get_text() === this.placeholder) { this.set_text('');