Skip to content

Commit 91d45dc

Browse files
committed
Clear all placeholder views before HTML is processed
1 parent d96c527 commit 91d45dc

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import org.wordpress.aztec.AztecContentChangeWatcher
2525
import org.wordpress.aztec.AztecText
2626
import org.wordpress.aztec.Constants
2727
import org.wordpress.aztec.Html
28+
import org.wordpress.aztec.plugins.html2visual.IHtmlPreprocessor
2829
import org.wordpress.aztec.plugins.html2visual.IHtmlTagHandler
2930
import org.wordpress.aztec.spans.AztecMediaClickableSpan
3031
import org.xml.sax.Attributes
@@ -52,7 +53,8 @@ class PlaceholderManager(
5253
Html.MediaCallback,
5354
AztecText.OnMediaDeletedListener,
5455
AztecText.OnVisibilityChangeListener,
55-
CoroutineScope {
56+
CoroutineScope,
57+
IHtmlPreprocessor {
5658
private val adapters = mutableMapOf<String, PlaceholderAdapter>()
5759
private val positionToIdMutex = Mutex()
5860
private val positionToId = mutableSetOf<Placeholder>()
@@ -585,4 +587,11 @@ class PlaceholderManager(
585587
private const val TYPE_ATTRIBUTE = "type"
586588
private const val EDITOR_INNER_PADDING = 20
587589
}
590+
591+
override fun beforeHtmlProcessed(source: String): String {
592+
runBlocking {
593+
clearAllViews()
594+
}
595+
return source
596+
}
588597
}

0 commit comments

Comments
 (0)