mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-23 16:40:32 +00:00
Merge pull request #6353 from Imericxu/fix-pasting-rich-text-in-search
Fix unwanted rich text formatting when pasting
This commit is contained in:
commit
0eb69b6659
@ -9,6 +9,7 @@ import android.text.Editable;
|
|||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
|
import android.text.style.CharacterStyle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@ -588,6 +589,11 @@ public class SearchFragment extends BaseListFragment<SearchInfo, ListExtractor.I
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterTextChanged(final Editable s) {
|
public void afterTextChanged(final Editable s) {
|
||||||
|
// Remove rich text formatting
|
||||||
|
for (final CharacterStyle span : s.getSpans(0, s.length(), CharacterStyle.class)) {
|
||||||
|
s.removeSpan(span);
|
||||||
|
}
|
||||||
|
|
||||||
final String newText = searchEditText.getText().toString();
|
final String newText = searchEditText.getText().toString();
|
||||||
suggestionPublisher.onNext(newText);
|
suggestionPublisher.onNext(newText);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user