flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p...@apache.org
Subject [01/28] git commit: [flex-asjs] [refs/heads/feature/dragAndDrop] - fix keyboard events for TLFEditTestFlexJS
Date Mon, 21 Aug 2017 09:11:56 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/feature/dragAndDrop bdc624644 -> 2443273b6


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/feature/dragAndDrop
Commit: 2b2c10092ab0cac0c6f8cee2dac231f789f8e13f
Parents: 367f8b9
Author: Alex Harui <aharui@apache.org>
Authored: Tue Aug 8 10:01:04 2017 -0700
Committer: Alex Harui <aharui@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;
 		}
 
 		/**


Mime
View raw message