1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-30 19:56:10 +00:00

Workaround insert image problem

This commit is contained in:
M66B 2024-08-03 21:18:33 +02:00
parent da0fc61ace
commit 2d4e033cc6
2 changed files with 8 additions and 2 deletions

View file

@ -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())

View file

@ -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);