mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-07 07:21:17 +08:00
Add option to enable/diable shortcuts
This commit is contained in:
parent
74610ce1bb
commit
dc980abb7f
@ -6,20 +6,23 @@ const deprecationMessage = (oldName, newName) =>
|
||||
`The ${oldName} option has been renamed to ${newName} and will not be available in the next major Storybook release. Please update your config.`;
|
||||
|
||||
export function keyEventToOptions(currentOptions, event) {
|
||||
switch (event) {
|
||||
case features.FULLSCREEN:
|
||||
return { goFullScreen: !currentOptions.goFullScreen };
|
||||
case features.ADDON_PANEL:
|
||||
return { showAddonPanel: !currentOptions.showAddonPanel };
|
||||
case features.STORIES_PANEL:
|
||||
return { showStoriesPanel: !currentOptions.showStoriesPanel };
|
||||
case features.SHOW_SEARCH:
|
||||
return { showSearchBox: true };
|
||||
case features.ADDON_PANEL_IN_RIGHT:
|
||||
return { addonPanelInRight: !currentOptions.addonPanelInRight };
|
||||
default:
|
||||
return {};
|
||||
if (currentOptions.enableShortcuts) {
|
||||
switch (event) {
|
||||
case features.FULLSCREEN:
|
||||
return { goFullScreen: !currentOptions.goFullScreen };
|
||||
case features.ADDON_PANEL:
|
||||
return { showAddonPanel: !currentOptions.showAddonPanel };
|
||||
case features.STORIES_PANEL:
|
||||
return { showStoriesPanel: !currentOptions.showStoriesPanel };
|
||||
case features.SHOW_SEARCH:
|
||||
return { showSearchBox: true };
|
||||
case features.ADDON_PANEL_IN_RIGHT:
|
||||
return { addonPanelInRight: !currentOptions.addonPanelInRight };
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
const renamedOptions = {
|
||||
|
@ -9,6 +9,7 @@ export default {
|
||||
showAddonPanel: true,
|
||||
showSearchBox: false,
|
||||
addonPanelInRight: false,
|
||||
enableShortcuts: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user