Skip to content

Commit

Permalink
Use annotated string in BasicTextField instead of visual transformation
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamedRejeb committed Feb 20, 2024
1 parent 153b495 commit 71b040d
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ internal fun BasicRichTextEditor(
@Composable { innerTextField -> innerTextField() },
contentPadding: PaddingValues
) {
val scope = rememberCoroutineScope()
val density = LocalDensity.current
val localTextStyle = LocalTextStyle.current
val layoutDirection = LocalLayoutDirection.current
Expand Down Expand Up @@ -232,13 +231,11 @@ internal fun BasicRichTextEditor(

CompositionLocalProvider(LocalClipboardManager provides richClipboardManager) {
BasicTextField(
value = state.textFieldValue,
value = state.textFieldValue.copy(annotatedString = state.annotatedString),
onValueChange = {
if (readOnly) return@BasicTextField
if (it.text.length > maxLength) return@BasicTextField
// scope.launch {
// state.emitTextFieldValue(it)
// }

state.onTextFieldValueChange(it)
},
modifier = modifier
Expand Down Expand Up @@ -276,7 +273,6 @@ internal fun BasicRichTextEditor(
singleLine = singleLine,
maxLines = maxLines,
minLines = minLines,
visualTransformation = state.visualTransformation,
onTextLayout = {
state.onTextLayout(
textLayoutResult = it,
Expand Down

0 comments on commit 71b040d

Please sign in to comment.