Skip to content

Commit 049b9b6

Browse files
committed
Fixed major bug: backspace on enter press
1 parent bb85adf commit 049b9b6

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

aceeditor/src/main/java/com/susmit/aceeditor/AceEditor.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
import android.view.LayoutInflater;
1212
import android.view.MotionEvent;
1313
import android.view.View;
14+
import android.view.inputmethod.BaseInputConnection;
15+
import android.view.inputmethod.EditorInfo;
16+
import android.view.inputmethod.InputConnection;
1417
import android.webkit.JsResult;
1518
import android.webkit.WebChromeClient;
1619
import android.webkit.WebView;
@@ -70,6 +73,16 @@ public AceEditor(Context context, AttributeSet attrs)
7073
initialize();
7174
}
7275

76+
@Override
77+
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
78+
return new BaseInputConnection(this, false); //this is needed for #dispatchKeyEvent() to be notified.
79+
}
80+
81+
@Override
82+
public boolean dispatchKeyEvent(KeyEvent event) {
83+
return super.dispatchKeyEvent(event);
84+
85+
}
7386
@SuppressLint("SetJavaScriptEnabled")
7487
private void initialize()
7588
{

0 commit comments

Comments
 (0)