File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
media-placeholders/src/main/java/org/wordpress/aztec/placeholders Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -82,12 +82,17 @@ class ImageWithCaptionAdapter(
8282 private const val SRC_ATTRIBUTE = " src"
8383
8484 suspend fun insertImageWithCaption (placeholderManager : PlaceholderManager , src : String , caption : String ) {
85- placeholderManager.insertOrUpdateItem(ADAPTER_TYPE ) { currentAttributes, type ->
85+ placeholderManager.insertOrUpdateItem(ADAPTER_TYPE ) { currentAttributes, type, placeAtStart ->
8686 if (currentAttributes == null || type != ADAPTER_TYPE ) {
8787 mapOf (SRC_ATTRIBUTE to src, CAPTION_ATTRIBUTE to caption)
8888 } else {
8989 val currentCaption = currentAttributes[CAPTION_ATTRIBUTE ]
90- mapOf (SRC_ATTRIBUTE to src, CAPTION_ATTRIBUTE to " $caption - $currentCaption " )
90+ val newCaption = if (placeAtStart) {
91+ " $caption - $currentCaption "
92+ } else {
93+ " $currentCaption - $caption "
94+ }
95+ mapOf (SRC_ATTRIBUTE to src, CAPTION_ATTRIBUTE to newCaption)
9196 }
9297 }
9398 }
You can’t perform that action at this time.
0 commit comments