Shortcuts

Implement shortcuts mentioned in #55 
It will get passed to a third party library. I didn't checked the source code(it may change over time anyway) so not sure whether the library will use condition on undefined value or just existence of the key. To be on the safe side I'd omit the key and value altogether if value is undefined. 

----- Original Message -----

> From: "David Mason" <notifications@github.com>
> To: "zanata/zanata-spa" <zanata-spa@noreply.github.com>
> Cc: "Patrick Huang" <pahuang@redhat.com>
> Sent: Thursday, November 6, 2014 3:28:37 PM
> Subject: Re: [zanata-spa] Shortcuts (#85)

> In app/editor/EditorShortcuts.js:
> > +      }
> > +      return this;
> > +    }
> > +
> > +    function singleKeyConfig(combo, description, action, callback) {
> > +      var keyConfig = {
> > +        allowIn: ['TEXTAREA'],
> > +        callback: callback
> > +      };
> > +      keyConfig.combo = combo;
> > +      if (description) {
> > +        keyConfig.description = description;
> > +      }
> > +      if (action) {
> > +        keyConfig.action = action;
> > +      }

> Unless we are going to iterate the properties of the keyConfig, or use
> hasOwnProperty to check for the values, we can just set the properties
> without checking them - technically it would mean they have the value
> undefined if they were not passed in, and hasOwnProperty will report true
> for the property, so it may not be appropriate to do that.

> —
> Reply to this email directly or view it on GitHub .