Skip to content

Commit 912abc4

Browse files
PB-370: Introduce upgrade mechanism for Page Builder content
- fix content upgrade
1 parent ee3337c commit 912abc4

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

app/code/Magento/PageBuilder/Model/Dom/Document.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,18 @@ public function getMetadata($key = null)
209209
*/
210210
public function stripHtmlWrapperTags(): string
211211
{
212-
preg_match('/<body>(.*)<\/body>/', $this->getContents(), $matches);
213-
return isset($matches[1]) ? $matches[1] : '';
212+
$result = '';
213+
preg_match('/<body>(.*)<\/body>/s', $this->saveHTML(), $matches);
214+
215+
if (isset($matches[1])) {
216+
$result = preg_replace_callback(
217+
'/=\"(%7B%7B[^"]*%7D%7D)\"/m',
218+
function ($matches) {
219+
return urldecode($matches[0]);
220+
},
221+
$matches[1]
222+
);
223+
}
224+
return $result;
214225
}
215226
}

app/code/Magento/PageBuilder/Setup/Converters/FixFullWidthRowPadding.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,6 @@ public function convert($value)
5050
$innerDiv = $row->querySelector(".row-full-width-inner");
5151
$innerDiv->addStyle("padding", $padding);
5252
}
53-
return $fullWidthRows->count() > 0 ? $document->stripHtmlWrapperTags() : $value;
53+
return $fullWidthRows->count() > 0 ? ($document->stripHtmlWrapperTags() ?: $value) : $value;
5454
}
5555
}

0 commit comments

Comments
 (0)