Skip to content

Commit 67f529c

Browse files
Merge pull request #173 from magento-amigos/develop-prs
[Amigos] Community Contributions - 2.4-develop
2 parents e09a1dd + a3e5209 commit 67f529c

File tree

5 files changed

+144
-99
lines changed

5 files changed

+144
-99
lines changed

app/code/Magento/PageBuilder/Plugin/Catalog/Model/Product/Attribute/RepositoryPlugin.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ public function beforeSave(
3636
\Magento\Catalog\Model\Product\Attribute\Repository $subject,
3737
\Magento\Catalog\Api\Data\ProductAttributeInterface $attribute
3838
) {
39-
$isPageBuilderEnabled = $attribute->getData('extension_attributes')
40-
? $attribute->getData('extension_attributes')->getIsPagebuilderEnabled()
39+
$extensionAttributes = $attribute->getData('extension_attributes');
40+
$isPageBuilderEnabled = ($extensionAttributes && method_exists($extensionAttributes, 'getIsPagebuilderEnabled'))
41+
? $extensionAttributes->getIsPagebuilderEnabled()
4142
: 0;
4243
$attribute->setData('is_pagebuilder_enabled', $isPageBuilderEnabled);
4344
}
@@ -58,7 +59,11 @@ public function afterGet(
5859
$extensionAttribute = $result->getExtensionAttributes()
5960
? $result->getExtensionAttributes()
6061
: $this->extensionAttributesFactory->create();
61-
$extensionAttribute->setIsPagebuilderEnabled($isPageBuilderEnabled);
62+
63+
if (method_exists($extensionAttribute, 'setIsPagebuilderEnabled')) {
64+
$extensionAttribute->setIsPagebuilderEnabled($isPageBuilderEnabled);
65+
}
66+
6267
$result->setExtensionAttributes($extensionAttribute);
6368
return $result;
6469
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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\PageBuilder\Ui\Component\UrlInput;
10+
11+
/** Provides configuration for url input link */
12+
class Url implements \Magento\Ui\Model\UrlInput\ConfigInterface
13+
{
14+
/**
15+
* @inheritdoc
16+
*/
17+
public function getConfig(): array
18+
{
19+
return [
20+
'label' => __('URL'),
21+
'component' => 'Magento_Ui/js/form/element/abstract',
22+
'template' => 'Magento_PageBuilder/form/element/input-no-maxlength',
23+
'sortOrder' => 20
24+
];
25+
}
26+
}

app/code/Magento/PageBuilder/etc/adminhtml/di.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107
<arguments>
108108
<argument name="linksConfiguration" xsi:type="array">
109109
<item name="page" xsi:type="string">Magento\PageBuilder\Ui\Component\UrlInput\Page</item>
110+
<item name="default" xsi:type="string">Magento\PageBuilder\Ui\Component\UrlInput\Url</item>
110111
</argument>
111112
</arguments>
112113
</type>

app/code/Magento/PageBuilder/view/base/web/js/resource/slick/slick.js

Lines changed: 106 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
|___/_|_|\___|_|\_(_)/ |___/
77
|__/
88
9-
Version: 1.8.1
9+
Version: 1.9.0
1010
Author: Ken Wheeler
1111
Website: http://kenwheeler.github.io
1212
Docs: http://kenwheeler.github.io/slick
@@ -1033,18 +1033,18 @@
10331033
}, 0);
10341034
}
10351035
).on(
1036-
'blur.slick',
1037-
'*',
1038-
function(event) {
1039-
var $sf = $(this);
1040-
1041-
// When a blur occurs on any elements within the slider we become unfocused
1042-
if( _.options.pauseOnFocus ) {
1043-
_.focussed = false;
1044-
_.autoPlay();
1036+
'blur.slick',
1037+
'*',
1038+
function(event) {
1039+
var $sf = $(this);
1040+
1041+
// When a blur occurs on any elements within the slider we become unfocused
1042+
if( _.options.pauseOnFocus ) {
1043+
_.focussed = false;
1044+
_.autoPlay();
1045+
}
10451046
}
1046-
}
1047-
);
1047+
);
10481048
};
10491049

