Show More
@@ -636,7 +636,7 b' define([' | |||||
636 | } else { |
|
636 | } else { | |
637 | data.metadata = this.metadata; |
|
637 | data.metadata = this.metadata; | |
638 | } |
|
638 | } | |
639 | this.element.find('.inner_cell').text("Unrecognized cell type: " + data.cell_type); |
|
639 | this.element.find('.inner_cell').find("a").text("Unrecognized cell type: " + data.cell_type); | |
640 | }; |
|
640 | }; | |
641 |
|
641 | |||
642 | UnrecognizedCell.prototype.create_element = function () { |
|
642 | UnrecognizedCell.prototype.create_element = function () { | |
@@ -647,10 +647,23 b' define([' | |||||
647 | var prompt = $('<div/>').addClass('prompt input_prompt'); |
|
647 | var prompt = $('<div/>').addClass('prompt input_prompt'); | |
648 | cell.append(prompt); |
|
648 | cell.append(prompt); | |
649 | var inner_cell = $('<div/>').addClass('inner_cell'); |
|
649 | var inner_cell = $('<div/>').addClass('inner_cell'); | |
650 | inner_cell.text("Unrecognized cell type"); |
|
650 | inner_cell.append( | |
|
651 | $("<a>") | |||
|
652 | .attr("href", "#") | |||
|
653 | .text("Unrecognized cell type") | |||
|
654 | ); | |||
651 | cell.append(inner_cell); |
|
655 | cell.append(inner_cell); | |
652 | this.element = cell; |
|
656 | this.element = cell; | |
653 | }; |
|
657 | }; | |
|
658 | ||||
|
659 | UnrecognizedCell.prototype.bind_events = function () { | |||
|
660 | Cell.prototype.bind_events.apply(this, arguments); | |||
|
661 | var cell = this; | |||
|
662 | ||||
|
663 | this.element.find('.inner_cell').find("a").click(function () { | |||
|
664 | cell.events.trigger('unrecognized_cell.Cell', {cell: cell}) | |||
|
665 | }); | |||
|
666 | }; | |||
654 |
|
667 | |||
655 | // Backwards compatibility. |
|
668 | // Backwards compatibility. | |
656 | IPython.Cell = Cell; |
|
669 | IPython.Cell = Cell; |
@@ -147,7 +147,7 b' define([' | |||||
147 | this.minimum_autosave_interval = 120000; |
|
147 | this.minimum_autosave_interval = 120000; | |
148 | this.notebook_name_blacklist_re = /[\/\\:]/; |
|
148 | this.notebook_name_blacklist_re = /[\/\\:]/; | |
149 | this.nbformat = 4; // Increment this when changing the nbformat |
|
149 | this.nbformat = 4; // Increment this when changing the nbformat | |
150 | this.nbformat_minor = 0; // Increment this when changing the nbformat |
|
150 | this.nbformat_minor = this.current_nbformat_minor = 0; // Increment this when changing the nbformat | |
151 | this.codemirror_mode = 'ipython'; |
|
151 | this.codemirror_mode = 'ipython'; | |
152 | this.create_elements(); |
|
152 | this.create_elements(); | |
153 | this.bind_events(); |
|
153 | this.bind_events(); | |
@@ -207,6 +207,14 b' define([' | |||||
207 | that.dirty = true; |
|
207 | that.dirty = true; | |
208 | }); |
|
208 | }); | |
209 |
|
209 | |||
|
210 | this.events.on('unrecognized_cell.Cell', function () { | |||
|
211 | that.warn_nbformat_minor(); | |||
|
212 | }); | |||
|
213 | ||||
|
214 | this.events.on('unrecognized_output.OutputArea', function () { | |||
|
215 | that.warn_nbformat_minor(); | |||
|
216 | }); | |||
|
217 | ||||
210 | this.events.on('set_dirty.Notebook', function (event, data) { |
|
218 | this.events.on('set_dirty.Notebook', function (event, data) { | |
211 | that.dirty = data.value; |
|
219 | that.dirty = data.value; | |
212 | }); |
|
220 | }); | |
@@ -300,6 +308,28 b' define([' | |||||
300 | return null; |
|
308 | return null; | |
301 | }; |
|
309 | }; | |
302 | }; |
|
310 | }; | |
|
311 | ||||
|
312 | Notebook.prototype.warn_nbformat_minor = function (event) { | |||
|
313 | // trigger a warning dialog about missing functionality from newer minor versions | |||
|
314 | var v = 'v' + this.nbformat + '.'; | |||
|
315 | var orig_vs = v + this.nbformat_minor; | |||
|
316 | var this_vs = v + this.current_nbformat_minor; | |||
|
317 | var msg = "This notebook is version " + orig_vs + ", but we only fully support up to " + | |||
|
318 | this_vs + ". You can still work with this notebook, but cell and output types " + | |||
|
319 | "introduced in later notebook versions will not be available."; | |||
|
320 | ||||
|
321 | dialog.modal({ | |||
|
322 | notebook: this, | |||
|
323 | keyboard_manager: this.keyboard_manager, | |||
|
324 | title : "Newer Notebook", | |||
|
325 | body : msg, | |||
|
326 | buttons : { | |||
|
327 | OK : { | |||
|
328 | "class" : "btn-danger" | |||
|
329 | } | |||
|
330 | } | |||
|
331 | }); | |||
|
332 | } | |||
303 |
|
333 | |||
304 | /** |
|
334 | /** | |
305 | * Set the dirty flag, and trigger the set_dirty.Notebook event |
|
335 | * Set the dirty flag, and trigger the set_dirty.Notebook event | |
@@ -2234,26 +2264,8 b' define([' | |||||
2234 | } |
|
2264 | } | |
2235 | } |
|
2265 | } | |
2236 | }); |
|
2266 | }); | |
2237 |
} else if ( |
|
2267 | } else if (this.nbformat_minor < nbmodel.nbformat_minor) { | |
2238 | var that = this; |
|
2268 | this.nbformat_minor = nbmodel.nbformat_minor; | |
2239 | var orig_vs = 'v' + nbmodel.nbformat + '.' + orig_nbformat_minor; |
|
|||
2240 | var this_vs = 'v' + nbmodel.nbformat + '.' + this.nbformat_minor; |
|
|||
2241 | msg = "This notebook is version " + orig_vs + ", but we only fully support up to " + |
|
|||
2242 | this_vs + ". You can still work with this notebook, but some features " + |
|
|||
2243 | "introduced in later notebook versions may not be available."; |
|
|||
2244 |
|
||||
2245 | dialog.modal({ |
|
|||
2246 | notebook: this, |
|
|||
2247 | keyboard_manager: this.keyboard_manager, |
|
|||
2248 | title : "Newer Notebook", |
|
|||
2249 | body : msg, |
|
|||
2250 | buttons : { |
|
|||
2251 | OK : { |
|
|||
2252 | class : "btn-danger" |
|
|||
2253 | } |
|
|||
2254 | } |
|
|||
2255 | }); |
|
|||
2256 |
|
||||
2257 | } |
|
2269 | } | |
2258 |
|
2270 | |||
2259 | // Create the session after the notebook is completely loaded to prevent |
|
2271 | // Create the session after the notebook is completely loaded to prevent |
@@ -271,7 +271,6 b' define([' | |||||
271 | } |
|
271 | } | |
272 |
|
272 | |||
273 | var record_output = true; |
|
273 | var record_output = true; | |
274 | console.log("appending", json); |
|
|||
275 | switch(json.output_type) { |
|
274 | switch(json.output_type) { | |
276 | case 'execute_result': |
|
275 | case 'execute_result': | |
277 | json = this.validate_mimebundle(json); |
|
276 | json = this.validate_mimebundle(json); | |
@@ -490,10 +489,18 b' define([' | |||||
490 |
|
489 | |||
491 |
|
490 | |||
492 | OutputArea.prototype.append_unrecognized = function (json) { |
|
491 | OutputArea.prototype.append_unrecognized = function (json) { | |
|
492 | var that = this; | |||
493 | var toinsert = this.create_output_area(); |
|
493 | var toinsert = this.create_output_area(); | |
494 | var subarea = $('<div/>').addClass('output_subarea output_unrecognized'); |
|
494 | var subarea = $('<div/>').addClass('output_subarea output_unrecognized'); | |
495 | toinsert.append(subarea); |
|
495 | toinsert.append(subarea); | |
496 | subarea.text("Unrecognized output: " + json.output_type); |
|
496 | subarea.append( | |
|
497 | $("<a>") | |||
|
498 | .attr("href", "#") | |||
|
499 | .text("Unrecognized output: " + json.output_type) | |||
|
500 | .click(function () { | |||
|
501 | that.events.trigger('unrecognized_output.OutputArea', {output: json}) | |||
|
502 | }) | |||
|
503 | ); | |||
497 | this._safe_append(toinsert); |
|
504 | this._safe_append(toinsert); | |
498 | }; |
|
505 | }; | |
499 |
|
506 |
@@ -74,6 +74,16 b' div.unrecognized_cell {' | |||||
74 | color: red; |
|
74 | color: red; | |
75 | border: 1px solid @light_border_color; |
|
75 | border: 1px solid @light_border_color; | |
76 | background: darken(@cell_background, 5%); |
|
76 | background: darken(@cell_background, 5%); | |
|
77 | // remove decoration from link | |||
|
78 | a { | |||
|
79 | color: inherit; | |||
|
80 | text-decoration: none; | |||
|
81 | ||||
|
82 | &:hover { | |||
|
83 | color: inherit; | |||
|
84 | text-decoration: none; | |||
|
85 | } | |||
|
86 | } | |||
77 | } |
|
87 | } | |
78 | } |
|
88 | } | |
79 | @media (max-width: 480px) { |
|
89 | @media (max-width: 480px) { |
@@ -177,4 +177,14 b' div.output_unrecognized {' | |||||
177 | padding: 5px; |
|
177 | padding: 5px; | |
178 | font-weight: bold; |
|
178 | font-weight: bold; | |
179 | color: red; |
|
179 | color: red; | |
|
180 | // remove decoration from link | |||
|
181 | a { | |||
|
182 | color: inherit; | |||
|
183 | text-decoration: none; | |||
|
184 | ||||
|
185 | &:hover { | |||
|
186 | color: inherit; | |||
|
187 | text-decoration: none; | |||
|
188 | } | |||
|
189 | } | |||
180 | } No newline at end of file |
|
190 | } |
@@ -444,6 +444,14 b' div.unrecognized_cell .inner_cell {' | |||||
444 | border: 1px solid #cfcfcf; |
|
444 | border: 1px solid #cfcfcf; | |
445 | background: #eaeaea; |
|
445 | background: #eaeaea; | |
446 | } |
|
446 | } | |
|
447 | div.unrecognized_cell .inner_cell a { | |||
|
448 | color: inherit; | |||
|
449 | text-decoration: none; | |||
|
450 | } | |||
|
451 | div.unrecognized_cell .inner_cell a:hover { | |||
|
452 | color: inherit; | |||
|
453 | text-decoration: none; | |||
|
454 | } | |||
447 | @media (max-width: 480px) { |
|
455 | @media (max-width: 480px) { | |
448 | div.unrecognized_cell > div.prompt { |
|
456 | div.unrecognized_cell > div.prompt { | |
449 | display: none; |
|
457 | display: none; | |
@@ -919,11 +927,18 b' p.p-space {' | |||||
919 | margin-bottom: 10px; |
|
927 | margin-bottom: 10px; | |
920 | } |
|
928 | } | |
921 | div.output_unrecognized { |
|
929 | div.output_unrecognized { | |
922 | border-radius: 4px; |
|
|||
923 | padding: 5px; |
|
930 | padding: 5px; | |
924 | font-weight: bold; |
|
931 | font-weight: bold; | |
925 | color: red; |
|
932 | color: red; | |
926 | } |
|
933 | } | |
|
934 | div.output_unrecognized a { | |||
|
935 | color: inherit; | |||
|
936 | text-decoration: none; | |||
|
937 | } | |||
|
938 | div.output_unrecognized a:hover { | |||
|
939 | color: inherit; | |||
|
940 | text-decoration: none; | |||
|
941 | } | |||
927 | .rendered_html { |
|
942 | .rendered_html { | |
928 | color: #000000; |
|
943 | color: #000000; | |
929 | /* any extras will just be numbers: */ |
|
944 | /* any extras will just be numbers: */ |
@@ -8313,6 +8313,14 b' div.unrecognized_cell .inner_cell {' | |||||
8313 | border: 1px solid #cfcfcf; |
|
8313 | border: 1px solid #cfcfcf; | |
8314 | background: #eaeaea; |
|
8314 | background: #eaeaea; | |
8315 | } |
|
8315 | } | |
|
8316 | div.unrecognized_cell .inner_cell a { | |||
|
8317 | color: inherit; | |||
|
8318 | text-decoration: none; | |||
|
8319 | } | |||
|
8320 | div.unrecognized_cell .inner_cell a:hover { | |||
|
8321 | color: inherit; | |||
|
8322 | text-decoration: none; | |||
|
8323 | } | |||
8316 | @media (max-width: 480px) { |
|
8324 | @media (max-width: 480px) { | |
8317 | div.unrecognized_cell > div.prompt { |
|
8325 | div.unrecognized_cell > div.prompt { | |
8318 | display: none; |
|
8326 | display: none; | |
@@ -8788,11 +8796,18 b' p.p-space {' | |||||
8788 | margin-bottom: 10px; |
|
8796 | margin-bottom: 10px; | |
8789 | } |
|
8797 | } | |
8790 | div.output_unrecognized { |
|
8798 | div.output_unrecognized { | |
8791 | border-radius: 4px; |
|
|||
8792 | padding: 5px; |
|
8799 | padding: 5px; | |
8793 | font-weight: bold; |
|
8800 | font-weight: bold; | |
8794 | color: red; |
|
8801 | color: red; | |
8795 | } |
|
8802 | } | |
|
8803 | div.output_unrecognized a { | |||
|
8804 | color: inherit; | |||
|
8805 | text-decoration: none; | |||
|
8806 | } | |||
|
8807 | div.output_unrecognized a:hover { | |||
|
8808 | color: inherit; | |||
|
8809 | text-decoration: none; | |||
|
8810 | } | |||
8796 | .rendered_html { |
|
8811 | .rendered_html { | |
8797 | color: #000000; |
|
8812 | color: #000000; | |
8798 | /* any extras will just be numbers: */ |
|
8813 | /* any extras will just be numbers: */ |
General Comments 0
You need to be logged in to leave comments.
Login now