diff --git a/frontend/delta/js/Clipperz/PM/UI/Components/Cards/TextArea.js b/frontend/delta/js/Clipperz/PM/UI/Components/Cards/TextArea.js index 4bf427a..78bc33d 100644 --- a/frontend/delta/js/Clipperz/PM/UI/Components/Cards/TextArea.js +++ b/frontend/delta/js/Clipperz/PM/UI/Components/Cards/TextArea.js @@ -30,7 +30,8 @@ Clipperz.PM.UI.Components.Cards.TextAreaClass = React.createClass({ componentDidMount: function() { this.recalculateSize(); - this.getDOMNode().addEventListener('input', this.recalculateSize, false); + this.getDOMNode().addEventListener('input', this.handleKeyDown, false); + this.getDOMNode().addEventListener('keydown', this.handleKeyDown, false); }, componentDidUpdate: function () { @@ -39,6 +40,7 @@ Clipperz.PM.UI.Components.Cards.TextAreaClass = React.createClass({ componentWillUnmount: function() { this.getDOMNode().removeEventListener('input', this.recalculateSize, false); + this.getDOMNode().removeEventListener('keydown', this.handleKeyDown, false); }, // componentDidUpdate: function(prevProps) { @@ -58,6 +60,15 @@ Clipperz.PM.UI.Components.Cards.TextAreaClass = React.createClass({ // } // }, + handleKeyDown: function (anEvent) { + switch (anEvent.keyCode) { + case 27: // escape + console.log("ESCAPE"); + Mousetrap.trigger('esc'); + break; + } + }, + //---------------------------------------------------------------------------- recalculateSize: function () { @@ -103,10 +114,6 @@ Clipperz.PM.UI.Components.Cards.TextAreaClass = React.createClass({ */ //---------------------------------------------------------------------------- -// render: function () { -// return React.DOM.textarea({'className':'cardNotes', /*'onChange':this.handleChange(this.record(), 'setNotes'), 'defaultValue':someNotes, 'key':this.props['_reference'] + '_notes',*/ 'placeholder': "notes"}); -// }, - render: function() { return React.DOM.textarea(this.props, this.props.children); },