Skip to content

Commit 5f5f850

Browse files
authored
Merge pull request #257 from magento-obsessive-owls/MC-15970
MC-15970 and sync 1.0-develop w/ 1.0.1-release branch
2 parents fba475c + 079c211 commit 5f5f850

File tree

197 files changed

+40
-12663
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

197 files changed

+40
-12663
lines changed

app/code/Magento/PageBuilder/Model/Stage/HtmlFilter.php

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,28 @@ public function filterHtml(string $content): string
4949
$this->loggerInterface->critical($e->getMessage());
5050
}
5151
libxml_use_internal_errors($previous);
52-
// Remove all <script /> tags from output
53-
foreach (iterator_to_array($dom->getElementsByTagName('script')) as $item) {
54-
$item->parentNode->removeChild($item);
52+
// Remove all <script /> tags, on* attributes from output
53+
/** @var \DOMElement $item */
54+
foreach (iterator_to_array($dom->getElementsByTagName('*')) as $item) {
55+
if (in_array($item->tagName, ['script', 'meta', 'embed', 'object'])) {
56+
$item->parentNode->removeChild($item);
57+
} else {
58+
foreach (iterator_to_array($item->attributes) as $attribute) {
59+
if (stripos($attribute->name, 'on') === 0 ||
60+
stripos(ltrim($attribute->value), 'javascript') === 0
61+
) {
62+
$item->removeAttribute($attribute->name);
63+
}
64+
}
65+
}
5566
}
5667
$xpath = new \DOMXPath($dom);
5768
$htmlContentTypes = $xpath->query(
5869
'//*[@data-content-type="html" and not(contains(@class, "placeholder-html-code"))]'
5970
);
6071
foreach ($htmlContentTypes as $htmlContentType) {
6172
/* @var \DOMElement $htmlContentType */
62-
$innerHTML= '';
73+
$innerHTML = '';
6374
$children = $htmlContentType->childNodes;
6475
foreach ($children as $child) {
6576
$innerHTML .= $child->ownerDocument->saveXML($child);

app/code/Magento/PageBuilder/Test/Mftf/Data/HtmlData.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<data key="section">general</data>
2323
<data key="fieldName">html</data>
2424
<data key="value">&lt;a class=&quot;pagebuilder-button-primary&quot; onclick=&quot;location.href = 'https://google.com';&quot;&gt;&lt;span&gt;Test Button&lt;/span&gt;&lt;/a&gt;</data>
25+
<data key="valueOnStage">&lt;a class=&quot;pagebuilder-button-primary&quot;&gt;&lt;span&gt;Test Button&lt;/span&gt;&lt;/a&gt;</data>
2526
<data key="selector">[contains(text(), 'a class="pagebuilder-button-primary"')]</data>
2627
<data key="selectorOnFrontend">//a[@class='pagebuilder-button-primary' and @onclick=&quot;location.href = 'https://google.com';&quot;]//span[.='Test Button']</data>
2728
<data key="url">https://www.google.com/</data>

app/code/Magento/PageBuilder/Test/Mftf/Test/AdminPageBuilderBlockTest.xml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,12 @@
102102
</actionGroup>
103103
<see userInput="$$createPreReqBlock.content$$" stepKey="seeBlockContentOnCmsStage"/>
104104
</test>
105-
<test name="BlockGetUpdated">
105+
<test name="BlockGetsUpdated">
106106
<annotations>
107107
<features value="PageBuilder"/>
108108
<stories value="Block"/>
109-
<title value="Block Content Block get updated"/>
110-
<description value="Verify that Block Content Block get updated from Block entities"/>
109+
<title value="Block Content Block gets updated"/>
110+
<description value="Verify that Block Content Type gets updated from Block entities"/>
111111
<severity value="CRITICAL"/>
112112
<testCaseId value="MC-2289"/>
113113
<useCaseId value="MC-1420"/>
@@ -126,7 +126,7 @@
126126
<actionGroup ref="EnabledWYSIWYG" stepKey="enableWYSIWYG"/>
127127
<actionGroup ref="logout" stepKey="logout"/>
128128
</after>
129-
<actionGroup ref="navigateToCreatedCMSPage" stepKey="navigateToCreatedCmsPage1">
129+
<actionGroup ref="navigateToCreatedCMSPage" stepKey="navigateToCreatedCMSPageInAdmin">
130130
<argument name="CMSPage" value="$$createCMSPage$$"/>
131131
</actionGroup>
132132
<actionGroup ref="expandPageBuilderPanelMenuSection" stepKey="expandMenuSectionAddContent">
@@ -154,8 +154,10 @@
154154
<actionGroup ref="navigateToStorefrontForCreatedPage" stepKey="navigateToCMSPageStorefront">
155155
<argument name="page" value="$$createCMSPage.identifier$$"/>
156156
</actionGroup>
157-
<see userInput="$$createPreReqBlock.content$$" stepKey="seeBlockContentOnCmsStage"/>
158-
<actionGroup ref="navigateToCreatedCMSBlockPage" stepKey="navigateToCreatedCmsBlock">
157+
<see userInput="$$createPreReqBlock.content$$" stepKey="seeBlockContentOnStorefront"/>
158+
<!-- Update block content in admin -->
159+
<comment userInput="Update block content in admin" stepKey="commentUpdateBlockContentInAdmin"/>
160+
<actionGroup ref="navigateToCreatedCMSBlockPage" stepKey="navigateToCreatedCmsBlockInAdmin">
159161
<argument name="CMSBlockPage" value="$$createPreReqBlock$$"/>
160162
</actionGroup>
161163
<actionGroup ref="openPageBuilderEditPanel" stepKey="openEditMenuOnStage2">
@@ -166,14 +168,14 @@
166168
</actionGroup>
167169
<actionGroup ref="saveEditPanelSettings" stepKey="saveEditPanelSettings2"/>
168170
<actionGroup ref="saveCMSBlock" stepKey="saveCMSBlock"/>
169-
<actionGroup ref="navigateToCreatedCMSPage" stepKey="navigateToCreatedCmsPage2">
171+
<!-- Validate Stage after updating block -->
172+
<comment userInput="Validate stage after updating block" stepKey="validateStage2"/>
173+
<actionGroup ref="navigateToCreatedCMSPage" stepKey="navigateToCreatedCMSPageInAdmin2">
170174
<argument name="CMSPage" value="$$createCMSPage$$"/>
171175
</actionGroup>
172-
<!-- Validate Stage -->
173-
<comment userInput="Validate stage after updating block" stepKey="validateStage2"/>
174176
<actionGroup ref="switchToPageBuilderStage" stepKey="switchToPageBuilderStage"/>
175177
<waitForElementVisible selector="{{HtmlOnStage.base('1')}}" stepKey="waitForHtmlBaseStage1"/>
176-
<see selector="{{BlockOnStage.html('1', '1')}}" userInput="{{PageBuilderHtmlPropertyButton.value}}" stepKey="waitForHtmlStage1"/>
178+
<see selector="{{BlockOnStage.html('1', '1')}}" userInput="{{PageBuilderHtmlPropertyButton.valueOnStage}}" stepKey="waitForHtmlStage1"/>
177179
<actionGroup ref="ClearCacheActionGroup" stepKey="clearMagentoCache"/>
178180
<!-- Validate Storefront -->
179181
<comment userInput="Validate storefront after updating block" stepKey="validateStorefront2"/>

app/code/Magento/PageBuilder/view/adminhtml/web/js/utils/nesting-link-dialog.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/utils/nesting-link-dialog.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export default function nestingLinkDialog(
2828
const dataStoreContent = dataStore.getState() as DataObject;
2929
const inlineMessage = dataStoreContent[inlineMessageField] as string;
3030
const linkUrl = dataStoreContent[linkUrlField] as FieldDefaultsInterface;
31-
const aLinkRegex = /<a[\s]+([^>]+)>|<a>|<\/a>/igm;
31+
const aLinkRegex = /(<a[\s]+[^>]+).+(?=<\/a>)<\/a>/igm;
3232
if (wysiwyg &&
3333
inlineMessage.match(aLinkRegex) &&
3434
linkUrl &&

0 commit comments

Comments
 (0)