Skip to content

Commit fd2b3b2

Browse files
committed
Make sure correct width is used so that the placeholder doesn't overlap the cursor
1 parent f11115e commit fd2b3b2

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

media-placeholders/src/main/java/org/wordpress/aztec/placeholders/PlaceholderManager.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ class PlaceholderManager(
161161
val parentTextViewTopAndBottomOffset = aztecText.scrollY + aztecText.compoundPaddingTop
162162

163163
val adapter = adapters[type]!!
164-
val height = adapter.calculateHeight(attrs, parentTextViewRect.right - parentTextViewRect.left - 20)
164+
val windowWidth = parentTextViewRect.right - parentTextViewRect.left - 20
165+
val height = adapter.calculateHeight(attrs, windowWidth)
165166
parentTextViewRect.top += parentTextViewTopAndBottomOffset
166167
parentTextViewRect.bottom = parentTextViewRect.top + height
167168

@@ -175,14 +176,14 @@ class PlaceholderManager(
175176
box = adapter.createView(container.context, uuid, attrs)
176177
}
177178
val params = FrameLayout.LayoutParams(
178-
adapter.calculateWidth(attrs, parentTextViewRect.right - parentTextViewRect.left - 20),
179-
height
179+
adapter.calculateWidth(attrs, windowWidth) - 20,
180+
height - 20
180181
)
181182
val padding = 10
182183
params.setMargins(
183184
parentTextViewRect.left + padding + aztecText.paddingStart,
184185
parentTextViewRect.top + padding,
185-
parentTextViewRect.right - padding - aztecText.paddingEnd,
186+
0,
186187
0
187188
)
188189
box.layoutParams = params

0 commit comments

Comments
 (0)