dispatch on mime type for append methods

This commit is contained in:
Paul Ivanov 2014-01-07 13:03:21 -08:00
parent a6be6e9821
commit e094fca4ef

View File

@ -514,11 +514,12 @@ var IPython = (function (IPython) {
return true;
}
} else {
var old_name = OutputArea.mime_map[type]
this['append_'+old_name](json[type], md, element, type);
return true;
var append = OutputArea.append_map[type];
if (append !== undefined) {
append.apply(this, [json[type], md, element, type]);
return true;
}
}
return false;
}
}
return false;
@ -634,6 +635,17 @@ var IPython = (function (IPython) {
element.append(toinsert);
};
OutputArea.append_map = {
"text/plain" : OutputArea.prototype.append_text,
"text/html" : OutputArea.prototype.append_html,
"image/svg+xml" : OutputArea.prototype.append_svg,
"image/png" : OutputArea.prototype.append_png,
"image/jpeg" : OutputArea.prototype.append_jpeg,
"text/latex" : OutputArea.prototype.append_latex,
"application/json" : OutputArea.prototype.append_json,
"application/javascript" : OutputArea.prototype.append_javascript,
};
OutputArea.prototype.append_raw_input = function (msg) {
var that = this;
this.expand();