Merge pull request #8711 from element-hq/dependabot/gradle/io.element.android-wysiwyg-2.22.0

Bump io.element.android:wysiwyg from 2.14.1 to 2.22.0
This commit is contained in:
Benoit Marty 2023-12-20 15:05:11 +01:00 committed by GitHub
commit 6feee61f17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 15 deletions

View File

@ -101,7 +101,7 @@ ext.libs = [
],
element : [
'opusencoder' : "io.element.android:opusencoder:1.1.0",
'wysiwyg' : "io.element.android:wysiwyg:2.14.1"
'wysiwyg' : "io.element.android:wysiwyg:2.22.0"
],
squareup : [
'moshi' : "com.squareup.moshi:moshi:$moshi",

View File

@ -232,6 +232,7 @@ class AutoCompleter @AssistedInject constructor(
private fun insertMatrixItemIntoRichTextEditor(editorEditText: EditorEditText, matrixItem: MatrixItem) {
if (matrixItem is MatrixItem.EveryoneInRoomItem) {
editorEditText.replaceTextSuggestion(matrixItem.displayName)
// Note: not using editorEditText.insertAtRoomMentionAtSuggestion() since we want to keep the existing look and feel of the mention for @room.
return
}
@ -253,7 +254,7 @@ class AutoCompleter @AssistedInject constructor(
matrixItem.getBestName()
}
editorEditText.setLinkSuggestion(url = permalink, text = linkText)
editorEditText.insertMentionAtSuggestion(url = permalink, text = linkText)
}
private fun insertMatrixItemIntoEditable(editText: EditText, editable: Editable, firstChar: Char, matrixItem: MatrixItem) {

View File

@ -105,10 +105,10 @@ internal class RichTextComposerLayout @JvmOverloads constructor(
override val attachmentButton: ImageButton
get() = views.attachmentButton
val richTextEditText: EditText get() =
views.richTextComposerEditText
val plainTextEditText: EditText get() =
views.plainTextComposerEditText
val richTextEditText: EditText
get() = views.richTextComposerEditText
val plainTextEditText: EditText
get() = views.plainTextComposerEditText
var pillDisplayHandler: PillDisplayHandler? = null
@ -237,14 +237,16 @@ internal class RichTextComposerLayout @JvmOverloads constructor(
views.composerEditTextOuterBorder.background = borderShapeDrawable
setupRichTextMenu()
views.richTextComposerEditText.mentionDisplayHandler = object : MentionDisplayHandler {
override fun resolveMentionDisplay(text: String, url: String): TextDisplay =
pillDisplayHandler?.resolveMentionDisplay(text, url) ?: TextDisplay.Plain
override fun resolveAtRoomMentionDisplay(): TextDisplay =
pillDisplayHandler?.resolveAtRoomMentionDisplay() ?: TextDisplay.Plain
}
views.richTextComposerEditText.updateStyle(
styleConfig = views.richTextComposerEditText.styleConfig,
mentionDisplayHandler = object : MentionDisplayHandler {
override fun resolveMentionDisplay(text: String, url: String): TextDisplay =
pillDisplayHandler?.resolveMentionDisplay(text, url) ?: TextDisplay.Plain
override fun resolveAtRoomMentionDisplay(): TextDisplay =
pillDisplayHandler?.resolveAtRoomMentionDisplay() ?: TextDisplay.Plain
}
)
updateTextFieldBorder(isFullScreen)
}

View File

@ -35,6 +35,7 @@ import im.vector.app.features.home.room.detail.timeline.url.PreviewUrlUiState
import im.vector.app.features.home.room.detail.timeline.url.PreviewUrlView
import im.vector.app.features.media.ImageContentRenderer
import im.vector.lib.core.utils.epoxy.charsequence.EpoxyCharSequence
import io.element.android.wysiwyg.EditorStyledTextView
import io.noties.markwon.MarkwonPlugin
import org.matrix.android.sdk.api.extensions.orFalse
@ -138,13 +139,19 @@ abstract class MessageTextItem : AbsMessageItem<MessageTextItem.Holder>() {
val previewUrlView by bind<PreviewUrlView>(R.id.messageUrlPreview)
private val richMessageStub by bind<ViewStub>(R.id.richMessageTextViewStub)
private val plainMessageStub by bind<ViewStub>(R.id.plainMessageTextViewStub)
var richMessageView: AppCompatTextView? = null
var richMessageView: EditorStyledTextView? = null
private set
var plainMessageView: AppCompatTextView? = null
private set
fun requireRichMessageView(): AppCompatTextView {
val view = richMessageView ?: richMessageStub.inflate().findViewById(R.id.messageTextView)
val view = richMessageView ?: richMessageStub.inflate().findViewById<EditorStyledTextView>(R.id.messageTextView).also {
// Required to ensure that `inlineCodeBgHelper` and `codeBlockBgHelper` are initialized
it.updateStyle(
styleConfig = it.styleConfig,
mentionDisplayHandler = null,
)
}
richMessageView = view
return view
}