Skip to content

Commit 1435aec

Browse files
committed
Fix task list indentation
1 parent 5219fa9 commit 1435aec

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

aztec/src/main/kotlin/org/wordpress/aztec/formatting/ListFormatter.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import org.wordpress.aztec.spans.AztecListItemSpan
55
import org.wordpress.aztec.spans.AztecListSpan
66
import org.wordpress.aztec.spans.AztecOrderedListSpan
77
import org.wordpress.aztec.spans.AztecOrderedListSpanAligned
8+
import org.wordpress.aztec.spans.AztecTaskListSpan
9+
import org.wordpress.aztec.spans.AztecTaskListSpanAligned
810
import org.wordpress.aztec.spans.AztecUnorderedListSpan
911
import org.wordpress.aztec.spans.AztecUnorderedListSpanAligned
1012
import org.wordpress.aztec.spans.IAztecBlockSpan
@@ -96,6 +98,14 @@ class ListFormatter(editor: AztecText) : AztecFormatter(editor) {
9698
is AztecOrderedListSpan -> AztecOrderedListSpan(updatedNestingLevel, attributes, listStyle)
9799
is AztecUnorderedListSpanAligned -> AztecUnorderedListSpanAligned(updatedNestingLevel, attributes, listStyle, alignment)
98100
is AztecUnorderedListSpan -> AztecUnorderedListSpan(updatedNestingLevel, attributes, listStyle)
101+
is AztecTaskListSpanAligned -> {
102+
val context = getContext() ?: return null
103+
AztecTaskListSpanAligned(updatedNestingLevel, attributes, context, listStyle, alignment)
104+
}
105+
is AztecTaskListSpan -> {
106+
val context = getContext() ?: return null
107+
AztecTaskListSpan(updatedNestingLevel, attributes, context, listStyle)
108+
}
99109
else -> null
100110
}
101111
}

aztec/src/main/kotlin/org/wordpress/aztec/spans/AztecTaskListSpan.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ open class AztecTaskListSpan(
6868
) : AztecListSpan(nestingLevel, listStyle.verticalPadding) {
6969
private var toggled: Boolean = false
7070
private var contextRef: WeakReference<Context> = WeakReference(context)
71+
72+
internal fun getContext(): Context? = contextRef.get()
7173
override val TAG = "ul"
7274

7375
override val startTag: String

0 commit comments

Comments
 (0)