You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by gr...@apache.org on 2020/10/25 00:34:12 UTC
[royale-asjs] 04/05: minor changes only
This is an automated email from the ASF dual-hosted git repository.
gregdove pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
commit 3792cef8e63e21867c1b279da133cab031af1fb6
Author: greg-dove <gr...@gmail.com>
AuthorDate: Sun Oct 25 13:21:35 2020 +1300
minor changes only
---
.../royale/jewel/beads/controls/textinput/Restrict.as | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/textinput/Restrict.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/textinput/Restrict.as
index 1540b0d..bef913b 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/textinput/Restrict.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/textinput/Restrict.as
@@ -85,7 +85,7 @@ package org.apache.royale.jewel.beads.controls.textinput
public function set strand(value:IStrand):void
{
host = value as TextInputBase;
- host.addEventListener(Event.CHANGE, restrictTetToPattern);
+ host.addEventListener(Event.CHANGE, restrictTextToPattern);
updateTextToRestriction();
}
@@ -93,7 +93,7 @@ package org.apache.royale.jewel.beads.controls.textinput
* Restrict the text to the reg exp pattern as user types
* @private
*/
- protected function restrictTetToPattern(event:Event):void
+ protected function restrictTextToPattern(event:Event):void
{
COMPILE::JS
{
@@ -120,9 +120,13 @@ package org.apache.royale.jewel.beads.controls.textinput
const re:RegExp = new RegExp(pattern, 'g');
COMPILE::JS
{
- const oldText:String = host.input.value;
- host.input.value = host.input.value.replace(re, '');
- textChanged = oldText == host.input.value;
+ const oldText:String = host.input.value;
+ const restrictedText:String = oldText.replace(re, '');
+ if (oldText != restrictedText) {
+ host.input.value = restrictedText;
+ } else {
+ textChanged = true;
+ }
}
return textChanged;
}