fix: extensionHook not being used

fixes #665
This commit is contained in:
Roman Hotsiy 2018-10-08 11:54:07 +03:00
parent 14acab32b2
commit a4a40135ec
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0

View File

@ -126,14 +126,13 @@ export class RedocNormalizedOptions {
allowedMdComponents: Dict<MDXComponentMeta>;
constructor(raw: RedocRawOptions, defaults: RedocRawOptions = {}) {
let hook;
raw = { ...defaults, ...raw };
if (raw.theme && raw.theme.extensionsHook) {
hook = raw.theme.extensionsHook;
raw.theme.extensionsHook = undefined;
}
this.theme = resolveTheme(mergeObjects({} as any, defaultTheme, raw.theme || {}));
this.theme.extensionsHook = hook;
const hook = raw.theme && raw.theme.extensionsHook;
this.theme = resolveTheme(
mergeObjects({} as any, defaultTheme, { ...raw.theme, extensionsHook: undefined }),
);
this.theme.extensionsHook = hook as any;
this.scrollYOffset = RedocNormalizedOptions.normalizeScrollYOffset(raw.scrollYOffset);
this.hideHostname = RedocNormalizedOptions.normalizeHideHostname(raw.hideHostname);