mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-06 11:35:24 +08:00
allow returning full class config data, merged with defaults
and merge object config values with defaults (e.g. Cell.cm_config)
This commit is contained in:
parent
d7a095c206
commit
0e5047e75d
@ -102,7 +102,21 @@ function(utils) {
|
||||
*/
|
||||
ConfigWithDefaults.prototype.get_sync = function(key) {
|
||||
var data = this._class_data();
|
||||
return key in data ? data[key] : this.defaults[key];
|
||||
if (key === undefined) {
|
||||
// no key specified, return full config data
|
||||
return $.extend(true, {}, this.defaults, data);
|
||||
}
|
||||
|
||||
var value = data[key];
|
||||
if (value !== undefined) {
|
||||
if (typeof value == 'object') {
|
||||
// merge with defaults if it's an object
|
||||
return $.extend(true, {}, this.defaults[key], value);
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return this.defaults[key];
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user