mirror of
https://github.com/jupyter/notebook.git
synced 2025-03-13 13:17:50 +08:00
Merge pull request #1866 from gnestor/register-mime-type
Add a `register_mime_type` method to OutputArea
This commit is contained in:
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…
x
Reference in New Issue
Block a user