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 : [ element : [
'opusencoder' : "io.element.android:opusencoder:1.1.0", '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 : [ squareup : [
'moshi' : "com.squareup.moshi:moshi:$moshi", 'moshi' : "com.squareup.moshi:moshi:$moshi",

View File

@ -232,6 +232,7 @@ class AutoCompleter @AssistedInject constructor(
private fun insertMatrixItemIntoRichTextEditor(editorEditText: EditorEditText, matrixItem: MatrixItem) { private fun insertMatrixItemIntoRichTextEditor(editorEditText: EditorEditText, matrixItem: MatrixItem) {
if (matrixItem is MatrixItem.EveryoneInRoomItem) { if (matrixItem is MatrixItem.EveryoneInRoomItem) {
editorEditText.replaceTextSuggestion(matrixItem.displayName) 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 return
} }
@ -253,7 +254,7 @@ class AutoCompleter @AssistedInject constructor(
matrixItem.getBestName() 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) { 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 override val attachmentButton: ImageButton
get() = views.attachmentButton get() = views.attachmentButton
val richTextEditText: EditText get() = val richTextEditText: EditText
views.richTextComposerEditText get() = views.richTextComposerEditText
val plainTextEditText: EditText get() = val plainTextEditText: EditText
views.plainTextComposerEditText get() = views.plainTextComposerEditText
var pillDisplayHandler: PillDisplayHandler? = null var pillDisplayHandler: PillDisplayHandler? = null
@ -237,14 +237,16 @@ internal class RichTextComposerLayout @JvmOverloads constructor(
views.composerEditTextOuterBorder.background = borderShapeDrawable views.composerEditTextOuterBorder.background = borderShapeDrawable
setupRichTextMenu() setupRichTextMenu()
views.richTextComposerEditText.mentionDisplayHandler = object : MentionDisplayHandler { views.richTextComposerEditText.updateStyle(
override fun resolveMentionDisplay(text: String, url: String): TextDisplay = styleConfig = views.richTextComposerEditText.styleConfig,
pillDisplayHandler?.resolveMentionDisplay(text, url) ?: TextDisplay.Plain mentionDisplayHandler = object : MentionDisplayHandler {
override fun resolveMentionDisplay(text: String, url: String): TextDisplay =
override fun resolveAtRoomMentionDisplay(): TextDisplay = pillDisplayHandler?.resolveMentionDisplay(text, url) ?: TextDisplay.Plain
pillDisplayHandler?.resolveAtRoomMentionDisplay() ?: TextDisplay.Plain
}
override fun resolveAtRoomMentionDisplay(): TextDisplay =
pillDisplayHandler?.resolveAtRoomMentionDisplay() ?: TextDisplay.Plain
}
)
updateTextFieldBorder(isFullScreen) 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.home.room.detail.timeline.url.PreviewUrlView
import im.vector.app.features.media.ImageContentRenderer import im.vector.app.features.media.ImageContentRenderer
import im.vector.lib.core.utils.epoxy.charsequence.EpoxyCharSequence import im.vector.lib.core.utils.epoxy.charsequence.EpoxyCharSequence
import io.element.android.wysiwyg.EditorStyledTextView
import io.noties.markwon.MarkwonPlugin import io.noties.markwon.MarkwonPlugin
import org.matrix.android.sdk.api.extensions.orFalse 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) val previewUrlView by bind<PreviewUrlView>(R.id.messageUrlPreview)
private val richMessageStub by bind<ViewStub>(R.id.richMessageTextViewStub) private val richMessageStub by bind<ViewStub>(R.id.richMessageTextViewStub)
private val plainMessageStub by bind<ViewStub>(R.id.plainMessageTextViewStub) private val plainMessageStub by bind<ViewStub>(R.id.plainMessageTextViewStub)
var richMessageView: AppCompatTextView? = null var richMessageView: EditorStyledTextView? = null
private set private set
var plainMessageView: AppCompatTextView? = null var plainMessageView: AppCompatTextView? = null
private set private set
fun requireRichMessageView(): AppCompatTextView { 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 richMessageView = view
return view return view
} }