From 815b09bb2c995811a0fc0dac354fa7d264dc927c Mon Sep 17 00:00:00 2001 From: Wavesonics Date: Tue, 12 Mar 2024 20:48:11 -0700 Subject: [PATCH 1/2] Return this for chaining --- .../mohamedrejeb/richeditor/model/RichTextState.kt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/richeditor-compose/src/commonMain/kotlin/com/mohamedrejeb/richeditor/model/RichTextState.kt b/richeditor-compose/src/commonMain/kotlin/com/mohamedrejeb/richeditor/model/RichTextState.kt index a453e507..fca42049 100644 --- a/richeditor-compose/src/commonMain/kotlin/com/mohamedrejeb/richeditor/model/RichTextState.kt +++ b/richeditor-compose/src/commonMain/kotlin/com/mohamedrejeb/richeditor/model/RichTextState.kt @@ -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, @@ -2140,6 +2140,7 @@ class RichTextState internal constructor( onTextFieldValueChange( newTextFieldValue = textFieldValue ) + return this } /** @@ -2147,9 +2148,10 @@ class RichTextState internal constructor( * * @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 } /** @@ -2157,9 +2159,10 @@ class RichTextState internal constructor( * * @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 } /** @@ -2301,5 +2304,7 @@ class RichTextState internal constructor( richTextState } ) + + } } \ No newline at end of file From 47e91e2e7f2975f7e6b8ed28e363bf9a53cb186a Mon Sep 17 00:00:00 2001 From: Wavesonics Date: Tue, 12 Mar 2024 20:50:07 -0700 Subject: [PATCH 2/2] clean up --- .../kotlin/com/mohamedrejeb/richeditor/model/RichTextState.kt | 2 -- 1 file changed, 2 deletions(-) diff --git a/richeditor-compose/src/commonMain/kotlin/com/mohamedrejeb/richeditor/model/RichTextState.kt b/richeditor-compose/src/commonMain/kotlin/com/mohamedrejeb/richeditor/model/RichTextState.kt index fca42049..783a5e66 100644 --- a/richeditor-compose/src/commonMain/kotlin/com/mohamedrejeb/richeditor/model/RichTextState.kt +++ b/richeditor-compose/src/commonMain/kotlin/com/mohamedrejeb/richeditor/model/RichTextState.kt @@ -2304,7 +2304,5 @@ class RichTextState internal constructor( richTextState } ) - - } } \ No newline at end of file