Skip to content

Commit

Permalink
Merge pull request #217 from Wavesonics/return-self
Browse files Browse the repository at this point in the history
Return this for chaining
  • Loading branch information
MohamedRejeb committed Mar 13, 2024
2 parents da63698 + 47e91e2 commit 82db1a1
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2130,7 +2130,7 @@ class RichTextState internal constructor(
*
* @param text The text to update the [RichTextState] with.
*/
fun setText(text: String) {
fun setText(text: String): RichTextState {
val textFieldValue =
TextFieldValue(
text = text,
Expand All @@ -2140,26 +2140,29 @@ class RichTextState internal constructor(
onTextFieldValueChange(
newTextFieldValue = textFieldValue
)
return this
}

/**
* Updates the [RichTextState] with the given [html].
*
* @param html The html to update the [RichTextState] with.
*/
fun setHtml(html: String) {
fun setHtml(html: String): RichTextState {
val richParagraphList = RichTextStateHtmlParser.encode(html).richParagraphList
updateRichParagraphList(richParagraphList)
return this
}

/**
* Updates the [RichTextState] with the given [markdown].
*
* @param markdown The markdown to update the [RichTextState] with.
*/
fun setMarkdown(markdown: String) {
fun setMarkdown(markdown: String): RichTextState {
val richParagraphList = RichTextStateMarkdownParser.encode(markdown).richParagraphList
updateRichParagraphList(richParagraphList)
return this
}

/**
Expand Down

0 comments on commit 82db1a1

Please sign in to comment.