From c180832f844196772136c67b88abf0dfb2bc22af Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 8 Sep 2014 10:17:09 -0700 Subject: [PATCH] Resize tokenizer text input after pasting Summary: Fixes T5251. We don't recompute tokenizer metrics accurately after a paste event. Listen for paste events and redraw the input. Test Plan: Pasted long text into a tokenizer in Safari, Firefox and Chrome. Reviewers: btrahan, chad Reviewed By: chad Subscribers: epriestley Maniphest Tasks: T5251 Differential Revision: https://secure.phabricator.com/D10442 --- resources/celerity/map.php | 18 +++++++++--------- .../javelin/lib/control/tokenizer/Tokenizer.js | 5 ++++- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index daa8cc4d8a..5c6f65b8a3 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -8,7 +8,7 @@ return array( 'names' => array( 'core.pkg.css' => '974635bb', - 'core.pkg.js' => 'cebacb31', + 'core.pkg.js' => '47fd11f0', 'darkconsole.pkg.js' => 'df001cab', 'differential.pkg.css' => '36884139', 'differential.pkg.js' => '73337d1d', @@ -209,7 +209,7 @@ return array( 'rsrc/externals/javelin/lib/__tests__/URI.js' => '003ed329', 'rsrc/externals/javelin/lib/__tests__/behavior.js' => '1ea62783', 'rsrc/externals/javelin/lib/behavior.js' => '61cbc29a', - 'rsrc/externals/javelin/lib/control/tokenizer/Tokenizer.js' => 'a5b67173', + 'rsrc/externals/javelin/lib/control/tokenizer/Tokenizer.js' => '9f06389f', 'rsrc/externals/javelin/lib/control/typeahead/Typeahead.js' => 'e614d22b', 'rsrc/externals/javelin/lib/control/typeahead/normalizer/TypeaheadNormalizer.js' => '1c22377d', 'rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadCompositeSource.js' => '503e17fd', @@ -675,7 +675,7 @@ return array( 'javelin-routable' => 'b3e7d692', 'javelin-router' => '29274e2b', 'javelin-stratcom' => '8b0ad945', - 'javelin-tokenizer' => 'a5b67173', + 'javelin-tokenizer' => '9f06389f', 'javelin-typeahead' => 'e614d22b', 'javelin-typeahead-composite-source' => '503e17fd', 'javelin-typeahead-normalizer' => '1c22377d', @@ -1459,6 +1459,12 @@ return array( 'javelin-vector', 'javelin-dom', ), + '9f06389f' => array( + 'javelin-dom', + 'javelin-util', + 'javelin-stratcom', + 'javelin-install', + ), '9f7309fb' => array( 'javelin-behavior', 'javelin-dom', @@ -1476,12 +1482,6 @@ return array( 'javelin-dom', 'phabricator-notification', ), - 'a5b67173' => array( - 'javelin-dom', - 'javelin-util', - 'javelin-stratcom', - 'javelin-install', - ), 'a5d7cf86' => array( 'javelin-dom', ), diff --git a/webroot/rsrc/externals/javelin/lib/control/tokenizer/Tokenizer.js b/webroot/rsrc/externals/javelin/lib/control/tokenizer/Tokenizer.js index 4c331e3d25..dc516f3de5 100644 --- a/webroot/rsrc/externals/javelin/lib/control/tokenizer/Tokenizer.js +++ b/webroot/rsrc/externals/javelin/lib/control/tokenizer/Tokenizer.js @@ -88,7 +88,7 @@ JX.install('Tokenizer', { JX.DOM.listen( focus, - ['click', 'focus', 'blur', 'keydown', 'keypress'], + ['click', 'focus', 'blur', 'keydown', 'keypress', 'paste'], null, JX.bind(this, this.handleEvent)); @@ -222,7 +222,10 @@ JX.install('Tokenizer', { this._typeahead.updatePlaceholder(); } else if (e.getType() == 'focus') { this._didfocus(); + } else if (e.getType() == 'paste') { + setTimeout(JX.bind(this, this._redraw), 0); } + }, refresh : function() {