File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed
richeditor-compose/src/commonMain/kotlin/com/mohamedrejeb/richeditor Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -75,6 +75,7 @@ import kotlin.math.max
7575import kotlin.reflect.KClass
7676import com.mohamedrejeb.richeditor.parser.utils.H1SpanStyle
7777import com.mohamedrejeb.richeditor.parser.utils.H2SpanStyle
78+ import com.mohamedrejeb.richeditor.parser.utils.H3SpanStyle
7879
7980/* *
8081 * rememberRichTextState - Creates and remembers a RichTextState instance with automatic state preservation.
@@ -300,6 +301,8 @@ public class RichTextState internal constructor(
300301 private set
301302 public var isH2: Boolean by mutableStateOf(false )
302303 private set
304+ public var isH3: Boolean by mutableStateOf(false )
305+ private set
303306
304307 public val config: RichTextConfig = RichTextConfig (
305308 updateText = {
@@ -4376,5 +4379,7 @@ public class RichTextState internal constructor(
43764379 currentStyle.fontWeight == H1SpanStyle .fontWeight
43774380 isH2 = currentStyle.fontSize == H2SpanStyle .fontSize &&
43784381 currentStyle.fontWeight == H2SpanStyle .fontWeight
4382+ isH3 = currentStyle.fontSize == H3SpanStyle .fontSize &&
4383+ currentStyle.fontWeight == H3SpanStyle .fontWeight
43794384 }
43804385}
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import com.mohamedrejeb.richeditor.paragraph.type.*
1313import com.mohamedrejeb.richeditor.parser.RichTextStateParser
1414import com.mohamedrejeb.richeditor.parser.utils.H1SpanStyle
1515import com.mohamedrejeb.richeditor.parser.utils.H2SpanStyle
16+ import com.mohamedrejeb.richeditor.parser.utils.H3SpanStyle
1617import androidx.compose.ui.util.fastForEach
1718
1819internal object RichTextStateLexicalParser : RichTextStateParser<String> {
@@ -341,6 +342,7 @@ internal object RichTextStateLexicalParser : RichTextStateParser<String> {
341342 val headingStyle = when (node.tag) {
342343 " h1" -> H1SpanStyle
343344 " h2" -> H2SpanStyle
345+ " h3" -> H3SpanStyle
344346 else -> null
345347 }
346348
@@ -951,6 +953,9 @@ internal object RichTextStateLexicalParser : RichTextStateParser<String> {
951953 spanStyle.fontSize == H2SpanStyle .fontSize &&
952954 spanStyle.fontWeight == H2SpanStyle .fontWeight -> " h2"
953955
956+ spanStyle.fontSize == H3SpanStyle .fontSize &&
957+ spanStyle.fontWeight == H3SpanStyle .fontWeight -> " h3"
958+
954959 else -> null
955960 }
956961 }
You can’t perform that action at this time.
0 commit comments