bespokejs / bespoke

DIY Presentation Micro-Framework
http://markdalgleish.com/projects/bespoke.js/
MIT License
4.69k stars 442 forks source link

Add infrastructure for help text #64

Open mojavelinux opened 9 years ago

mojavelinux commented 9 years ago

While it's not the responsibility of bespoke.js core to provide a help view, it would be nice if core could maintain and expose help metadata so that this information can be collected and displayed.

One possible way is simply define a contract (in the README) that any plugin that contributes keybindings should fire and event with metadata for a help plugin.

deck.fire('help', [{type: 'key', value: 'f', action: 'Toggles fullscreen'}]);

Another way would be to expose methods that can be used to register and retrieve help metadata.

The focus is to figure out what foundation is necessary to make it possible to write a help plugin. The main decision is to work out the structure of the metadata. Next, we need to figure out how to get that metadata to the help plugin.

mojavelinux commented 9 years ago

Here's a screenshot of the help screen in showoff for reference.

showoff-help

mojavelinux commented 9 years ago

We may want to split action into action and desc.

deck.fire('help', [{type: 'key', value: 'right', action: 'next', desc: 'Move to the next slide.'}]);

That way, multiple events with the same action (e.g., next) can be combined as shown in the screenshot.