Workaround insert image problem

pull/215/head
M66B 3 months ago
parent da0fc61ace
commit 2d4e033cc6

@ -3726,8 +3726,6 @@ public class FragmentCompose extends FragmentBase {
}
private void onAddAttachment(List<Uri> uris, String[] types, boolean image, int resize, boolean privacy, boolean focus) {
HtmlHelper.clearComposingText(etBody);
Bundle args = new Bundle();
args.putLong("id", working);
args.putParcelableArrayList("uris", new ArrayList<>(uris));
@ -3754,6 +3752,7 @@ public class FragmentCompose extends FragmentBase {
int start = args.getInt("start");
SpannableStringBuilder s = new SpannableStringBuilderEx(body);
HtmlHelper.clearComposingText(s);
if (start < 0)
start = 0;
if (start > s.length())

@ -58,6 +58,7 @@ import android.text.style.UnderlineSpan;
import android.util.Base64;
import android.util.Patterns;
import android.view.View;
import android.view.inputmethod.BaseInputConnection;
import android.widget.TextView;
import androidx.annotation.NonNull;
@ -4141,6 +4142,12 @@ public class HtmlHelper {
view.clearComposingText();
}
static void clearComposingText(Spannable text) {
if (text == null)
return;
BaseInputConnection.removeComposingSpans(text);
}
static Spanned fromHtml(@NonNull String html, Context context) {
Document document = JsoupEx.parse(html);
return fromDocument(context, document, null, null);

Loading…
Cancel
Save