Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Block Editor: Fix issue when multiple media selection adds only one image or video block.
* Block Editor: Add Link Target (Open in new tab) to Image Block.
* Block Editor: New block "Media & Text".
* Block Editor: Fix issue where the block inserter layout wasn't correct after device rotation.

13.4
-----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ public class PostUtils {

private static final String GUTENBERG_BLOCK_START = "<!-- wp:";
private static final int SRC_ATTRIBUTE_LENGTH_PLUS_ONE = 5;
private static final String GB_IMG_BLOCK_HEADER_PLACEHOLDER = "<!-- wp:image {\"id\":%s} -->";
private static final String GB_IMG_BLOCK_HEADER_PLACEHOLDER = "<!-- wp:image {\"id\":%s";
private static final String GB_IMG_BLOCK_CLASS_PLACEHOLDER = "class=\"wp-image-%s\"";
private static final String GB_MEDIA_TEXT_BLOCK_HEADER_PLACEHOLDER = "<!-- wp:media-text {\"mediaId\":%s";

public static Map<String, Object> addPostTypeToAnalyticsProperties(PostModel post, Map<String, Object> properties) {
if (properties == null) {
Expand Down Expand Up @@ -416,6 +417,11 @@ public static String replaceMediaFileWithUrlInGutenbergPost(@NonNull String post
String newImgBlockHeader = String.format(GB_IMG_BLOCK_HEADER_PLACEHOLDER, mediaFile.getMediaId());
postContent = postContent.replace(oldImgBlockHeader, newImgBlockHeader);

String oldMediaTextBlockHeader = String.format(GB_MEDIA_TEXT_BLOCK_HEADER_PLACEHOLDER, localMediaId);
String newMediaTextBlockHeader = String.format(GB_MEDIA_TEXT_BLOCK_HEADER_PLACEHOLDER,
mediaFile.getMediaId());
postContent = postContent.replace(oldMediaTextBlockHeader, newMediaTextBlockHeader);

// replace class wp-image-id with serverMediaId, and url_holder with remoteUrl
String oldImgClass = String.format(GB_IMG_BLOCK_CLASS_PLACEHOLDER, localMediaId);
String newImgClass = String.format(GB_IMG_BLOCK_CLASS_PLACEHOLDER, mediaFile.getMediaId());
Expand Down