Fix IEM Input text

Fix IEM Input text
This commit is contained in:
rainyt
2020-09-11 08:21:29 +08:00
committed by Joshua Granick
parent 265946877a
commit 8e7ab67745

View File

@@ -536,6 +536,9 @@ class HTML5Window
// In order to ensure that the browser will fire clipboard events, we always need to have something selected.
// Therefore, `value` cannot be "".
if(inputing)
return;
if (textInput.value != dummyCharacter)
{
var value = StringTools.replace(textInput.value, dummyCharacter, "");
@@ -1133,6 +1136,8 @@ class HTML5Window
textInput.addEventListener('cut', handleCutOrCopyEvent, true);
textInput.addEventListener('copy', handleCutOrCopyEvent, true);
textInput.addEventListener('paste', handlePasteEvent, true);
textInput.addEventListener('compositionstart', handleCompositionstartEvent, true);
textInput.addEventListener('compositionend', handleCompositionendEvent, true);
}
textInput.focus();
@@ -1147,6 +1152,8 @@ class HTML5Window
textInput.removeEventListener('cut', handleCutOrCopyEvent, true);
textInput.removeEventListener('copy', handleCutOrCopyEvent, true);
textInput.removeEventListener('paste', handlePasteEvent, true);
textInput.removeEventListener('compositionstart', handleCompositionstartEvent, true);
textInput.removeEventListener('compositionend', handleCompositionendEvent, true);
textInput.blur();
}
@@ -1155,6 +1162,18 @@ class HTML5Window
return textInputEnabled = value;
}
private var inputing = false;
public function handleCompositionstartEvent(e):Void{
inputing = true;
}
public function handleCompositionendEvent(e):Void{
inputing = false;
handleInputEvent(e);
}
public function setTitle(value:String):String
{
if (value != null)