mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-07 23:42:00 +08:00
Merge pull request #28305 from 64BitAsura/next
Angular: Allow format configuration of custom source preview
This commit is contained in:
commit
5196fdffc3
@ -32,14 +32,20 @@ export const sourceDecorator = (
|
||||
const channel = addons.getChannel();
|
||||
const { props, template, userDefinedTemplate } = story;
|
||||
|
||||
const { component, argTypes } = context;
|
||||
const { component, argTypes, parameters } = context;
|
||||
|
||||
let toEmit: string;
|
||||
|
||||
useEffect(() => {
|
||||
if (toEmit) {
|
||||
const { id, unmappedArgs } = context;
|
||||
channel.emit(SNIPPET_RENDERED, { id, args: unmappedArgs, source: toEmit, format: 'angular' });
|
||||
const format = parameters?.docs?.source?.format ?? true;
|
||||
channel.emit(SNIPPET_RENDERED, {
|
||||
id,
|
||||
args: unmappedArgs,
|
||||
source: toEmit,
|
||||
format: format === true ? 'angular' : format,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user