Repository: flex-asjs
Updated Branches:
  refs/heads/develop 574faa160 -> 2b2c10092


fix keyboard events for TLFEditTestFlexJS


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/2b2c1009
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/2b2c1009
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/2b2c1009

Branch: refs/heads/develop
Commit: 2b2c10092ab0cac0c6f8cee2dac231f789f8e13f
Parents: 367f8b9
Author: Alex Harui <aha...@apache.org>
Authored: Tue Aug 8 10:01:04 2017 -0700
Committer: Alex Harui <aha...@apache.org>
Committed: Tue Aug 8 10:01:16 2017 -0700

----------------------------------------------------------------------
 .../textLayout/beads/DispatchTLFKeyboardEventBead.as   | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2b2c1009/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/beads/DispatchTLFKeyboardEventBead.as
----------------------------------------------------------------------
diff --git 
a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/beads/DispatchTLFKeyboardEventBead.as
 
b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/beads/DispatchTLFKeyboardEventBead.as
index c308f9d..a671239 100644
--- 
a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/beads/DispatchTLFKeyboardEventBead.as
+++ 
b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/beads/DispatchTLFKeyboardEventBead.as
@@ -25,7 +25,8 @@ package org.apache.flex.textLayout.beads
        import org.apache.flex.events.Event;
        import org.apache.flex.events.IEventDispatcher;
        import org.apache.flex.events.KeyboardEvent;
-       import org.apache.flex.events.utils.KeyboardEventConverter;
+       import org.apache.flex.events.utils.EditingKeys;
+    import org.apache.flex.events.utils.KeyboardEventConverter;
        import org.apache.flex.text.events.TextEvent;
        import org.apache.flex.textLayout.events.FocusEvent;
 
@@ -202,12 +203,16 @@ package org.apache.flex.textLayout.beads
                        }
                }
                
+        private var inKeyEventHandler:Boolean;
+        
                /**
                 * @private
                 */
                COMPILE::JS
                protected function keyEventHandler(event:KeyboardEvent):void
                {
+            if (inKeyEventHandler) return;
+            inKeyEventHandler = true;
                        event.stopImmediatePropagation();
                        var newEvent:org.apache.flex.events.KeyboardEvent = 
KeyboardEventConverter.convert(event);
                        (_strand as IEventDispatcher).dispatchEvent(newEvent);
@@ -217,6 +222,10 @@ package org.apache.flex.textLayout.beads
                        }
                        if (event.type == "keypress")
                        {
+                // don't send along a TextInput event for "Backspace".  It 
should get handled
+                // in keyDownHandler
+                if (event.key == EditingKeys.BACKSPACE)
+                    return;
                                var 
textEvent:org.apache.flex.text.events.TextEvent = new 
org.apache.flex.text.events.TextEvent(TextEvent.TEXT_INPUT);
                                if (event.key != null)
                                        textEvent.text = event.key;
@@ -226,7 +235,7 @@ package org.apache.flex.textLayout.beads
                                        textEvent.text = 
String.fromCharCode(event['keyCode']);
                                (_strand as 
IEventDispatcher).dispatchEvent(textEvent);
                        }
-
+            inKeyEventHandler = false;
                }
 
                /**

Reply via email to