From 2467c0e6519676b8200ecc71303e4452dccde080 Mon Sep 17 00:00:00 2001 From: Ben Alpert Date: Thu, 30 May 2013 18:16:27 -0700 Subject: [PATCH] Update examples to use onInput instead of onKeyUp onInput has the advantage that it responds to repeated key events before onKeyUp and is called when modifying the input without the keyboard (such as pasting with the mouse). Test Plan: Opened the ballmer-peak example and docs homepage in Chrome and checked that both examples update whenever the text is changed. --- docs/_js/examples/markdown.js | 4 ++-- examples/ballmer-peak/example.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/_js/examples/markdown.js b/docs/_js/examples/markdown.js index ec4363f56c..ec70b95503 100644 --- a/docs/_js/examples/markdown.js +++ b/docs/_js/examples/markdown.js @@ -11,14 +11,14 @@ var MarkdownEditor = React.createClass({\n\ getInitialState: function() {\n\ return {value: 'Type some *markdown* here!'};\n\ },\n\ - handleKeyUp: React.autoBind(function() {\n\ + handleInput: React.autoBind(function() {\n\ this.setState({value: this.refs.textarea.getDOMNode().value});\n\ }),\n\ render: function() {\n\ return (\n\
\n\

Input

\n\ - \n\

Output

\n\ diff --git a/examples/ballmer-peak/example.js b/examples/ballmer-peak/example.js index 1ca43989a0..0a92b7c17d 100644 --- a/examples/ballmer-peak/example.js +++ b/examples/ballmer-peak/example.js @@ -33,7 +33,7 @@ var BallmerPeakCalculator = React.createClass({

Compute your Ballmer Peak:

If your BAC is{' '} - + {', '}then {pct} of your lines of code will have bugs.