Commit e8e19a6b authored by MozLando's avatar MozLando
Browse files

Merge #5497



5497: Pasting URL to URL bar without formatting (Android M and higher) r=csadilek a=marcinwiacek

Partial fix for pasting URL to URL bar (works for Android M and higher).

Before change: text is added with rich formatting

After change: text is added without rich formatting

Closes #5512: Strip formatting when pasting text in url bar 
 


Co-authored-by: default avatarMarcin Wiącek <marcin@mwiacek.com>
parents 38520f41 e7662227
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -677,6 +677,14 @@ open class InlineAutocompleteEditText @JvmOverloads constructor(
        windowFocusChangeListener?.invoke(hasFocus)
    }

    override fun onTextContextMenuItem(id: Int): Boolean {
        var newId = id
        if (newId == android.R.id.paste && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            newId = android.R.id.pasteAsPlainText
        }
        return super.onTextContextMenuItem(newId)
    }

    @Suppress("ClickableViewAccessibility")
    override fun onTouchEvent(event: MotionEvent): Boolean {
        return if (Build.VERSION.SDK_INT == Build.VERSION_CODES.M &&