@@ -85,7 +85,7 @@ class PlaceholderManager(
8585 val drawable = buildPlaceholderDrawable(adapter, attrs)
8686 aztecText.insertMediaSpan(AztecPlaceholderSpan (aztecText.context, drawable, 0 , attrs,
8787 this , aztecText, adapter, TAG = htmlTag))
88- insertContentOverSpanWithId(attrs.getValue(UUID_ATTRIBUTE ), null )
88+ insertContentOverSpanWithId(attrs.getValue(UUID_ATTRIBUTE ))
8989 }
9090
9191 /* *
@@ -110,11 +110,11 @@ class PlaceholderManager(
110110 positionToId.filter {
111111 it.elementPosition >= selectionStart - 1
112112 }.forEach {
113- insertContentOverSpanWithId(it.uuid, it.elementTopOffset )
113+ insertContentOverSpanWithId(it.uuid)
114114 }
115115 }
116116
117- private suspend fun insertContentOverSpanWithId (uuid : String , currentTopOffset : Int? = null ) {
117+ private suspend fun insertContentOverSpanWithId (uuid : String ) {
118118 var aztecAttributes: AztecAttributes ? = null
119119 val predicate = object : AztecText .AttributePredicate {
120120 override fun matches (attrs : Attributes ): Boolean {
@@ -127,10 +127,10 @@ class PlaceholderManager(
127127 }
128128 val targetPosition = aztecText.getElementPosition(predicate) ? : return
129129
130- insertInPosition(aztecAttributes ? : return , targetPosition, currentTopOffset )
130+ insertInPosition(aztecAttributes ? : return , targetPosition)
131131 }
132132
133- private suspend fun insertInPosition (attrs : AztecAttributes , targetPosition : Int , currentTopOffset : Int? = null ) {
133+ private suspend fun insertInPosition (attrs : AztecAttributes , targetPosition : Int ) {
134134 if (! validateAttributes(attrs)) {
135135 return
136136 }
@@ -148,14 +148,8 @@ class PlaceholderManager(
148148 parentTextViewRect.top + = parentTextViewTopAndBottomOffset
149149 parentTextViewRect.bottom + = parentTextViewTopAndBottomOffset
150150
151- if (currentTopOffset != null ) {
152- if (targetLineOffset != 0 && currentTopOffset == parentTextViewRect.top) {
153- return
154- } else {
155- positionToId.removeAll {
156- it.uuid == uuid
157- }
158- }
151+ positionToId.removeAll {
152+ it.uuid == uuid
159153 }
160154
161155 var box = container.findViewWithTag<View >(uuid)
@@ -179,7 +173,7 @@ class PlaceholderManager(
179173 box.tag = uuid
180174 box.setBackgroundColor(Color .TRANSPARENT )
181175 box.setOnTouchListener(adapter)
182- positionToId.add(Placeholder (targetPosition, parentTextViewRect.top, uuid))
176+ positionToId.add(Placeholder (targetPosition, uuid))
183177 if (! exists && box.parent == null ) {
184178 container.addView(box)
185179 adapter.onViewCreated(box, uuid)
@@ -434,7 +428,7 @@ class PlaceholderManager(
434428 }
435429 }
436430
437- data class Placeholder (val elementPosition : Int , val elementTopOffset : Int , val uuid : String )
431+ data class Placeholder (val elementPosition : Int , val uuid : String )
438432
439433 companion object {
440434 private const val DEFAULT_HTML_TAG = " placeholder"
0 commit comments