Skip to content

Commit 98cd777

Browse files
author
Joan He
committed
Merge remote-tracking branch 'tsg-csl3/2.3-develop-pr15' into pr
2 parents b357459 + 6420573 commit 98cd777

File tree

4 files changed

+36
-16
lines changed

4 files changed

+36
-16
lines changed

app/code/Magento/Msrp/view/base/web/js/msrp.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ define([
7373
this.initTierPopup();
7474
}
7575
$(this.options.cartButtonId).on('click', this._addToCartSubmit.bind(this));
76+
$(this.options.cartForm).on('submit', this._onSubmitForm.bind(this));
7677
},
7778

7879
/**
@@ -249,8 +250,10 @@ define([
249250

250251
/**
251252
* Handler for addToCart action
253+
*
254+
* @param {Object} e
252255
*/
253-
_addToCartSubmit: function () {
256+
_addToCartSubmit: function (e) {
254257
this.element.trigger('addToCart', this.element);
255258

256259
if (this.element.data('stop-processing')) {
@@ -266,8 +269,20 @@ define([
266269
if (this.options.addToCartUrl) {
267270
$('.mage-dropdown-dialog > .ui-dialog-content').dropdownDialog('close');
268271
}
272+
273+
e.preventDefault();
269274
$(this.options.cartForm).submit();
275+
},
270276

277+
/**
278+
* Handler for submit form
279+
*
280+
* @private
281+
*/
282+
_onSubmitForm: function () {
283+
if ($(this.options.cartForm).valid()) {
284+
$(this.options.cartButtonId).prop('disabled', true);
285+
}
271286
}
272287
});
273288

app/code/Magento/ProductVideo/view/frontend/web/js/fotorama-add-video-events.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,14 @@ define([
177177
* @private
178178
*/
179179
clearEvents: function () {
180-
this.fotoramaItem.off(
181-
'fotorama:show.' + this.PV +
182-
' fotorama:showend.' + this.PV +
183-
' fotorama:fullscreenenter.' + this.PV +
184-
' fotorama:fullscreenexit.' + this.PV
185-
);
180+
if (this.fotoramaItem !== undefined) {
181+
this.fotoramaItem.off(
182+
'fotorama:show.' + this.PV +
183+
' fotorama:showend.' + this.PV +
184+
' fotorama:fullscreenenter.' + this.PV +
185+
' fotorama:fullscreenexit.' + this.PV
186+
);
187+
}
186188
},
187189

188190
/**

app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1229,7 +1229,10 @@ define([
12291229
}
12301230

12311231
imagesToUpdate = this._setImageIndex(imagesToUpdate);
1232-
gallery.updateData(imagesToUpdate);
1232+
1233+
if (!_.isUndefined(gallery)) {
1234+
gallery.updateData(imagesToUpdate);
1235+
}
12331236

12341237
if (isInitial) {
12351238
$(this.options.mediaGallerySelector).AddFotoramaVideoEvents();

app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ define([
1818
'use strict';
1919

2020
return Abstract.extend({
21+
currentWysiwyg: undefined,
2122
defaults: {
2223
elementSelector: 'textarea',
2324
suffixRegExpPattern: '${ $.wysiwygUniqueSuffix }',
@@ -53,6 +54,10 @@ define([
5354

5455
// disable editor completely after initialization is field is disabled
5556
varienGlobalEvents.attachEventHandler('wysiwygEditorInitialized', function () {
57+
if (!_.isUndefined(window.tinyMceEditors)) {
58+
this.currentWysiwyg = window.tinyMceEditors[this.wysiwygId];
59+
}
60+
5661
if (this.disabled()) {
5762
this.setDisabled(true);
5863
}
@@ -136,14 +141,9 @@ define([
136141
}
137142

138143
/* eslint-disable no-undef */
139-
if (typeof wysiwyg !== 'undefined' && wysiwyg.activeEditor()) {
140-
if (wysiwyg && disabled) {
141-
wysiwyg.setEnabledStatus(false);
142-
wysiwyg.getPluginButtons().prop('disabled', 'disabled');
143-
} else if (wysiwyg) {
144-
wysiwyg.setEnabledStatus(true);
145-
wysiwyg.getPluginButtons().removeProp('disabled');
146-
}
144+
if (!_.isUndefined(this.currentWysiwyg) && this.currentWysiwyg.activeEditor()) {
145+
this.currentWysiwyg.setEnabledStatus(!disabled);
146+
this.currentWysiwyg.getPluginButtons().prop('disabled', disabled);
147147
}
148148
}
149149
});

0 commit comments

Comments
 (0)