@@ -44,6 +44,7 @@ import kotlin.reflect.KClass
4444
4545class BlockFormatter (editor : AztecText ,
4646 private val listStyle : ListStyle ,
47+ private val listItemStyle : ListItemStyle ,
4748 private val quoteStyle : QuoteStyle ,
4849 private val headerStyle : HeaderStyles ,
4950 private val preformatStyle : PreformatStyle ,
@@ -60,6 +61,8 @@ class BlockFormatter(editor: AztecText,
6061 }
6162 }
6263
64+ data class ListItemStyle (val strikeThroughCheckedItems : Boolean , val checkedItemsTextColor : Int )
65+
6366 data class QuoteStyle (val quoteBackground : Int , val quoteColor : Int , val quoteBackgroundAlpha : Float , val quoteMargin : Int , val quotePadding : Int , val quoteWidth : Int , val verticalPadding : Int )
6467 data class PreformatStyle (val preformatBackground : Int , val preformatBackgroundAlpha : Float , val preformatColor : Int , val verticalPadding : Int )
6568 data class HeaderStyles (val verticalPadding : Int , val styles : Map <AztecHeadingSpan .Heading , HeadingStyle >) {
@@ -452,7 +455,7 @@ class BlockFormatter(editor: AztecText,
452455 return when (textFormat) {
453456 AztecTextFormat .FORMAT_ORDERED_LIST -> listOf (createOrderedListSpan(nestingLevel, alignmentRendering, attrs, listStyle), createListItemSpan(nestingLevel + 1 , alignmentRendering))
454457 AztecTextFormat .FORMAT_UNORDERED_LIST -> listOf (createUnorderedListSpan(nestingLevel, alignmentRendering, attrs, listStyle), createListItemSpan(nestingLevel + 1 , alignmentRendering))
455- AztecTextFormat .FORMAT_TASK_LIST -> listOf (createTaskListSpan(nestingLevel, alignmentRendering, attrs, editor.context, listStyle), createListItemSpan(nestingLevel + 1 , alignmentRendering))
458+ AztecTextFormat .FORMAT_TASK_LIST -> listOf (createTaskListSpan(nestingLevel, alignmentRendering, attrs, editor.context, listStyle), createListItemSpan(nestingLevel + 1 , alignmentRendering, listItemStyle = listItemStyle ))
456459 AztecTextFormat .FORMAT_QUOTE -> listOf (createAztecQuoteSpan(nestingLevel, attrs, alignmentRendering, quoteStyle))
457460 AztecTextFormat .FORMAT_HEADING_1 ,
458461 AztecTextFormat .FORMAT_HEADING_2 ,
@@ -500,7 +503,7 @@ class BlockFormatter(editor: AztecText,
500503 typeIsAssignableTo(AztecOrderedListSpan ::class ) -> createOrderedListSpan(nestingLevel, alignmentRendering, attrs, listStyle)
501504 typeIsAssignableTo(AztecUnorderedListSpan ::class ) -> createUnorderedListSpan(nestingLevel, alignmentRendering, attrs, listStyle)
502505 typeIsAssignableTo(AztecTaskListSpan ::class ) -> createTaskListSpan(nestingLevel, alignmentRendering, attrs, editor.context, listStyle)
503- typeIsAssignableTo(AztecListItemSpan ::class ) -> createListItemSpan(nestingLevel, alignmentRendering, attrs)
506+ typeIsAssignableTo(AztecListItemSpan ::class ) -> createListItemSpan(nestingLevel, alignmentRendering, attrs, listItemStyle )
504507 typeIsAssignableTo(AztecQuoteSpan ::class ) -> createAztecQuoteSpan(nestingLevel, attrs, alignmentRendering, quoteStyle)
505508 typeIsAssignableTo(AztecHeadingSpan ::class ) -> createHeadingSpan(nestingLevel, textFormat, attrs, alignmentRendering, headerStyle)
506509 typeIsAssignableTo(AztecPreformatSpan ::class ) -> createPreformatSpan(nestingLevel, alignmentRendering, attrs, preformatStyle)
@@ -812,7 +815,7 @@ class BlockFormatter(editor: AztecText,
812815 BlockHandler .set(editableText, listSpan, start, end)
813816 // special case for styling single empty lines
814817 if (end - start == 1 && (editableText[end - 1 ] == ' \n ' || editableText[end - 1 ] == Constants .END_OF_BUFFER_MARKER )) {
815- ListItemHandler .newListItem(editableText, start, end, listSpan.nestingLevel + 1 , alignmentRendering)
818+ ListItemHandler .newListItem(editableText, start, end, listSpan.nestingLevel + 1 , alignmentRendering, listItemStyle )
816819 } else {
817820 val listEnd = if (end == editableText.length) end else end - 1
818821 val listContent = editableText.substring(start, listEnd)
@@ -831,7 +834,7 @@ class BlockFormatter(editor: AztecText,
831834 start + lineStart,
832835 start + lineEnd,
833836 listSpan.nestingLevel + 1 ,
834- alignmentRendering)
837+ alignmentRendering, listItemStyle )
835838 }
836839 }
837840 }
0 commit comments