##// END OF EJS Templates
Fixing bugs in CodeMirror refreshing.
Brian Granger -
Show More
@@ -82,14 +82,19 b' var IPython = (function (IPython) {'
82 if (this.opened) {
82 if (this.opened) {
83 $('#fulledit_widget').hide();
83 $('#fulledit_widget').hide();
84 $('#main_app').show();
84 $('#main_app').show();
85 // We may need to add a refresh to all CM based cells after
86 // showing them.
85 $('#menubar').show();
87 $('#menubar').show();
86 $('body').css({overflow : 'hidden'});
88 $('body').css({overflow : 'hidden'});
87 var code = this.ace_editor.getSession().getValue();
89 var code = this.ace_editor.getSession().getValue();
88 var cell = IPython.notebook.get_selected_cell();
90 var cell = IPython.notebook.get_selected_cell();
89 if (cell instanceof IPython.CodeCell) {
91 if (cell instanceof IPython.CodeCell) {
92 cell.code_mirror.refresh();
90 cell.set_text(code);
93 cell.set_text(code);
91 } else if (cell instanceof IPython.MarkdownCell || cell instanceof IPython.HTMLCell) {
94 } else if (cell instanceof IPython.MarkdownCell || cell instanceof IPython.HTMLCell) {
92 cell.edit();
95 cell.edit();
96 // If the cell was already in edit mode, we need to refresh/focus.
97 cell.code_mirror.refresh();
93 cell.code_mirror.focus();
98 cell.code_mirror.focus();
94 cell.set_text(code);
99 cell.set_text(code);
95 };
100 };
@@ -550,7 +550,6 b' var IPython = (function (IPython) {'
550 text = '';
550 text = '';
551 };
551 };
552 if (target_cell !== null) {
552 if (target_cell !== null) {
553 //if (text === "") {text = target_cell.placeholder;};
554 // The edit must come before the set_text.
553 // The edit must come before the set_text.
555 target_cell.edit();
554 target_cell.edit();
556 target_cell.set_text(text);
555 target_cell.set_text(text);
@@ -575,7 +574,6 b' var IPython = (function (IPython) {'
575 text = '';
574 text = '';
576 };
575 };
577 if (target_cell !== null) {
576 if (target_cell !== null) {
578 if (text === "") {text = target_cell.placeholder;};
579 // The edit must come before the set_text.
577 // The edit must come before the set_text.
580 target_cell.edit();
578 target_cell.edit();
581 target_cell.set_text(text);
579 target_cell.set_text(text);
@@ -1167,7 +1165,7 b' var IPython = (function (IPython) {'
1167 this.start_kernel();
1165 this.start_kernel();
1168 }
1166 }
1169 this.select(0);
1167 this.select(0);
1170 this.notebook.scroll_to_top();
1168 this.scroll_to_top();
1171 IPython.save_widget.update_url();
1169 IPython.save_widget.update_url();
1172 IPython.layout_manager.do_resize();
1170 IPython.layout_manager.do_resize();
1173 };
1171 };
@@ -100,7 +100,8 b' var IPython = (function (IPython) {'
100 // refresh/focus/refresh, the to_markdown method won't work.
100 // refresh/focus/refresh, the to_markdown method won't work.
101 this.code_mirror.refresh();
101 this.code_mirror.refresh();
102 this.code_mirror.focus();
102 this.code_mirror.focus();
103 this.code_mirror.refresh();
103 // In some wierd cases we seem to need this extra refresh.
104 //this.code_mirror.refresh();
104 this.rendered = false;
105 this.rendered = false;
105 if (this.get_text() === this.placeholder) {
106 if (this.get_text() === this.placeholder) {
106 this.set_text('');
107 this.set_text('');
General Comments 0
You need to be logged in to leave comments. Login now