Skip to content

Commit ab88042

Browse files
committed
Merge remote-tracking branch 'origin/2.4-develop' into MC-33363
2 parents 2bf8c27 + d4a9098 commit ab88042

File tree

15 files changed

+201
-70
lines changed

15 files changed

+201
-70
lines changed

app/code/Magento/Cms/Model/Wysiwyg/Gallery/DefaultConfigProvider.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88

99
namespace Magento\Cms\Model\Wysiwyg\Gallery;
1010

11+
use Magento\Ui\Component\Form\Element\DataType\Media\OpenDialogUrl;
12+
13+
/**
14+
* @inheritdoc
15+
*/
1116
class DefaultConfigProvider implements \Magento\Framework\Data\Wysiwyg\ConfigProviderInterface
1217
{
1318
/**
@@ -30,26 +35,34 @@ class DefaultConfigProvider implements \Magento\Framework\Data\Wysiwyg\ConfigPro
3035
*/
3136
private $currentTreePath;
3237

38+
/**
39+
* @var OpednDialogUrl
40+
*/
41+
private $openDialogUrl;
42+
3343
/**
3444
* @param \Magento\Backend\Model\UrlInterface $backendUrl
3545
* @param \Magento\Cms\Helper\Wysiwyg\Images $imagesHelper
46+
* @param OpenDialogUrl $openDialogUrl
3647
* @param array $windowSize
3748
* @param string|null $currentTreePath
3849
*/
3950
public function __construct(
4051
\Magento\Backend\Model\UrlInterface $backendUrl,
4152
\Magento\Cms\Helper\Wysiwyg\Images $imagesHelper,
53+
OpenDialogUrl $openDialogUrl,
4254
array $windowSize = [],
4355
$currentTreePath = null
4456
) {
4557
$this->backendUrl = $backendUrl;
4658
$this->imagesHelper = $imagesHelper;
59+
$this->openDialogUrl = $openDialogUrl;
4760
$this->windowSize = $windowSize;
4861
$this->currentTreePath = $currentTreePath;
4962
}
5063

5164
/**
52-
* {@inheritdoc}
65+
* @inheritdoc
5366
*/
5467
public function getConfig(\Magento\Framework\DataObject $config) : \Magento\Framework\DataObject
5568
{
@@ -72,7 +85,7 @@ public function getConfig(\Magento\Framework\DataObject $config) : \Magento\Fram
7285
[
7386
'add_images' => true,
7487
'files_browser_window_url' => $this->backendUrl->getUrl(
75-
'cms/wysiwyg_images/index',
88+
$this->openDialogUrl->get(),
7689
$fileBrowserUrlParams
7790
),
7891
'files_browser_window_width' => $this->windowSize['width'],
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminDisableWYSIWYGActionGroup">
12+
<annotations>
13+
<description>Runs bin/magento command to disable WYSIWYG</description>
14+
</annotations>
15+
16+
<magentoCLI stepKey="disableWYSIWYG" command="config:set cms/wysiwyg/enabled disabled"/>
17+
</actionGroup>
18+
</actionGroups>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminEnableWYSIWYGActionGroup">
12+
<annotations>
13+
<description>Runs bin/magento command to enable WYSIWYG</description>
14+
</annotations>
15+
16+
<magentoCLI stepKey="enableWYSIWYG" command="config:set cms/wysiwyg/enabled enabled"/>
17+
</actionGroup>
18+
</actionGroups>

app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertStorefrontTextOnCategoryPageActionGroup.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616
<waitForPageLoad stepKey="waitForPageLoad1"/>
1717
<see selector="{{StorefrontCategoryMainSection.CategoryTitle}}" userInput="{{category.name_lwr}}" stepKey="assertCategoryOnStorefront"/>
1818
<seeInTitle userInput="{{category.name}}" stepKey="seeCategoryNameInTitle"/>
19-
<see selector="{{StorefrontCMSPageSection.mainContent}}" userInput="{{text}}" stepKey="seeAssertTextInMainContent"/>
19+
<see userInput="{{text}}" stepKey="seeAssertTextInMainContent"/>
2020
</actionGroup>
2121
</actionGroups>

dev/tests/acceptance/tests/_suite/WYSIWYGDisabledSuite.xml renamed to app/code/Magento/Cms/Test/Mftf/Suite/WYSIWYGDisabledSuite.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<suites xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Suite/etc/suiteSchema.xsd">
99
<suite name="WYSIWYGDisabledSuite">
1010
<before>
11-
<magentoCLI stepKey="disableWYSYWYG" command="config:set cms/wysiwyg/enabled disabled" />
11+
<actionGroup ref="AdminDisableWYSIWYGActionGroup" stepKey="disableWYSYWYG" />
1212
</before>
1313
<include>
1414
<group name="WYSIWYGDisabled"/>
@@ -17,7 +17,7 @@
1717
<group name="skip"/>
1818
</exclude>
1919
<after>
20-
<magentoCLI stepKey="disableWYSYWYG" command="config:set cms/wysiwyg/enabled enabled" />
20+
<actionGroup ref="AdminEnableWYSIWYGActionGroup" stepKey="disableWYSYWYG" />
2121
</after>
2222
</suite>
2323
</suites>

app/code/Magento/Tinymce3/Model/Config/Gallery/Config.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
namespace Magento\Tinymce3\Model\Config\Gallery;
99

10+
use Magento\Ui\Component\Form\Element\DataType\Media\OpenDialogUrl;
11+
1012
/**
1113
* Class Config adds information about required configurations to display media gallery of tinymce3 editor
1214
*
@@ -19,13 +21,21 @@ class Config implements \Magento\Framework\Data\Wysiwyg\ConfigProviderInterface
1921
*/
2022
private $backendUrl;
2123

24+
/**
25+
* @var OpednDialogUrl
26+
*/
27+
private $openDialogUrl;
28+
2229
/**
2330
* @param \Magento\Backend\Model\UrlInterface $backendUrl
31+
* @param OpenDialogUrl $openDialogUrl
2432
*/
2533
public function __construct(
26-
\Magento\Backend\Model\UrlInterface $backendUrl
34+
\Magento\Backend\Model\UrlInterface $backendUrl,
35+
OpenDialogUrl $openDialogUrl
2736
) {
2837
$this->backendUrl = $backendUrl;
38+
$this->openDialogUrl = $openDialogUrl;
2939
}
3040

3141
/**
@@ -39,7 +49,7 @@ public function getConfig(\Magento\Framework\DataObject $config) : \Magento\Fram
3949
$config->addData(
4050
[
4151
'add_images' => true,
42-
'files_browser_window_url' => $this->backendUrl->getUrl('cms/wysiwyg_images/index'),
52+
'files_browser_window_url' => $this->backendUrl->getUrl($this->openDialogUrl->get()),
4353
]
4454
);
4555

app/code/Magento/Tinymce3/composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
"magento/module-backend": "*",
88
"magento/module-ui": "*",
99
"magento/module-variable": "*",
10-
"magento/module-widget": "*",
11-
"magento/module-cms": "*"
10+
"magento/module-widget": "*"
1211

1312
},
1413
"suggest": {

app/code/Magento/Ui/Component/Form/Element/DataType/Media/Image.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,35 +31,43 @@ class Image extends Media
3131
*/
3232
private $fileSize;
3333

34+
/**
35+
* @var OpednDialogUrl
36+
*/
37+
private $openDialogUrl;
38+
3439
/**
3540
* @param ContextInterface $context
3641
* @param StoreManagerInterface $storeManager
3742
* @param Size $fileSize
43+
* @param OpenDialogUrl $openDialogUrl
3844
* @param UiComponentInterface[] $components
3945
* @param array $data
4046
*/
4147
public function __construct(
4248
ContextInterface $context,
4349
StoreManagerInterface $storeManager,
4450
Size $fileSize,
51+
OpenDialogUrl $openDialogUrl,
4552
array $components = [],
4653
array $data = []
4754
) {
4855
$this->storeManager = $storeManager;
4956
$this->fileSize = $fileSize;
57+
$this->openDialogUrl = $openDialogUrl;
5058
parent::__construct($context, $components, $data);
5159
}
5260

5361
/**
54-
* {@inheritdoc}
62+
* @inheritdoc
5563
*/
5664
public function getComponentName()
5765
{
5866
return static::NAME;
5967
}
6068

6169
/**
62-
* {@inheritdoc}
70+
* @inheritdoc
6371
*/
6472
public function prepare()
6573
{
@@ -75,7 +83,10 @@ public function prepare()
7583
'config' => [
7684
'maxFileSize' => $maxFileSize,
7785
'mediaGallery' => [
78-
'openDialogUrl' => $this->getContext()->getUrl('cms/wysiwyg_images/index', ['_secure' => true]),
86+
'openDialogUrl' => $this->getContext()->getUrl(
87+
$this->openDialogUrl->get(),
88+
['_secure' => true]
89+
),
7990
'openDialogTitle' => $this->getConfiguration()['openDialogTitle'] ?? __('Insert Images...'),
8091
'initialOpenSubpath' => $this->getConfiguration()['initialMediaGalleryOpenSubpath'],
8192
'storeId' => $this->storeManager->getStore()->getId(),
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\Ui\Component\Form\Element\DataType\Media;
10+
11+
use Magento\Framework\DataObject;
12+
13+
/**
14+
* Basic configuration for OdenDialogUrl
15+
*/
16+
class OpenDialogUrl
17+
{
18+
private const DEFAULT_OPEN_DIALOG_URL = 'cms/wysiwyg_images/index';
19+
20+
/**
21+
* @var string
22+
*/
23+
private $openDialogUrl;
24+
25+
/**
26+
* @param DataObject $url
27+
*/
28+
public function __construct(DataObject $url = null)
29+
{
30+
$this->openDialogUrl = $url;
31+
}
32+
33+
/**
34+
* Returns open dialog url for media browser
35+
*
36+
* @return string
37+
*/
38+
public function get(): string
39+
{
40+
if ($this->openDialogUrl) {
41+
return $this->openDialogUrl->getUrl();
42+
}
43+
return self::DEFAULT_OPEN_DIALOG_URL;
44+
}
45+
}

app/code/Magento/Ui/composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
"magento/module-backend": "*",
1212
"magento/module-eav": "*",
1313
"magento/module-store": "*",
14-
"magento/module-user": "*",
15-
"magento/module-cms": "*"
14+
"magento/module-user": "*"
1615
},
1716
"suggest": {
1817
"magento/module-config": "*"

0 commit comments

Comments
 (0)