tajo / ladle

🥄 Develop, test and document your React story components faster.
https://www.ladle.dev
MIT License
2.63k stars 93 forks source link

Disable Shortcuts #467

Closed donrsh closed 1 year ago

donrsh commented 1 year ago

Is your feature request related to a problem? Please describe. I'd like to write a story for a customized editor, which contains a function involving listening on / keyup events.

Currently, it seems the events got caught by Ladle to focus on story search input .

Describe the solution you'd like I would suggest utilize addon; that's the way storybook solves this problem. (Ref)

I wonder if it's possible to configure this in story level, since not all stories intercept the shortcuts events. May it be, I think a proper position is the default export of the story.

Describe alternatives you've considered

Additional context

tajo commented 1 year ago

I am about start working on related task https://github.com/tajo/ladle/issues/466

My idea is having a global section in the .ladle/config.mjs:

export default {
  shortcuts: {
    focusSearch: ['/', 'CMD+P'],
    focusNextStory: null,
    goFullscreen: 'F'
  }
}

and then also story level meta settings:


export default {
  meta: {
    shortcuts: {
      goFullscreen: 'F'
    }
  }
}
Story.meta = {
  shortcuts: {
    goFullscreen: 'F'
  }
}
donrsh commented 1 year ago

@tajo That would be great! Thanks 😀