##// END OF EJS Templates
Remove all should cancel blur logic.
Jonathan Frederic -
Show More
@@ -146,10 +146,7 b' var IPython = (function (IPython) {'
146 }
146 }
147 if (this.code_mirror) {
147 if (this.code_mirror) {
148 this.code_mirror.on('blur', function(cm, change) {
148 this.code_mirror.on('blur', function(cm, change) {
149 // Check if this unfocus event is legit.
149 $([IPython.events]).trigger('command_mode.Cell', {cell: that});
150 if (!that.should_cancel_blur()) {
151 $([IPython.events]).trigger('command_mode.Cell', {cell: that});
152 }
153 });
150 });
154 }
151 }
155 };
152 };
@@ -260,18 +257,7 b' var IPython = (function (IPython) {'
260 return false;
257 return false;
261 }
258 }
262 };
259 };
263
260
264 /**
265 * Determine whether or not the unfocus event should be aknowledged.
266 *
267 * @method should_cancel_blur
268 *
269 * @return results {bool} Whether or not to ignore the cell's blur event.
270 **/
271 Cell.prototype.should_cancel_blur = function () {
272 return false;
273 };
274
275 /**
261 /**
276 * Focus the cell in the DOM sense
262 * Focus the cell in the DOM sense
277 * @method focus_cell
263 * @method focus_cell
@@ -402,21 +402,6 b' var IPython = (function (IPython) {'
402 return false;
402 return false;
403 };
403 };
404
404
405 /**
406 * Determine whether or not the unfocus event should be aknowledged.
407 *
408 * @method should_cancel_blur
409 *
410 * @return results {bool} Whether or not to ignore the cell's blur event.
411 **/
412 CodeCell.prototype.should_cancel_blur = function () {
413 // Cancel this unfocus event if the base wants to cancel or the cell
414 // completer is open or the tooltip is open.
415 return IPython.Cell.prototype.should_cancel_blur.apply(this) ||
416 (this.completer && this.completer.was_shown()) ||
417 (IPython.tooltip && IPython.tooltip.was_shown());
418 };
419
420 CodeCell.prototype.select_all = function () {
405 CodeCell.prototype.select_all = function () {
421 var start = {line: 0, ch: 0};
406 var start = {line: 0, ch: 0};
422 var nlines = this.code_mirror.lineCount();
407 var nlines = this.code_mirror.lineCount();
@@ -74,7 +74,6 b' var IPython = (function (IPython) {'
74
74
75 var Completer = function (cell) {
75 var Completer = function (cell) {
76 this._visible = false;
76 this._visible = false;
77 this._shown = false;
78 this.cell = cell;
77 this.cell = cell;
79 this.editor = cell.code_mirror;
78 this.editor = cell.code_mirror;
80 var that = this;
79 var that = this;
@@ -91,13 +90,6 b' var IPython = (function (IPython) {'
91 return this._visible;
90 return this._visible;
92 };
91 };
93
92
94 Completer.prototype.was_shown = function () {
95 // Return whether or not the completer was shown.
96 var ret = this._shown;
97 this._shown = false;
98 return ret;
99 };
100
101 Completer.prototype.startCompletion = function () {
93 Completer.prototype.startCompletion = function () {
102 // call for a 'first' completion, that will set the editor and do some
94 // call for a 'first' completion, that will set the editor and do some
103 // special behaviour like autopicking if only one completion availlable
95 // special behaviour like autopicking if only one completion availlable
@@ -239,7 +231,6 b' var IPython = (function (IPython) {'
239 .attr('size', Math.min(10, this.raw_result.length));
231 .attr('size', Math.min(10, this.raw_result.length));
240 this.complete.append(this.sel);
232 this.complete.append(this.sel);
241 this._visible = true;
233 this._visible = true;
242 this._shown = true;
243 $('body').append(this.complete);
234 $('body').append(this.complete);
244
235
245 // After everything is on the page, compute the postion.
236 // After everything is on the page, compute the postion.
@@ -298,7 +289,6 b' var IPython = (function (IPython) {'
298
289
299 Completer.prototype.close = function () {
290 Completer.prototype.close = function () {
300 this._visible = false;
291 this._visible = false;
301 this._shown = false;
302 if (this.done) return;
292 if (this.done) return;
303 this.done = true;
293 this.done = true;
304 $('.completions').remove();
294 $('.completions').remove();
@@ -30,7 +30,6 b' var IPython = (function (IPython) {'
30 // handle to html
30 // handle to html
31 this.tooltip = $('#tooltip');
31 this.tooltip = $('#tooltip');
32 this._hidden = true;
32 this._hidden = true;
33 this._shown = false;
34
33
35 // variable for consecutive call
34 // variable for consecutive call
36 this._old_cell = null;
35 this._old_cell = null;
@@ -129,10 +128,6 b' var IPython = (function (IPython) {'
129 return !this._hidden;
128 return !this._hidden;
130 };
129 };
131
130
132 Tooltip.prototype.was_shown = function () {
133 return this._shown;
134 };
135
136 Tooltip.prototype.showInPager = function (cell) {
131 Tooltip.prototype.showInPager = function (cell) {
137 // reexecute last call in pager by appending ? to show back in pager
132 // reexecute last call in pager by appending ? to show back in pager
138 var that = this;
133 var that = this;
@@ -161,7 +156,6 b' var IPython = (function (IPython) {'
161 // and reset it's status
156 // and reset it's status
162 Tooltip.prototype._hide = function () {
157 Tooltip.prototype._hide = function () {
163 this._hidden = true;
158 this._hidden = true;
164 this._shown = false;
165 this.tooltip.fadeOut('fast');
159 this.tooltip.fadeOut('fast');
166 $('#expanbutton').show('slow');
160 $('#expanbutton').show('slow');
167 this.text.removeClass('bigtooltip');
161 this.text.removeClass('bigtooltip');
@@ -376,7 +370,6 b' var IPython = (function (IPython) {'
376 }
370 }
377
371
378 this._hidden = false;
372 this._hidden = false;
379 this._show = true;
380 this.tooltip.fadeIn('fast');
373 this.tooltip.fadeIn('fast');
381 this.text.children().remove();
374 this.text.children().remove();
382
375
General Comments 0
You need to be logged in to leave comments. Login now