Show More
@@ -705,7 +705,7 b' var IPython = (function (IPython) {' | |||||
705 | * Index will be brought back into the accissible range [0,n] |
|
705 | * Index will be brought back into the accissible range [0,n] | |
706 | * |
|
706 | * | |
707 | * @method insert_cell_at_index |
|
707 | * @method insert_cell_at_index | |
708 |
* @param type {string} in ['code',' |
|
708 | * @param type {string} in ['code','markdown','heading'] | |
709 | * @param [index] {int} a valid index where to inser cell |
|
709 | * @param [index] {int} a valid index where to inser cell | |
710 | * |
|
710 | * | |
711 | * @return cell {cell|null} created cell or null |
|
711 | * @return cell {cell|null} created cell or null | |
@@ -723,8 +723,6 b' var IPython = (function (IPython) {' | |||||
723 | cell.set_input_prompt(); |
|
723 | cell.set_input_prompt(); | |
724 | } else if (type === 'markdown') { |
|
724 | } else if (type === 'markdown') { | |
725 | cell = new IPython.MarkdownCell(); |
|
725 | cell = new IPython.MarkdownCell(); | |
726 | } else if (type === 'html') { |
|
|||
727 | cell = new IPython.HTMLCell(); |
|
|||
728 | } else if (type === 'raw') { |
|
726 | } else if (type === 'raw') { | |
729 | cell = new IPython.RawCell(); |
|
727 | cell = new IPython.RawCell(); | |
730 | } else if (type === 'heading') { |
|
728 | } else if (type === 'heading') { | |
@@ -884,37 +882,6 b' var IPython = (function (IPython) {' | |||||
884 | }; |
|
882 | }; | |
885 |
|
883 | |||
886 | /** |
|
884 | /** | |
887 | * Turn a cell into an HTML cell. |
|
|||
888 | * |
|
|||
889 | * @method to_html |
|
|||
890 | * @param {Number} [index] A cell's index |
|
|||
891 | */ |
|
|||
892 | Notebook.prototype.to_html = function (index) { |
|
|||
893 | // TODO: remove? This is never called |
|
|||
894 | var i = this.index_or_selected(index); |
|
|||
895 | if (this.is_valid_cell_index(i)) { |
|
|||
896 | var source_element = this.get_cell_element(i); |
|
|||
897 | var source_cell = source_element.data("cell"); |
|
|||
898 | var target_cell = null; |
|
|||
899 | if (!(source_cell instanceof IPython.HTMLCell)) { |
|
|||
900 | target_cell = this.insert_cell_below('html',i); |
|
|||
901 | var text = source_cell.get_text(); |
|
|||
902 | if (text === source_cell.placeholder) { |
|
|||
903 | text = ''; |
|
|||
904 | }; |
|
|||
905 | // The edit must come before the set_text. |
|
|||
906 | target_cell.edit(); |
|
|||
907 | target_cell.set_text(text); |
|
|||
908 | // make this value the starting point, so that we can only undo |
|
|||
909 | // to this state, instead of a blank cell |
|
|||
910 | target_cell.code_mirror.clearHistory(); |
|
|||
911 | source_element.remove(); |
|
|||
912 | this.dirty = true; |
|
|||
913 | }; |
|
|||
914 | }; |
|
|||
915 | }; |
|
|||
916 |
|
||||
917 | /** |
|
|||
918 | * Turn a cell into a raw text cell. |
|
885 | * Turn a cell into a raw text cell. | |
919 | * |
|
886 | * | |
920 | * @method to_raw |
|
887 | * @method to_raw | |
@@ -1138,14 +1105,7 b' var IPython = (function (IPython) {' | |||||
1138 | new_cell.edit(); // editor must be visible to call set_text |
|
1105 | new_cell.edit(); // editor must be visible to call set_text | |
1139 | new_cell.set_text(textb); |
|
1106 | new_cell.set_text(textb); | |
1140 | new_cell.render(); |
|
1107 | new_cell.render(); | |
1141 | } else if (cell instanceof IPython.HTMLCell) { |
|
1108 | } | |
1142 | cell.set_text(texta); |
|
|||
1143 | cell.render(); |
|
|||
1144 | var new_cell = this.insert_cell_below('html'); |
|
|||
1145 | new_cell.edit(); // editor must be visible to call set_text |
|
|||
1146 | new_cell.set_text(textb); |
|
|||
1147 | new_cell.render(); |
|
|||
1148 | }; |
|
|||
1149 | }; |
|
1109 | }; | |
1150 | }; |
|
1110 | }; | |
1151 |
|
1111 | |||
@@ -1163,7 +1123,7 b' var IPython = (function (IPython) {' | |||||
1163 | var text = cell.get_text(); |
|
1123 | var text = cell.get_text(); | |
1164 | if (cell instanceof IPython.CodeCell) { |
|
1124 | if (cell instanceof IPython.CodeCell) { | |
1165 | cell.set_text(upper_text+'\n'+text); |
|
1125 | cell.set_text(upper_text+'\n'+text); | |
1166 |
} else if (cell instanceof IPython.MarkdownCell |
|
1126 | } else if (cell instanceof IPython.MarkdownCell) { | |
1167 | cell.edit(); |
|
1127 | cell.edit(); | |
1168 | cell.set_text(upper_text+'\n'+text); |
|
1128 | cell.set_text(upper_text+'\n'+text); | |
1169 | cell.render(); |
|
1129 | cell.render(); | |
@@ -1187,7 +1147,7 b' var IPython = (function (IPython) {' | |||||
1187 | var text = cell.get_text(); |
|
1147 | var text = cell.get_text(); | |
1188 | if (cell instanceof IPython.CodeCell) { |
|
1148 | if (cell instanceof IPython.CodeCell) { | |
1189 | cell.set_text(text+'\n'+lower_text); |
|
1149 | cell.set_text(text+'\n'+lower_text); | |
1190 |
} else if (cell instanceof IPython.MarkdownCell |
|
1150 | } else if (cell instanceof IPython.MarkdownCell) { | |
1191 | cell.edit(); |
|
1151 | cell.edit(); | |
1192 | cell.set_text(text+'\n'+lower_text); |
|
1152 | cell.set_text(text+'\n'+lower_text); | |
1193 | cell.render(); |
|
1153 | cell.render(); | |
@@ -1396,8 +1356,6 b' var IPython = (function (IPython) {' | |||||
1396 | var cell_index = that.find_cell_index(cell); |
|
1356 | var cell_index = that.find_cell_index(cell); | |
1397 | if (cell instanceof IPython.CodeCell) { |
|
1357 | if (cell instanceof IPython.CodeCell) { | |
1398 | cell.execute(); |
|
1358 | cell.execute(); | |
1399 | } else if (cell instanceof IPython.HTMLCell) { |
|
|||
1400 | cell.render(); |
|
|||
1401 | } |
|
1359 | } | |
1402 | if (default_options.terminal) { |
|
1360 | if (default_options.terminal) { | |
1403 | cell.select_all(); |
|
1361 | cell.select_all(); |
@@ -325,7 +325,7 b' var IPython = (function (IPython) {' | |||||
325 | } |
|
325 | } | |
326 | }; |
|
326 | }; | |
327 |
|
327 | |||
328 |
OutputArea.display_order = ['javascript' |
|
328 | OutputArea.display_order = ['javascript','latex','svg','png','jpeg','text']; | |
329 |
|
329 | |||
330 | OutputArea.prototype.append_mime_type = function (json, element, dynamic) { |
|
330 | OutputArea.prototype.append_mime_type = function (json, element, dynamic) { | |
331 | for(var type_i in OutputArea.display_order){ |
|
331 | for(var type_i in OutputArea.display_order){ |
@@ -283,45 +283,6 b' var IPython = (function (IPython) {' | |||||
283 |
|
283 | |||
284 |
|
284 | |||
285 | /** |
|
285 | /** | |
286 | * @constructor HtmlCell |
|
|||
287 | * @class HtmlCell |
|
|||
288 | * @extends Ipython.TextCell |
|
|||
289 | */ |
|
|||
290 | var HTMLCell = function (options) { |
|
|||
291 |
|
||||
292 | options = this.mergeopt(HTMLCell,options); |
|
|||
293 | TextCell.apply(this, [options]); |
|
|||
294 |
|
||||
295 | this.cell_type = 'html'; |
|
|||
296 | }; |
|
|||
297 |
|
||||
298 | HTMLCell.options_default = { |
|
|||
299 | cm_config : { |
|
|||
300 | mode: 'htmlmixed', |
|
|||
301 | }, |
|
|||
302 | placeholder: "Type <strong>HTML</strong> and LaTeX: $\\alpha^2$" |
|
|||
303 | }; |
|
|||
304 |
|
||||
305 |
|
||||
306 | HTMLCell.prototype = new TextCell(); |
|
|||
307 |
|
||||
308 | /** |
|
|||
309 | * @method render |
|
|||
310 | */ |
|
|||
311 | HTMLCell.prototype.render = function () { |
|
|||
312 | if (this.rendered === false) { |
|
|||
313 | var text = this.get_text(); |
|
|||
314 | if (text === "") { text = this.placeholder; } |
|
|||
315 | this.set_rendered(text); |
|
|||
316 | this.typeset(); |
|
|||
317 | this.element.find('div.text_cell_input').hide(); |
|
|||
318 | this.element.find("div.text_cell_render").show(); |
|
|||
319 | this.rendered = true; |
|
|||
320 | } |
|
|||
321 | }; |
|
|||
322 |
|
||||
323 |
|
||||
324 | /** |
|
|||
325 | * @class MarkdownCell |
|
286 | * @class MarkdownCell | |
326 | * @constructor MarkdownCell |
|
287 | * @constructor MarkdownCell | |
327 | * @extends Ipython.HtmlCell |
|
288 | * @extends Ipython.HtmlCell | |
@@ -586,7 +547,6 b' var IPython = (function (IPython) {' | |||||
586 | }; |
|
547 | }; | |
587 |
|
548 | |||
588 | IPython.TextCell = TextCell; |
|
549 | IPython.TextCell = TextCell; | |
589 | IPython.HTMLCell = HTMLCell; |
|
|||
590 | IPython.MarkdownCell = MarkdownCell; |
|
550 | IPython.MarkdownCell = MarkdownCell; | |
591 | IPython.RawCell = RawCell; |
|
551 | IPython.RawCell = RawCell; | |
592 | IPython.HeadingCell = HeadingCell; |
|
552 | IPython.HeadingCell = HeadingCell; |
General Comments 0
You need to be logged in to leave comments.
Login now