##// END OF EJS Templates
Merge pull request #4929 from ellisonbg/modal-fixes...
Min RK -
r14980:9b8c058d merge
parent child Browse files
Show More
@@ -288,8 +288,16 b' var IPython = (function (IPython) {'
288 * @method focus_editor
288 * @method focus_editor
289 */
289 */
290 Cell.prototype.focus_editor = function () {
290 Cell.prototype.focus_editor = function () {
291 var that = this;
291 this.refresh();
292 this.refresh();
292 this.code_mirror.focus();
293 // Only focus the CM editor if it is not focused already. This prevents jumps
294 // related to the previous prompt position.
295 setTimeout(function () {
296 var isf = IPython.utils.is_focused;
297 if (!isf(that.element.find('div.CodeMirror'))) {
298 that.code_mirror.focus();
299 }
300 }, 1);
293 }
301 }
294
302
295 /**
303 /**
@@ -740,18 +740,15 b' var IPython = (function (IPython) {'
740 KeyboardManager.prototype.register_events = function (e) {
740 KeyboardManager.prototype.register_events = function (e) {
741 var that = this;
741 var that = this;
742 e.on('focusin', function () {
742 e.on('focusin', function () {
743 that.command_mode();
744 that.disable();
743 that.disable();
745 });
744 });
746 e.on('focusout', function () {
745 e.on('focusout', function () {
747 that.command_mode();
748 that.enable();
746 that.enable();
749 });
747 });
750 // There are times (raw_input) where we remove the element from the DOM before
748 // There are times (raw_input) where we remove the element from the DOM before
751 // focusout is called. In this case we bind to the remove event of jQueryUI,
749 // focusout is called. In this case we bind to the remove event of jQueryUI,
752 // which gets triggered upon removal.
750 // which gets triggered upon removal.
753 e.on('remove', function () {
751 e.on('remove', function () {
754 that.command_mode();
755 that.enable();
752 that.enable();
756 });
753 });
757 }
754 }
@@ -83,13 +83,20 b''
83 console.error("View creation failed", model);
83 console.error("View creation failed", model);
84 }
84 }
85 if (cell.widget_subarea) {
85 if (cell.widget_subarea) {
86
87 cell.widget_area.show();
86 cell.widget_area.show();
87 this._handle_display_view(view);
88 cell.widget_subarea.append(view.$el);
88 cell.widget_subarea.append(view.$el);
89 }
89 }
90 }
90 }
91 };
91 };
92
92
93 WidgetManager.prototype._handle_display_view = function (view) {
94 // Have the IPython keyboard manager disable its event
95 // handling so the widget can capture keyboard input.
96 // Note, this is only done on the outer most widget.
97 IPython.keyboard_manager.register_events(view.$el);
98 };
99
93 WidgetManager.prototype.create_view = function(model, options, view) {
100 WidgetManager.prototype.create_view = function(model, options, view) {
94 // Creates a view for a particular model.
101 // Creates a view for a particular model.
95 var view_name = model.get('_view_name');
102 var view_name = model.get('_view_name');
@@ -109,24 +116,11 b''
109 view.render();
116 view.render();
110 model.views.push(view);
117 model.views.push(view);
111 model.on('destroy', view.remove, view);
118 model.on('destroy', view.remove, view);
112
113 this._handle_new_view(view);
114 return view;
119 return view;
115 }
120 }
116 return null;
121 return null;
117 };
122 };
118
123
119 WidgetManager.prototype._handle_new_view = function (view) {
120 // Called when a view has been created and rendered.
121
122 // If the view has a well defined element, inform the keyboard
123 // manager about the view's element, so as the element can
124 // escape the dreaded command mode.
125 if (view.$el) {
126 IPython.keyboard_manager.register_events(view.$el);
127 }
128 };
129
130 WidgetManager.prototype.get_msg_cell = function (msg_id) {
124 WidgetManager.prototype.get_msg_cell = function (msg_id) {
131 var cell = null;
125 var cell = null;
132 // First, check to see if the msg was triggered by cell execution.
126 // First, check to see if the msg was triggered by cell execution.
General Comments 0
You need to be logged in to leave comments. Login now