Skip to content

Commit

Permalink
Merge pull request #8743 from element-hq/feature/bma/editorIssue
Browse files Browse the repository at this point in the history
Fix Rich Text Editor issues: save formatted text in draft and keep formatting when switching between modes
  • Loading branch information
ganfra authored May 28, 2024
2 parents 204244b + 2395d72 commit 22f69ec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog.d/7466.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Restore formatting when restoring a draft. Also keep formatting when switching composer mode.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import com.vanniktech.emoji.EmojiPopup
import dagger.hilt.android.AndroidEntryPoint
import im.vector.app.R
import im.vector.app.core.error.fatalError
import im.vector.app.core.extensions.orEmpty
import im.vector.app.core.extensions.registerStartForActivityResult
import im.vector.app.core.extensions.showKeyboard
import im.vector.app.core.glide.GlideApp
Expand Down Expand Up @@ -255,7 +256,7 @@ class MessageComposerFragment : VectorBaseFragment<FragmentComposerBinding>(), A
it.isRecordingVoiceBroadcast && !requireActivity().isChangingConfigurations -> timelineViewModel.handle(VoiceBroadcastAction.Recording.Pause)
else -> {
timelineViewModel.handle(VoiceBroadcastAction.Listening.Pause)
messageComposerViewModel.handle(MessageComposerAction.OnEntersBackground(composer.text.toString()))
messageComposerViewModel.handle(MessageComposerAction.OnEntersBackground(composer.formattedText ?: composer.text.orEmpty().toString()))
}
}
}
Expand Down Expand Up @@ -403,7 +404,7 @@ class MessageComposerFragment : VectorBaseFragment<FragmentComposerBinding>(), A
}

override fun onTextChanged(text: CharSequence) {
messageComposerViewModel.handle(MessageComposerAction.OnTextChanged(text))
messageComposerViewModel.handle(MessageComposerAction.OnTextChanged(composer.formattedText ?: text))
}

override fun onFullScreenModeChanged() = withState(messageComposerViewModel) { state ->
Expand Down

0 comments on commit 22f69ec

Please sign in to comment.