|
|
@ -120,8 +120,8 @@ fun TextComposer( |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
val layoutModifier = modifier |
|
|
|
val layoutModifier = modifier |
|
|
|
.fillMaxSize() |
|
|
|
.fillMaxSize() |
|
|
|
.height(IntrinsicSize.Min) |
|
|
|
.height(IntrinsicSize.Min) |
|
|
|
|
|
|
|
|
|
|
|
val composerOptionsButton: @Composable () -> Unit = remember { |
|
|
|
val composerOptionsButton: @Composable () -> Unit = remember { |
|
|
|
@Composable { |
|
|
|
@Composable { |
|
|
@ -318,8 +318,8 @@ private fun StandardLayout( |
|
|
|
if (voiceMessageState is VoiceMessageState.Preview || voiceMessageState is VoiceMessageState.Recording) { |
|
|
|
if (voiceMessageState is VoiceMessageState.Preview || voiceMessageState is VoiceMessageState.Recording) { |
|
|
|
Box( |
|
|
|
Box( |
|
|
|
modifier = Modifier |
|
|
|
modifier = Modifier |
|
|
|
.padding(bottom = 5.dp, top = 5.dp, end = 3.dp, start = 3.dp) |
|
|
|
.padding(bottom = 5.dp, top = 5.dp, end = 3.dp, start = 3.dp) |
|
|
|
.size(48.dp), |
|
|
|
.size(48.dp), |
|
|
|
contentAlignment = Alignment.Center, |
|
|
|
contentAlignment = Alignment.Center, |
|
|
|
) { |
|
|
|
) { |
|
|
|
voiceDeleteButton() |
|
|
|
voiceDeleteButton() |
|
|
@ -329,8 +329,8 @@ private fun StandardLayout( |
|
|
|
} |
|
|
|
} |
|
|
|
Box( |
|
|
|
Box( |
|
|
|
modifier = Modifier |
|
|
|
modifier = Modifier |
|
|
|
.padding(bottom = 8.dp, top = 8.dp) |
|
|
|
.padding(bottom = 8.dp, top = 8.dp) |
|
|
|
.weight(1f) |
|
|
|
.weight(1f) |
|
|
|
) { |
|
|
|
) { |
|
|
|
voiceRecording() |
|
|
|
voiceRecording() |
|
|
|
} |
|
|
|
} |
|
|
@ -343,16 +343,16 @@ private fun StandardLayout( |
|
|
|
} |
|
|
|
} |
|
|
|
Box( |
|
|
|
Box( |
|
|
|
modifier = Modifier |
|
|
|
modifier = Modifier |
|
|
|
.padding(bottom = 8.dp, top = 8.dp) |
|
|
|
.padding(bottom = 8.dp, top = 8.dp) |
|
|
|
.weight(1f) |
|
|
|
.weight(1f) |
|
|
|
) { |
|
|
|
) { |
|
|
|
textInput() |
|
|
|
textInput() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
Box( |
|
|
|
Box( |
|
|
|
Modifier |
|
|
|
Modifier |
|
|
|
.padding(bottom = 5.dp, top = 5.dp, end = 6.dp, start = 6.dp) |
|
|
|
.padding(bottom = 5.dp, top = 5.dp, end = 6.dp, start = 6.dp) |
|
|
|
.size(48.dp), |
|
|
|
.size(48.dp), |
|
|
|
contentAlignment = Alignment.Center, |
|
|
|
contentAlignment = Alignment.Center, |
|
|
|
) { |
|
|
|
) { |
|
|
|
endButton() |
|
|
|
endButton() |
|
|
@ -374,8 +374,8 @@ private fun TextFormattingLayout( |
|
|
|
) { |
|
|
|
) { |
|
|
|
Box( |
|
|
|
Box( |
|
|
|
modifier = Modifier |
|
|
|
modifier = Modifier |
|
|
|
.weight(1f) |
|
|
|
.weight(1f) |
|
|
|
.padding(horizontal = 12.dp) |
|
|
|
.padding(horizontal = 12.dp) |
|
|
|
) { |
|
|
|
) { |
|
|
|
textInput() |
|
|
|
textInput() |
|
|
|
} |
|
|
|
} |
|
|
@ -419,11 +419,11 @@ private fun TextInputBox( |
|
|
|
|
|
|
|
|
|
|
|
Column( |
|
|
|
Column( |
|
|
|
modifier = Modifier |
|
|
|
modifier = Modifier |
|
|
|
.clip(roundedCorners) |
|
|
|
.clip(roundedCorners) |
|
|
|
.border(0.5.dp, borderColor, roundedCorners) |
|
|
|
.border(0.5.dp, borderColor, roundedCorners) |
|
|
|
.background(color = bgColor) |
|
|
|
.background(color = bgColor) |
|
|
|
.requiredHeightIn(min = 42.dp) |
|
|
|
.requiredHeightIn(min = 42.dp) |
|
|
|
.fillMaxSize(), |
|
|
|
.fillMaxSize(), |
|
|
|
) { |
|
|
|
) { |
|
|
|
if (composerMode is MessageComposerMode.Special) { |
|
|
|
if (composerMode is MessageComposerMode.Special) { |
|
|
|
ComposerModeView( |
|
|
|
ComposerModeView( |
|
|
@ -434,9 +434,9 @@ private fun TextInputBox( |
|
|
|
val defaultTypography = ElementTheme.typography.fontBodyLgRegular |
|
|
|
val defaultTypography = ElementTheme.typography.fontBodyLgRegular |
|
|
|
Box( |
|
|
|
Box( |
|
|
|
modifier = Modifier |
|
|
|
modifier = Modifier |
|
|
|
.padding(top = 4.dp, bottom = 4.dp, start = 12.dp, end = 12.dp) |
|
|
|
.padding(top = 4.dp, bottom = 4.dp, start = 12.dp, end = 12.dp) |
|
|
|
// Apply test tag only once, otherwise 2 nodes will have it (both the normal and subcomposing one) and tests will fail |
|
|
|
// Apply test tag only once, otherwise 2 nodes will have it (both the normal and subcomposing one) and tests will fail |
|
|
|
.then(if (!subcomposing) Modifier.testTag(TestTags.textEditor) else Modifier), |
|
|
|
.then(if (!subcomposing) Modifier.testTag(TestTags.textEditor) else Modifier), |
|
|
|
contentAlignment = Alignment.CenterStart, |
|
|
|
contentAlignment = Alignment.CenterStart, |
|
|
|
) { |
|
|
|
) { |
|
|
|
// Placeholder |
|
|
|
// Placeholder |
|
|
@ -482,8 +482,8 @@ private fun TextInput( |
|
|
|
// This prevents it gaining focus and mutating the state. |
|
|
|
// This prevents it gaining focus and mutating the state. |
|
|
|
registerStateUpdates = !subcomposing, |
|
|
|
registerStateUpdates = !subcomposing, |
|
|
|
modifier = Modifier |
|
|
|
modifier = Modifier |
|
|
|
.padding(top = 6.dp, bottom = 6.dp) |
|
|
|
.padding(top = 6.dp, bottom = 6.dp) |
|
|
|
.fillMaxWidth(), |
|
|
|
.fillMaxWidth(), |
|
|
|
style = ElementRichTextEditorStyle.composerStyle(hasFocus = state.hasFocus), |
|
|
|
style = ElementRichTextEditorStyle.composerStyle(hasFocus = state.hasFocus), |
|
|
|
resolveMentionDisplay = resolveMentionDisplay, |
|
|
|
resolveMentionDisplay = resolveMentionDisplay, |
|
|
|
resolveRoomMentionDisplay = resolveRoomMentionDisplay, |
|
|
|
resolveRoomMentionDisplay = resolveRoomMentionDisplay, |
|
|
@ -505,11 +505,13 @@ private fun aTextEditorStateMarkdownList() = persistentListOf( |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
private fun aTextEditorStateRichList() = persistentListOf( |
|
|
|
private fun aTextEditorStateRichList() = persistentListOf( |
|
|
|
aTextEditorStateRich(), |
|
|
|
aTextEditorStateRich(initialFocus = true), |
|
|
|
aTextEditorStateRich(initialText = "A message"), |
|
|
|
aTextEditorStateRich(initialText = "A message", initialFocus = true), |
|
|
|
aTextEditorStateRich( |
|
|
|
aTextEditorStateRich( |
|
|
|
initialText = "A message\nWith several lines\nTo preview larger textfields and long lines with overflow", |
|
|
|
initialText = "A message\nWith several lines\nTo preview larger textfields and long lines with overflow", |
|
|
|
|
|
|
|
initialFocus = true |
|
|
|
), |
|
|
|
), |
|
|
|
|
|
|
|
aTextEditorStateRich(initialText = "A message without focus", initialFocus = false), |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
@PreviewsDayNight |
|
|
|
@PreviewsDayNight |
|
|
|