Skip to content

Commit a926e8c

Browse files
committed
Merge remote-tracking branch 'origin/MC-4003' into cms-team-1-delivery
2 parents aed016f + 292cf3f commit a926e8c

File tree

12 files changed

+957
-31
lines changed

12 files changed

+957
-31
lines changed

app/code/Magento/PageBuilder/view/adminhtml/requirejs-config.js

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,20 @@
44
*/
55

66
var config = {
7-
paths: {
8-
'pagebuilder/async': 'Magento_PageBuilder/js/resource/requirejs/async',
9-
10-
/* Extra Resources Needed */
11-
'pagebuilder/html2canvas': 'Magento_PageBuilder/js/resource/html2canvas',
12-
'hyperscript': 'Magento_PageBuilder/js/resource/hyperscript/hyperscript',
13-
'xyperscript': 'Magento_PageBuilder/js/resource/xyperscript/xyperscript',
14-
'google-map': 'Magento_PageBuilder/js/utils/map',
15-
16-
/* Include our Knockout Sortable wrapper */
17-
'pagebuilder/ko-dropzone': 'Magento_PageBuilder/js/resource/dropzone/knockout-dropzone',
18-
'pagebuilder/ko-redactor': 'Magento_PageBuilder/js/resource/redactor/knockout-redactor',
19-
'pagebuilder/ko-liveedit': 'Magento_PageBuilder/js/resource/live-edit/knockout-liveedit'
20-
},
217
map: {
228
'*': {
23-
/* Map the abstract widget to the input type widget */
24-
'pagebuilder/widget/abstract': 'pagebuilder/field/abstract',
9+
/* Include our Knockout Sortable wrapper */
10+
'pagebuilder/ko-dropzone': 'Magento_PageBuilder/js/resource/dropzone/knockout-dropzone',
2511

2612
/* Utilities */
27-
'pagebuilder/utils': 'Magento_PageBuilder/js/utils',
28-
'pagebuilder/config': 'Magento_PageBuilder/js/component/config'
13+
'google-map': 'Magento_PageBuilder/js/utils/map'
2914
}
3015
},
3116
shim: {
3217
'pagebuilder/ko-sortable': {
33-
deps: ['jquery', 'jquery/ui', 'Magento_PageBuilder/js/resource/jquery-ui/jquery.ui.touch-punch.min']
18+
deps: ['jquery', 'jquery/ui', 'Magento_PageBuilder/js/resource/jquery-ui/jquery.ui.touch-punch']
3419
},
35-
'Magento_PageBuilder/js/resource/jquery/ui/jquery.ui.touch-punch.min': {
20+
'Magento_PageBuilder/js/resource/jquery/ui/jquery.ui.touch-punch': {
3621
deps: ['jquery/ui']
3722
}
3823
},

app/code/Magento/PageBuilder/view/adminhtml/web/js/content-type/row/preview.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/js/content-type/slider/preview.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/js/form/element/image-uploader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ define([
88
'underscore',
99
'uiRegistry',
1010
'Magento_Ui/js/form/element/image-uploader',
11-
'Magento_PageBuilder/js/resource/resize-observer/ResizeObserver.min',
11+
'Magento_PageBuilder/js/resource/resize-observer/ResizeObserver',
1212
'Magento_PageBuilder/js/events',
1313
'mage/translate'
1414
], function ($, _, uiRegistry, Uploader, ResizeObserver, events, $t) {
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
/*!
2+
* jQuery UI Touch Punch 0.2.3
3+
*
4+
* Copyright 2011–2014, Dave Furfero
5+
* Dual licensed under the MIT or GPL Version 2 licenses.
6+
*
7+
* Depends:
8+
* jquery.ui.widget.js
9+
* jquery.ui.mouse.js
10+
*/
11+
(function ($) {
12+
13+
// Detect touch support
14+
$.support.touch = 'ontouchend' in document;
15+
16+
// Ignore browsers without touch support
17+
if (!$.support.touch) {
18+
return;
19+
}
20+
21+
var mouseProto = $.ui.mouse.prototype,
22+
_mouseInit = mouseProto._mouseInit,
23+
_mouseDestroy = mouseProto._mouseDestroy,
24+
touchHandled;
25+
26+
/**
27+
* Simulate a mouse event based on a corresponding touch event
28+
* @param {Object} event A touch event
29+
* @param {String} simulatedType The corresponding mouse event
30+
*/
31+
function simulateMouseEvent (event, simulatedType) {
32+
33+
// Ignore multi-touch events
34+
if (event.originalEvent.touches.length > 1) {
35+
return;
36+
}
37+
38+
event.preventDefault();
39+
40+
var touch = event.originalEvent.changedTouches[0],
41+
simulatedEvent = document.createEvent('MouseEvents');
42+
43+
// Initialize the simulated mouse event using the touch event's coordinates
44+
simulatedEvent.initMouseEvent(
45+
simulatedType, // type
46+
true, // bubbles
47+
true, // cancelable
48+
window, // view
49+
1, // detail
50+
touch.screenX, // screenX
51+
touch.screenY, // screenY
52+
touch.clientX, // clientX
53+
touch.clientY, // clientY
54+
false, // ctrlKey
55+
false, // altKey
56+
false, // shiftKey
57+
false, // metaKey
58+
0, // button
59+
null // relatedTarget
60+
);
61+
62+
// Dispatch the simulated event to the target element
63+
event.target.dispatchEvent(simulatedEvent);
64+
}
65+
66+
/**
67+
* Handle the jQuery UI widget's touchstart events
68+
* @param {Object} event The widget element's touchstart event
69+
*/
70+
mouseProto._touchStart = function (event) {
71+
72+
var self = this;
73+
74+
// Ignore the event if another widget is already being handled
75+
if (touchHandled || !self._mouseCapture(event.originalEvent.changedTouches[0])) {
76+
return;
77+
}
78+
79+
// Set the flag to prevent other widgets from inheriting the touch event
80+
touchHandled = true;
81+
82+
// Track movement to determine if interaction was a click
83+
self._touchMoved = false;
84+
85+
// Simulate the mouseover event
86+
simulateMouseEvent(event, 'mouseover');
87+
88+
// Simulate the mousemove event
89+
simulateMouseEvent(event, 'mousemove');
90+
91+
// Simulate the mousedown event
92+
simulateMouseEvent(event, 'mousedown');
93+
};
94+
95+
/**
96+
* Handle the jQuery UI widget's touchmove events
97+
* @param {Object} event The document's touchmove event
98+
*/
99+
mouseProto._touchMove = function (event) {
100+
101+
// Ignore event if not handled
102+
if (!touchHandled) {
103+
return;
104+
}
105+
106+
// Interaction was not a click
107+
this._touchMoved = true;
108+
109+
// Simulate the mousemove event
110+
simulateMouseEvent(event, 'mousemove');
111+
};
112+
113+
/**
114+
* Handle the jQuery UI widget's touchend events
115+
* @param {Object} event The document's touchend event
116+
*/
117+
mouseProto._touchEnd = function (event) {
118+
119+
// Ignore event if not handled
120+
if (!touchHandled) {
121+
return;
122+
}
123+
124+
// Simulate the mouseup event
125+
simulateMouseEvent(event, 'mouseup');
126+
127+
// Simulate the mouseout event
128+
simulateMouseEvent(event, 'mouseout');
129+
130+
// If the touch interaction did not move, it should trigger a click
131+
if (!this._touchMoved) {
132+
133+
// Simulate the click event
134+
simulateMouseEvent(event, 'click');
135+
}
136+
137+
// Unset the flag to allow other widgets to inherit the touch event
138+
touchHandled = false;
139+
};
140+
141+
/**
142+
* A duck punch of the $.ui.mouse _mouseInit method to support touch events.
143+
* This method extends the widget with bound touch event handlers that
144+
* translate touch events to mouse events and pass them to the widget's
145+
* original mouse event handling methods.
146+
*/
147+
mouseProto._mouseInit = function () {
148+
149+
var self = this;
150+
151+
// Delegate the touch handlers to the widget's element
152+
self.element.bind({
153+
touchstart: $.proxy(self, '_touchStart'),
154+
touchmove: $.proxy(self, '_touchMove'),
155+
touchend: $.proxy(self, '_touchEnd')
156+
});
157+
158+
// Call the original $.ui.mouse init method
159+
_mouseInit.call(self);
160+
};
161+
162+
/**
163+
* Remove the touch event handlers
164+
*/
165+
mouseProto._mouseDestroy = function () {
166+
167+
var self = this;
168+
169+
// Delegate the touch handlers to the widget's element
170+
self.element.unbind({
171+
touchstart: $.proxy(self, '_touchStart'),
172+
touchmove: $.proxy(self, '_touchMove'),
173+
touchend: $.proxy(self, '_touchEnd')
174+
});
175+
176+
// Call the original $.ui.mouse destroy method
177+
_mouseDestroy.call(self);
178+
};
179+
180+
})(jQuery);

app/code/Magento/PageBuilder/view/adminhtml/web/js/stage.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/content-type/row/preview.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import "jarallax";
77
import $ from "jquery";
88
import ko from "knockout";
99
import events from "Magento_PageBuilder/js/events";
10-
import ResizeObserver from "Magento_PageBuilder/js/resource/resize-observer/ResizeObserver.min";
10+
import ResizeObserver from "Magento_PageBuilder/js/resource/resize-observer/ResizeObserver";
1111
import _ from "underscore";
1212
import ContentTypeConfigInterface from "../../content-type-config.d";
1313
import ConditionalRemoveOption from "../../content-type-menu/conditional-remove-option";

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/content-type/slider/preview.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import $ from "jquery";
77
import ko from "knockout";
88
import $t from "mage/translate";
99
import events from "Magento_PageBuilder/js/events";
10-
import "Magento_PageBuilder/js/resource/slick/slick.min";
10+
import "slick";
1111
import _ from "underscore";
1212
import "../../binding/focus";
1313
import {PreviewSortableSortUpdateEventParams} from "../../binding/sortable-children";

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/stage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import ko from "knockout";
77
import $t from "mage/translate";
88
import events from "Magento_PageBuilder/js/events";
9-
import "Magento_PageBuilder/js/resource/jquery/ui/jquery.ui.touch-punch.min";
9+
import "Magento_PageBuilder/js/resource/jquery/ui/jquery.ui.touch-punch";
1010
import alertDialog from "Magento_Ui/js/modal/alert";
1111
import _ from "underscore";
1212
import "./binding/sortable";

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/types/resize-observer.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ declare var ResizeObserver: {
3232
new(callback: ResizeObserverCallback): ResizeObserver;
3333
};
3434

35-
declare module "Magento_PageBuilder/js/resource/resize-observer/ResizeObserver.min" {
35+
declare module "Magento_PageBuilder/js/resource/resize-observer/ResizeObserver" {
3636
export = ResizeObserver;
3737
}

0 commit comments

Comments
 (0)