Merge pull request #1866 from gnestor/register-mime-type

Add a `register_mime_type` method to OutputArea
pull/1870/head
Matthias Bussonnier 9 years ago committed by GitHub
commit 606b7377ae

@ -526,7 +526,8 @@ import {ShortcutEditor} from 'notebook/js/shortcuteditor';
* @return {jQuery} A selector of all cell elements
*/
Notebook.prototype.get_cell_elements = function () {
return this.container.find(".cell").not('.cell .cell');
var container = this.container || $('#notebook-container')
return container.find(".cell").not('.cell .cell');
};
/**

@ -996,6 +996,15 @@ define([
[MIME_JAVASCRIPT] : append_javascript,
[MIME_PDF] : append_pdf
};
OutputArea.prototype.register_mime_type = function (mimetype, append, safe) {
if (mimetype && typeof(append) === 'function') {
OutputArea.output_types.push(mimetype);
if (safe) OutputArea.safe_outputs[mimetype] = true;
OutputArea.display_order.unshift(mimetype);
OutputArea.append_map[mimetype] = append;
}
};
return {'OutputArea': OutputArea};
});

Loading…
Cancel
Save