##// END OF EJS Templates
move mergeopt to utils...
MinRK -
Show More
@@ -514,6 +514,12 b' define(['
514 514 }
515 515 };
516 516
517 var mergeopt = function(_class, options, overwrite){
518 options = options || {};
519 overwrite = overwrite || {};
520 return $.extend(true, {}, _class.options_default, options, overwrite);
521 };
522
517 523 var ajax_error_msg = function (jqXHR) {
518 524 // Return a JSON error message if there is one,
519 525 // otherwise the basic HTTP status text.
@@ -552,6 +558,7 b' define(['
552 558 platform: platform,
553 559 is_or_has : is_or_has,
554 560 is_focused : is_focused,
561 mergeopt: mergeopt,
555 562 ajax_error_msg : ajax_error_msg,
556 563 log_ajax_error : log_ajax_error,
557 564 };
@@ -42,7 +42,7 b' define(['
42 42 options = options || {};
43 43 this.keyboard_manager = options.keyboard_manager;
44 44 this.events = options.events;
45 var config = this.mergeopt(Cell, options.config);
45 var config = utils.mergeopt(Cell, options.config);
46 46 // superclass default overwrite our default
47 47
48 48 this.placeholder = config.placeholder || '';
@@ -94,12 +94,6 b' define(['
94 94 Cell.options_default.cm_config.dragDrop = false;
95 95 }
96 96
97 Cell.prototype.mergeopt = function(_class, options, overwrite){
98 options = options || {};
99 overwrite = overwrite || {};
100 return $.extend(true, {}, _class.options_default, options, overwrite);
101 };
102
103 97 /**
104 98 * Empty. Subclasses must implement create_element.
105 99 * This should contain all the code to create the DOM element in notebook
@@ -76,7 +76,7 b' define(['
76 76 onKeyEvent: $.proxy(this.handle_keyevent,this)
77 77 };
78 78
79 var config = this.mergeopt(CodeCell, this.config, {cm_config: cm_overwrite_options});
79 var config = utils.mergeopt(CodeCell, this.config, {cm_config: cm_overwrite_options});
80 80 Cell.apply(this,[{
81 81 config: config,
82 82 keyboard_manager: options.keyboard_manager,
@@ -3,13 +3,14 b''
3 3
4 4 define([
5 5 'base/js/namespace',
6 'base/js/utils',
6 7 'jquery',
7 8 'notebook/js/cell',
8 9 'base/js/security',
9 10 'notebook/js/mathjaxutils',
10 11 'notebook/js/celltoolbar',
11 12 'components/marked/lib/marked',
12 ], function(IPython, $, cell, security, mathjaxutils, celltoolbar, marked) {
13 ], function(IPython, utils, $, cell, security, mathjaxutils, celltoolbar, marked) {
13 14 "use strict";
14 15 var Cell = cell.Cell;
15 16
@@ -40,7 +41,7 b' define(['
40 41 var cm_overwrite_options = {
41 42 onKeyEvent: $.proxy(this.handle_keyevent,this)
42 43 };
43 var config = this.mergeopt(TextCell, this.config, {cm_config:cm_overwrite_options});
44 var config = utils.mergeopt(TextCell, this.config, {cm_config:cm_overwrite_options});
44 45 Cell.apply(this, [{
45 46 config: config,
46 47 keyboard_manager: options.keyboard_manager,
@@ -230,7 +231,7 b' define(['
230 231 // keyboard_manager: KeyboardManager instance
231 232 // notebook: Notebook instance
232 233 options = options || {};
233 var config = this.mergeopt(MarkdownCell, options.config);
234 var config = utils.mergeopt(MarkdownCell, options.config);
234 235 TextCell.apply(this, [$.extend({}, options, {config: config})]);
235 236
236 237 this.cell_type = 'markdown';
@@ -283,7 +284,7 b' define(['
283 284 // keyboard_manager: KeyboardManager instance
284 285 // notebook: Notebook instance
285 286 options = options || {};
286 var config = this.mergeopt(RawCell, options.config);
287 var config = utils.mergeopt(RawCell, options.config);
287 288 TextCell.apply(this, [$.extend({}, options, {config: config})]);
288 289
289 290 // RawCell should always hide its rendered div
@@ -343,7 +344,7 b' define(['
343 344 // keyboard_manager: KeyboardManager instance
344 345 // notebook: Notebook instance
345 346 options = options || {};
346 var config = this.mergeopt(HeadingCell, options.config);
347 var config = utils.mergeopt(HeadingCell, options.config);
347 348 TextCell.apply(this, [$.extend({}, options, {config: config})]);
348 349
349 350 this.level = 1;
General Comments 0
You need to be logged in to leave comments. Login now