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

Add a `register_mime_type` method to OutputArea
This commit is contained in:
Matthias Bussonnier 2016-11-02 13:20:18 -07:00 committed by GitHub
commit 606b7377ae
2 changed files with 11 additions and 1 deletions

View File

@ -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');
};
/**

View File

@ -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};
});