From 3b0a999df9424f93567b40f5fff04bb31e7a4938 Mon Sep 17 00:00:00 2001 From: Katerina Skroumpelou Date: Tue, 30 Aug 2022 11:34:26 +0300 Subject: [PATCH 1/2] fix: add previewHead and previewBody to StorybookConfig interface --- code/lib/core-common/src/types.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/code/lib/core-common/src/types.ts b/code/lib/core-common/src/types.ts index 9555ffe2747f..d1e0bd990475 100644 --- a/code/lib/core-common/src/types.ts +++ b/code/lib/core-common/src/types.ts @@ -428,6 +428,15 @@ export interface StorybookConfig { * Docs related features in index generation */ docs?: DocsOptions; + + /** + * Programmatically modify the preview head/body HTML. + * The previewHead and previewBody functions accept a string, + * which is the existing head/body, and return a modified string. + */ + previewHead?: (head: string) => string; + + previewBody?: (body: string) => string; } export type PresetProperty = From 8a8d8fac9331cd2e37cb22e5a304e906c98c5c0e Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Tue, 30 Aug 2022 20:11:06 +0800 Subject: [PATCH 2/2] Apply suggestions from code review --- code/lib/core-common/src/types.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/lib/core-common/src/types.ts b/code/lib/core-common/src/types.ts index d1e0bd990475..f0fa900fc4c0 100644 --- a/code/lib/core-common/src/types.ts +++ b/code/lib/core-common/src/types.ts @@ -434,9 +434,9 @@ export interface StorybookConfig { * The previewHead and previewBody functions accept a string, * which is the existing head/body, and return a modified string. */ - previewHead?: (head: string) => string; + previewHead?: (head: string, options: Options) => string; - previewBody?: (body: string) => string; + previewBody?: (body: string, options: Options) => string; } export type PresetProperty =