diff --git a/composeApp/src/androidMain/kotlin/su/reya/coop/screens/chat/ChatInput.kt b/composeApp/src/androidMain/kotlin/su/reya/coop/screens/chat/ChatInput.kt index 7f09365..e1300a5 100644 --- a/composeApp/src/androidMain/kotlin/su/reya/coop/screens/chat/ChatInput.kt +++ b/composeApp/src/androidMain/kotlin/su/reya/coop/screens/chat/ChatInput.kt @@ -11,6 +11,7 @@ import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material3.FilledTonalIconButton import androidx.compose.material3.Icon import androidx.compose.material3.IconButton @@ -23,6 +24,8 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color +import androidx.compose.ui.text.input.ImeAction +import androidx.compose.ui.text.input.KeyboardCapitalization import androidx.compose.ui.unit.dp import coop.composeapp.generated.resources.Res import coop.composeapp.generated.resources.ic_add_circle @@ -52,6 +55,11 @@ fun ChatInput( value = value, onValueChange = onValueChange, placeholder = { Text("Message") }, + maxLines = 5, + keyboardOptions = KeyboardOptions( + capitalization = KeyboardCapitalization.Sentences, + imeAction = ImeAction.Default + ), leadingIcon = { IconButton(onClick = onUpload) { Icon( diff --git a/shared/src/commonMain/kotlin/su/reya/coop/Extensions.kt b/shared/src/commonMain/kotlin/su/reya/coop/Extensions.kt index 7b78f79..4850b96 100644 --- a/shared/src/commonMain/kotlin/su/reya/coop/Extensions.kt +++ b/shared/src/commonMain/kotlin/su/reya/coop/Extensions.kt @@ -10,14 +10,10 @@ fun PublicKey.short(): String { val URL_REGEX = Regex("(https?://\\S+)", RegexOption.IGNORE_CASE) private val imageExtensions = setOf("jpg", "jpeg", "png", "gif", "webp", "bmp") -fun String.extractUrls(): List { - return URL_REGEX.findAll(this).map { it.value }.toList() -} - fun String.removeImageUrls(): String { return URL_REGEX.replace(this) { result -> if (result.value.isImageUrl()) "" else result.value - }.replace(Regex("\\s+"), " ").trim() + }.trim() } fun String.isImageUrl(): Boolean {