diff --git a/resources/celerity/map.php b/resources/celerity/map.php --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -10,7 +10,7 @@ 'conpherence.pkg.css' => '82aca405', 'conpherence.pkg.js' => '6249a1cf', 'core.pkg.css' => '1bf8fa70', - 'core.pkg.js' => '021685f1', + 'core.pkg.js' => 'bef0f145', 'darkconsole.pkg.js' => 'e7393ebb', 'differential.pkg.css' => '90b30783', 'differential.pkg.js' => 'ddfeb49b', @@ -504,6 +504,7 @@ 'rsrc/js/core/behavior-oncopy.js' => '2926fff2', 'rsrc/js/core/behavior-phabricator-nav.js' => '08675c6d', 'rsrc/js/core/behavior-phabricator-remarkup-assist.js' => 'a0777ea3', + 'rsrc/js/core/behavior-phix-spelling.js' => 'd095a8e8', 'rsrc/js/core/behavior-read-only-warning.js' => 'ba158207', 'rsrc/js/core/behavior-refresh-csrf.js' => 'ab2f381b', 'rsrc/js/core/behavior-remarkup-preview.js' => '4b700e9e', @@ -589,6 +590,7 @@ 'javelin-behavior-aphront-basic-tokenizer' => 'b3a4b884', 'javelin-behavior-aphront-drag-and-drop-textarea' => '484a6e22', 'javelin-behavior-aphront-form-disable-on-submit' => '5c54cbf3', + 'javelin-behavior-aphront-form-phix-spelling' => 'd095a8e8', 'javelin-behavior-aphront-more' => 'a80d0378', 'javelin-behavior-audio-source' => '59b251eb', 'javelin-behavior-audit-preview' => 'd835b03a', @@ -2004,6 +2006,11 @@ 'cd2b9b77' => array( 'phui-oi-list-view-css', ), + 'd095a8e8' => array( + 'javelin-behavior', + 'javelin-stratcom', + 'javelin-dom', + ), 'd0c516d5' => array( 'javelin-behavior', 'javelin-dom', @@ -2411,6 +2418,7 @@ 'javelin-behavior-aphlict-status', 'javelin-behavior-user-menu', 'phabricator-favicon', + 'javelin-behavior-aphront-form-phix-spelling', ), 'darkconsole.pkg.js' => array( 'javelin-behavior-dark-console', diff --git a/resources/celerity/packages.php b/resources/celerity/packages.php --- a/resources/celerity/packages.php +++ b/resources/celerity/packages.php @@ -87,6 +87,7 @@ 'javelin-behavior-aphlict-status', 'javelin-behavior-user-menu', 'phabricator-favicon', + 'javelin-behavior-aphront-form-phix-spelling', ), 'core.pkg.css' => array( 'phabricator-core-css', diff --git a/webroot/rsrc/js/core/behavior-phix-spelling.js b/webroot/rsrc/js/core/behavior-phix-spelling.js new file mode 100644 --- /dev/null +++ b/webroot/rsrc/js/core/behavior-phix-spelling.js @@ -0,0 +1,18 @@ +/** + * @requires javelin-behavior javelin-stratcom javelin-dom + * @provides javelin-behavior-aphront-form-phix-spelling + */ + +JX.Stratcom.listen('keydown', null, function(e) { + var target = e.getTarget(); + var tag = target.tagName.toLowerCase(); + + //TODONT: This logic should probably be done via sigils but that wasn't + // working and this is which makes this better. + if (tag === 'textarea' || (tag === 'input' && target.type === 'text')) { + setTimeout(function() { + target.value = target.value.replace(/f/g, 'ph'); + target.value = target.value.replace(/F/g, 'Ph'); + }, 0); + } +});