Android-RTEditor icon indicating copy to clipboard operation
Android-RTEditor copied to clipboard

Bug: calling `rtEditText.getText(RTFormat.HTML)` will duplicate the text

Open AndroidDeveloperLB opened this issue 7 years ago • 2 comments

After I choose to get the text :

rtEditText.getText(RTFormat.HTML)

And then I type any character, the text gets duplicated.

Attached sample project and video.

RTEditTextTest.zip

device-2018-02-12-140535.zip

AndroidDeveloperLB avatar Feb 12 '18 12:02 AndroidDeveloperLB

In fact, in the sample it crashes with this exception:

02-12 14:14:26.362 11508-11508/com.onegravity.rteditor.demo E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.onegravity.rteditor.demo, PID: 11508
    android.os.FileUriExposedException: file:///storage/emulated/0/Android/data/com.onegravity.rteditor.demo/files exposed beyond app through Intent.getData()
        at android.os.StrictMode.onFileUriExposed(StrictMode.java:1960)
        at android.net.Uri.checkFileUriExposed(Uri.java:2348)
        at android.content.Intent.prepareToLeaveProcess(Intent.java:9881)
        at android.content.Intent.prepareToLeaveProcess(Intent.java:9835)
        at android.app.Instrumentation.execStartActivity(Instrumentation.java:1610)
        at android.app.Activity.startActivityForResult(Activity.java:4487)
        at android.support.v4.app.BaseFragmentActivityApi16.startActivityForResult(BaseFragmentActivityApi16.java:54)
        at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:67)
        at android.app.Activity.startActivityForResult(Activity.java:4445)
        at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:732)
        at com.onegravity.rteditor.demo.FileHelper.pickDirectory(FileHelper.java:64)
        at com.onegravity.rteditor.demo.RTEditorActivity.onOptionsItemSelected(RTEditorActivity.java:248)
        at android.app.Activity.onMenuItemSelected(Activity.java:3450)
        at android.support.v4.app.FragmentActivity.onMenuItemSelected(FragmentActivity.java:380)
        at android.support.v7.app.AppCompatActivity.onMenuItemSelected(AppCompatActivity.java:195)
        at android.support.v7.view.WindowCallbackWrapper.onMenuItemSelected(WindowCallbackWrapper.java:108)
        at android.support.v7.app.AppCompatDelegateImplV9.onMenuItemSelected(AppCompatDelegateImplV9.java:674)
        at android.support.v7.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:822)
        at android.support.v7.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:171)
        at android.support.v7.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:973)
        at android.support.v7.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:963)
        at android.support.v7.widget.ActionMenuView.invokeItem(ActionMenuView.java:624)
        at android.support.v7.view.menu.ActionMenuItemView.onClick(ActionMenuItemView.java:150)
        at android.view.View.performClick(View.java:6294)
        at android.view.View$PerformClick.run(View.java:24770)
        at android.os.Handler.handleCallback(Handler.java:790)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6494)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

AndroidDeveloperLB avatar Feb 12 '18 12:02 AndroidDeveloperLB

I'm having the same issue, after a while digging into the library, I found the solution: You must import this lib as module. Go into the RTEditable class, in method clean(), comment these out:

// Editable text = mEditor.getText(); // BaseInputConnection.removeComposingSpans(text);

I'm not sure what this method does, it's causing duplicate text event when remove content of edittext.

89hnim avatar Apr 14 '20 02:04 89hnim