From 0e5501b12b4806e45d1e04eb3e370105429f85d0 Mon Sep 17 00:00:00 2001 From: Giulio Cesare Solaroli Date: Mon, 27 Jul 2015 18:01:40 +0200 Subject: [PATCH] =?UTF-8?q?Fixed=20=E2=80=98esc=E2=80=99=20handling=20for?= =?UTF-8?q?=20fieldValues=20rendered=20as=20TextArea?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Clipperz/PM/UI/Components/Cards/TextArea.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) 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); },