Ensure text content is always pasted as plain text (#3083)

Fixes https://github.com/tuskyapp/Tusky/issues/3082.
This commit is contained in:
Nik Clayton 2022-12-30 11:41:48 +01:00 committed by GitHub
parent c07dd0f919
commit 02cadd5d33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -63,4 +63,16 @@ class EditTextTyped @JvmOverloads constructor(
editorInfo
)!!
}
/**
* Override pasting to ensure that formatted content is always pasted as
* plain text.
*/
override fun onTextContextMenuItem(id: Int): Boolean {
if (id == android.R.id.paste) {
return super.onTextContextMenuItem(android.R.id.pasteAsPlainText)
}
return super.onTextContextMenuItem(id)
}
}