10501050
Slick.prototype.getCurrent = Slick.prototype.slickCurrentSlide = function() {
@@ -1064,7 +1064,7 @@
10641064

10651065
if (_.options.infinite === true) {
10661066
if (_.slideCount <= _.options.slidesToShow) {
1067-
++pagerQty;
1067+
++pagerQty;
10681068
} else {
10691069
while (breakPoint < _.slideCount) {
10701070
++pagerQty;
@@ -1238,13 +1238,25 @@
12381238
Slick.prototype.getSlideCount = function() {
12391239

12401240
var _ = this,
1241-
slidesTraversed, swipedSlide, centerOffset;
1241+
slidesTraversed, swipedSlide, swipeTarget, centerOffset;
12421242

1243-
centerOffset = _.options.centerMode === true ? _.slideWidth * Math.floor(_.options.slidesToShow / 2) : 0;
1243+
centerOffset = _.options.centerMode === true ? Math.floor(_.$list.width() / 2) : 0;
1244+
swipeTarget = (_.swipeLeft * -1) + centerOffset;
12441245

12451246
if (_.options.swipeToSlide === true) {
1247+
12461248
_.$slideTrack.find('.slick-slide').each(function(index, slide) {
1247-
if (slide.offsetLeft - centerOffset + ($(slide).outerWidth() / 2) > (_.swipeLeft * -1)) {
1249+
1250+
var slideOuterWidth, slideOffset, slideRightBoundary;
1251+
slideOuterWidth = $(slide).outerWidth();
1252+
slideOffset = slide.offsetLeft;
1253+
if (_.options.centerMode !== true) {
1254+
slideOffset += (slideOuterWidth / 2);
1255+
}
1256+
1257+
slideRightBoundary = slideOffset + (slideOuterWidth);
1258+
1259+
if (swipeTarget < slideRightBoundary) {
12481260
swipedSlide = slide;
12491261
return false;
12501262
}
@@ -1313,10 +1325,10 @@
13131325

13141326
Slick.prototype.initADA = function() {
13151327
var _ = this,
1316-
numDotGroups = Math.ceil(_.slideCount / _.options.slidesToShow),
1317-
tabControlIndexes = _.getNavigableIndexes().filter(function(val) {
1318-
return (val >= 0) && (val < _.slideCount);
1319-
});
1328+
numDotGroups = Math.ceil(_.slideCount / _.options.slidesToShow),
1329+
tabControlIndexes = _.getNavigableIndexes().filter(function(val) {
1330+
return (val >= 0) && (val < _.slideCount);
1331+
});
13201332

13211333
_.$slides.add(_.$slideTrack.find('.slick-cloned')).attr({
13221334
'aria-hidden': 'true',
@@ -1336,12 +1348,12 @@
13361348
});
13371349

13381350
if (slideControlIndex !== -1) {
1339-
var ariaButtonControl = 'slick-slide-control' + _.instanceUid + slideControlIndex
1340-
if ($('#' + ariaButtonControl).length) {
1341-
$(this).attr({
1342-
'aria-describedby': ariaButtonControl
1343-
});
1344-
}
1351+
var ariaButtonControl = 'slick-slide-control' + _.instanceUid + slideControlIndex
1352+
if ($('#' + ariaButtonControl).length) {
1353+
$(this).attr({
1354+
'aria-describedby': ariaButtonControl
1355+
});
1356+
}
13451357
}
13461358
});
13471359

@@ -1368,11 +1380,11 @@
13681380
}
13691381

13701382
for (var i=_.currentSlide, max=i+_.options.slidesToShow; i < max; i++) {
1371-
if (_.options.focusOnChange) {
1372-
_.$slides.eq(i).attr({'tabindex': '0'});
1373-
} else {
1374-
_.$slides.eq(i).removeAttr('tabindex');
1375-
}
1383+
if (_.options.focusOnChange) {
1384+
_.$slides.eq(i).attr({'tabindex': '0'});
1385+
} else {
1386+
_.$slides.eq(i).removeAttr('tabindex');
1387+
}
13761388
}
13771389

13781390
_.activateADA();
@@ -1385,15 +1397,15 @@
13851397

13861398
if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
13871399
_.$prevArrow
1388-
.off('click.slick')
1389-
.on('click.slick', {
1400+
.off('click.slick')
1401+
.on('click.slick', {
13901402
message: 'previous'
1391-
}, _.changeSlide);
1403+
}, _.changeSlide);
13921404
_.$nextArrow
1393-
.off('click.slick')
1394-
.on('click.slick', {
1405+
.off('click.slick')
1406+
.on('click.slick', {
13951407
message: 'next'
1396-
}, _.changeSlide);
1408+
}, _.changeSlide);
13971409

13981410
if (_.options.accessibility === true) {
13991411
_.$prevArrow.on('keydown.slick', _.keyHandler);
@@ -1507,7 +1519,7 @@
15071519
Slick.prototype.keyHandler = function(event) {
15081520

15091521
var _ = this;
1510-
//Dont slide if the cursor is inside the form fields and arrow keys are pressed
1522+
//Dont slide if the cursor is inside the form fields and arrow keys are pressed
15111523
if(!event.target.tagName.match('TEXTAREA|INPUT|SELECT')) {
15121524
if (event.keyCode === 37 && _.options.accessibility === true) {
15131525
_.changeSlide({
@@ -2122,102 +2134,102 @@
21222134
};
21232135

21242136
Slick.prototype.setOption =
2125-
Slick.prototype.slickSetOption = function() {
2137+
Slick.prototype.slickSetOption = function() {
21262138

2127-
/**
2128-
* accepts arguments in format of:
2129-
*
2130-
* - for changing a single option's value:
2131-
* .slick("setOption", option, value, refresh )
2132-
*
2133-
* - for changing a set of responsive options:
2134-
* .slick("setOption", 'responsive', [{}, ...], refresh )
2135-
*
2136-
* - for updating multiple values at once (not responsive)
2137-
* .slick("setOption", { 'option': value, ... }, refresh )
2138-
*/
2139+
/**
2140+
* accepts arguments in format of:
2141+
*
2142+
* - for changing a single option's value:
2143+
* .slick("setOption", option, value, refresh )
2144+
*
2145+
* - for changing a set of responsive options:
2146+
* .slick("setOption", 'responsive', [{}, ...], refresh )
2147+
*
2148+
* - for updating multiple values at once (not responsive)
2149+
* .slick("setOption", { 'option': value, ... }, refresh )
2150+
*/
21392151

2140-
var _ = this, l, item, option, value, refresh = false, type;
2152+
var _ = this, l, item, option, value, refresh = false, type;
21412153

2142-
if( $.type( arguments[0] ) === 'object' ) {
2154+
if( $.type( arguments[0] ) === 'object' ) {
21432155

2144-
option = arguments[0];
2145-
refresh = arguments[1];
2146-
type = 'multiple';
2156+
option = arguments[0];
2157+
refresh = arguments[1];
2158+
type = 'multiple';
21472159

2148-
} else if ( $.type( arguments[0] ) === 'string' ) {
2160+
} else if ( $.type( arguments[0] ) === 'string' ) {
21492161

2150-
option = arguments[0];
2151-
value = arguments[1];
2152-
refresh = arguments[2];
2162+
option = arguments[0];
2163+
value = arguments[1];
2164+
refresh = arguments[2];
21532165

2154-
if ( arguments[0] === 'responsive' && $.type( arguments[1] ) === 'array' ) {
2166+
if ( arguments[0] === 'responsive' && $.type( arguments[1] ) === 'array' ) {
21552167

2156-
type = 'responsive';
2168+
type = 'responsive';
21572169

2158-
} else if ( typeof arguments[1] !== 'undefined' ) {
2170+
} else if ( typeof arguments[1] !== 'undefined' ) {
21592171

2160-
type = 'single';
2161-
2162-
}
2172+
type = 'single';
21632173

21642174
}
21652175

2166-
if ( type === 'single' ) {
2167-
2168-
_.options[option] = value;
2176+
}
21692177

2178+
if ( type === 'single' ) {
21702179

2171-
} else if ( type === 'multiple' ) {
2180+
_.options[option] = value;
21722181

2173-
$.each( option , function( opt, val ) {
21742182

2175-
_.options[opt] = val;
2183+
} else if ( type === 'multiple' ) {
21762184

2177-
});
2185+
$.each( option , function( opt, val ) {
21782186

2187+
_.options[opt] = val;
21792188

2180-
} else if ( type === 'responsive' ) {
2189+
});
21812190

2182-
for ( item in value ) {
21832191

2184-
if( $.type( _.options.responsive ) !== 'array' ) {
2192+
} else if ( type === 'responsive' ) {
21852193

2186-
_.options.responsive = [ value[item] ];
2194+
for ( item in value ) {
21872195

2188-
} else {
2196+
if( $.type( _.options.responsive ) !== 'array' ) {
21892197

2190-
l = _.options.responsive.length-1;
2198+
_.options.responsive = [ value[item] ];
21912199

2192-
// loop through the responsive object and splice out duplicates.
2193-
while( l >= 0 ) {
2200+
} else {
21942201

2195-
if( _.options.responsive[l].breakpoint === value[item].breakpoint ) {
2202+
l = _.options.responsive.length-1;
21962203

2197-
_.options.responsive.splice(l,1);
2204+
// loop through the responsive object and splice out duplicates.
2205+
while( l >= 0 ) {
21982206

2199-
}
2207+
if( _.options.responsive[l].breakpoint === value[item].breakpoint ) {
22002208

2201-
l--;
2209+
_.options.responsive.splice(l,1);
22022210

22032211
}
22042212

2205-
_.options.responsive.push( value[item] );
2213+
l--;
22062214

22072215
}
22082216

2217+
_.options.responsive.push( value[item] );
2218+
22092219
}
22102220

22112221
}
22122222

2213-
if ( refresh ) {
2223+
}
22142224

2215-
_.unload();
2216-
_.reinit();
2225+
if ( refresh ) {
22172226

2218-
}
2227+
_.unload();
2228+
_.reinit();
2229+
2230+
}
22192231

2220-
};
2232+
};
22212233

22222234
Slick.prototype.setPosition = function() {
22232235

@@ -2426,7 +2438,7 @@
24262438
}
24272439

24282440
for (i = _.slideCount; i > (_.slideCount -
2429-
infiniteCount); i -= 1) {
2441+
infiniteCount); i -= 1) {
24302442
slideIndex = i - 1;
24312443
$(_.$slides[slideIndex]).clone(true).attr('id', '')
24322444
.attr('data-slick-index', slideIndex - _.slideCount)
@@ -2973,8 +2985,8 @@
29732985

29742986
_.$dots
29752987
.find('li')
2976-
.removeClass('slick-active')
2977-
.end();
2988+
.removeClass('slick-active')
2989+
.end();
29782990

29792991
_.$dots
29802992
.find('li')

0 commit comments

Comments
 (0)