PluginProbe
Elementor Website Builder – more than just a page builder / 4.3.0-beta3
Elementor Website Builder – more than just a page builder v4.3.0-beta3
4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 All 452 releases
elementor / assets / js / floating-elements-modal.js

floating-elements-modal.js in Elementor Website Builder – more than just a page builder 4.3.0-beta3, at assets/js/floating-elements-modal.js

580 lines 18.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (function(_wordpress_i18n) {
2
3 //#region \0rolldown/runtime.js
4 var __defProp = Object.defineProperty;
5 var __name = (target, value) => __defProp(target, "name", {
6 value,
7 configurable: true
8 });
9
10 //#endregion
11
12 //#region node_modules/@babel/runtime/helpers/esm/classCallCheck.js
13 function _classCallCheck(a, n) {
14 if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
15 }
16
17 //#endregion
18 //#region node_modules/@babel/runtime/helpers/esm/typeof.js
19 function _typeof(o) {
20 "@babel/helpers - typeof";
21 return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
22 return typeof o;
23 } : function(o) {
24 return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
25 }, _typeof(o);
26 }
27
28 //#endregion
29 //#region node_modules/@babel/runtime/helpers/esm/toPrimitive.js
30 function toPrimitive(t, r) {
31 if ("object" != _typeof(t) || !t) return t;
32 var e = t[Symbol.toPrimitive];
33 if (void 0 !== e) {
34 var i = e.call(t, r || "default");
35 if ("object" != _typeof(i)) return i;
36 throw new TypeError("@@toPrimitive must return a primitive value.");
37 }
38 return ("string" === r ? String : Number)(t);
39 }
40
41 //#endregion
42 //#region node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
43 function toPropertyKey(t) {
44 var i = toPrimitive(t, "string");
45 return "symbol" == _typeof(i) ? i : i + "";
46 }
47
48 //#endregion
49 //#region node_modules/@babel/runtime/helpers/esm/createClass.js
50 function _defineProperties(e, r) {
51 for (var t = 0; t < r.length; t++) {
52 var o = r[t];
53 o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey(o.key), o);
54 }
55 }
56 function _createClass(e, r, t) {
57 return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e;
58 }
59
60 //#endregion
61 //#region node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js
62 function _assertThisInitialized(e) {
63 if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
64 return e;
65 }
66
67 //#endregion
68 //#region node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js
69 function _possibleConstructorReturn(t, e) {
70 if (e && ("object" == _typeof(e) || "function" == typeof e)) return e;
71 if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
72 return _assertThisInitialized(t);
73 }
74
75 //#endregion
76 //#region node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js
77 function _getPrototypeOf(t) {
78 return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
79 return t.__proto__ || Object.getPrototypeOf(t);
80 }, _getPrototypeOf(t);
81 }
82
83 //#endregion
84 //#region node_modules/@babel/runtime/helpers/esm/superPropBase.js
85 function _superPropBase(t, o) {
86 for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t)););
87 return t;
88 }
89
90 //#endregion
91 //#region node_modules/@babel/runtime/helpers/esm/get.js
92 function _get() {
93 return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function(e, t, r) {
94 var p = _superPropBase(e, t);
95 if (p) {
96 var n = Object.getOwnPropertyDescriptor(p, t);
97 return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value;
98 }
99 }, _get.apply(null, arguments);
100 }
101
102 //#endregion
103 //#region node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
104 function _setPrototypeOf(t, e) {
105 return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
106 return t.__proto__ = e, t;
107 }, _setPrototypeOf(t, e);
108 }
109
110 //#endregion
111 //#region node_modules/@babel/runtime/helpers/esm/inherits.js
112 function _inherits(t, e) {
113 if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
114 t.prototype = Object.create(e && e.prototype, { constructor: {
115 value: t,
116 writable: !0,
117 configurable: !0
118 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e);
119 }
120
121 //#endregion
122 //#region assets/dev/js/admin/floating-elements/view.js
123 var view_default = Marionette.ItemView.extend({
124 id: "elementor-new-floating-elements-dialog-content",
125 template: "#tmpl-elementor-new-floating-elements",
126 ui: {},
127 events: {},
128 onRender: function onRender() {}
129 });
130
131 //#endregion
132 //#region core/common/assets/js/views/modal/header.js
133 function _callSuper$4(t, o, e) {
134 return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$4() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
135 }
136 __name(_callSuper$4, "_callSuper");
137 function _isNativeReflectConstruct$4() {
138 try {
139 var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
140 } catch (t) {}
141 return (_isNativeReflectConstruct$4 = function _isNativeReflectConstruct() {
142 return !!t;
143 })();
144 }
145 __name(_isNativeReflectConstruct$4, "_isNativeReflectConstruct");
146 var _default$4 = /*#__PURE__*/ function(_Marionette$LayoutVie) {
147 function _default() {
148 _classCallCheck(this, _default);
149 return _callSuper$4(this, _default, arguments);
150 }
151 _inherits(_default, _Marionette$LayoutVie);
152 return _createClass(_default, [
153 {
154 key: "tagName",
155 value: function tagName() {
156 return "header";
157 }
158 },
159 {
160 key: "className",
161 value: function className() {
162 return "elementor-templates-modal__header";
163 }
164 },
165 {
166 key: "getTemplate",
167 value: function getTemplate() {
168 return "#tmpl-elementor-templates-modal__header";
169 }
170 },
171 {
172 key: "regions",
173 value: function regions() {
174 return {
175 logoArea: ".elementor-templates-modal__header__logo-area",
176 tools: "#elementor-template-library-header-tools",
177 menuArea: ".elementor-templates-modal__header__menu-area"
178 };
179 }
180 },
181 {
182 key: "ui",
183 value: function ui() {
184 return { closeModal: ".elementor-templates-modal__header__close" };
185 }
186 },
187 {
188 key: "events",
189 value: function events() {
190 return { "click @ui.closeModal": "onCloseModalClick" };
191 }
192 },
193 {
194 key: "onRender",
195 value: function onRender() {
196 this.bindEscapeKey();
197 }
198 },
199 {
200 key: "bindEscapeKey",
201 value: function bindEscapeKey() {
202 var _this = this;
203 this.onDocumentKeyDown = function(event) {
204 if ("Escape" === event.key) _this.onCloseModalClick();
205 };
206 document.addEventListener("keydown", this.onDocumentKeyDown);
207 }
208 },
209 {
210 key: "onDestroy",
211 value: function onDestroy() {
212 if (this.onDocumentKeyDown) document.removeEventListener("keydown", this.onDocumentKeyDown);
213 }
214 },
215 {
216 key: "templateHelpers",
217 value: function templateHelpers() {
218 return { closeType: this.getOption("closeType") };
219 }
220 },
221 {
222 key: "onCloseModalClick",
223 value: function onCloseModalClick() {
224 this._parent._parent._parent.hideModal();
225 var documentType = this.getDocumentType();
226 var customEvent = new CustomEvent("core/modal/close/".concat(documentType));
227 window.dispatchEvent(customEvent);
228 if (this.isFloatingButtonLibraryClose()) {
229 $e.internal("document/save/set-is-modified", { status: false });
230 window.location.href = elementor.config.admin_floating_button_admin_url;
231 }
232 }
233 },
234 {
235 key: "getDocumentType",
236 value: function getDocumentType() {
237 var _elementor$config$doc;
238 var _elementor;
239 var DEFAULT_TYPE = "default";
240 if ("undefined" === typeof window.elementor) return DEFAULT_TYPE;
241 return (_elementor$config$doc = (_elementor = elementor) === null || _elementor === void 0 || (_elementor = _elementor.config) === null || _elementor === void 0 || (_elementor = _elementor.document) === null || _elementor === void 0 ? void 0 : _elementor.type) !== null && _elementor$config$doc !== void 0 ? _elementor$config$doc : DEFAULT_TYPE;
242 }
243 },
244 {
245 key: "isFloatingButtonLibraryClose",
246 value: function isFloatingButtonLibraryClose() {
247 var _elementor$config;
248 var _elementor$config2;
249 return window.elementor && ((_elementor$config = elementor.config) === null || _elementor$config === void 0 ? void 0 : _elementor$config.admin_floating_button_admin_url) && "floating-buttons" === ((_elementor$config2 = elementor.config) === null || _elementor$config2 === void 0 || (_elementor$config2 = _elementor$config2.document) === null || _elementor$config2 === void 0 ? void 0 : _elementor$config2.type) && (this.$el.closest(".dialog-lightbox-widget-content").find(".elementor-template-library-template-floating_button").length || this.$el.closest(".dialog-lightbox-widget-content").find("#elementor-template-library-preview").length || this.$el.closest(".dialog-lightbox-widget-content").find("#elementor-template-library-templates-empty").length);
250 }
251 }
252 ]);
253 }(Marionette.LayoutView);
254
255 //#endregion
256 //#region core/common/assets/js/views/modal/logo.js
257 function _callSuper$3(t, o, e) {
258 return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$3() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
259 }
260 __name(_callSuper$3, "_callSuper");
261 function _isNativeReflectConstruct$3() {
262 try {
263 var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
264 } catch (t) {}
265 return (_isNativeReflectConstruct$3 = function _isNativeReflectConstruct() {
266 return !!t;
267 })();
268 }
269 __name(_isNativeReflectConstruct$3, "_isNativeReflectConstruct");
270 var _default$3 = /*#__PURE__*/ function(_Marionette$ItemView) {
271 function _default() {
272 _classCallCheck(this, _default);
273 return _callSuper$3(this, _default, arguments);
274 }
275 _inherits(_default, _Marionette$ItemView);
276 return _createClass(_default, [
277 {
278 key: "getTemplate",
279 value: function getTemplate() {
280 return "#tmpl-elementor-templates-modal__header__logo";
281 }
282 },
283 {
284 key: "className",
285 value: function className() {
286 return "elementor-templates-modal__header__logo";
287 }
288 },
289 {
290 key: "events",
291 value: function events() {
292 return { click: "onClick" };
293 }
294 },
295 {
296 key: "templateHelpers",
297 value: function templateHelpers() {
298 return { title: this.getOption("title") };
299 }
300 },
301 {
302 key: "onClick",
303 value: function onClick() {
304 var clickCallback = this.getOption("click");
305 if (clickCallback) clickCallback();
306 }
307 }
308 ]);
309 }(Marionette.ItemView);
310
311 //#endregion
312 //#region core/common/assets/js/views/modal/loading.js
313 function _callSuper$2(t, o, e) {
314 return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$2() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
315 }
316 __name(_callSuper$2, "_callSuper");
317 function _isNativeReflectConstruct$2() {
318 try {
319 var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
320 } catch (t) {}
321 return (_isNativeReflectConstruct$2 = function _isNativeReflectConstruct() {
322 return !!t;
323 })();
324 }
325 __name(_isNativeReflectConstruct$2, "_isNativeReflectConstruct");
326 var _default$2 = /*#__PURE__*/ function(_Marionette$ItemView) {
327 function _default() {
328 _classCallCheck(this, _default);
329 return _callSuper$2(this, _default, arguments);
330 }
331 _inherits(_default, _Marionette$ItemView);
332 return _createClass(_default, [{
333 key: "id",
334 value: function id() {
335 return "elementor-template-library-loading";
336 }
337 }, {
338 key: "getTemplate",
339 value: function getTemplate() {
340 return "#tmpl-elementor-template-library-loading";
341 }
342 }]);
343 }(Marionette.ItemView);
344
345 //#endregion
346 //#region core/common/assets/js/views/modal/layout.js
347 function _callSuper$1(t, o, e) {
348 return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$1() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
349 }
350 __name(_callSuper$1, "_callSuper");
351 function _isNativeReflectConstruct$1() {
352 try {
353 var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
354 } catch (t) {}
355 return (_isNativeReflectConstruct$1 = function _isNativeReflectConstruct() {
356 return !!t;
357 })();
358 }
359 __name(_isNativeReflectConstruct$1, "_isNativeReflectConstruct");
360 var _default$1 = /*#__PURE__*/ function(_Marionette$LayoutVie) {
361 function _default() {
362 _classCallCheck(this, _default);
363 return _callSuper$1(this, _default, arguments);
364 }
365 _inherits(_default, _Marionette$LayoutVie);
366 return _createClass(_default, [
367 {
368 key: "el",
369 value: function el() {
370 return this.getModal().getElements("widget");
371 }
372 },
373 {
374 key: "regions",
375 value: function regions() {
376 return {
377 modalHeader: ".dialog-header",
378 modalContent: ".dialog-lightbox-content",
379 modalLoading: ".dialog-lightbox-loading"
380 };
381 }
382 },
383 {
384 key: "initialize",
385 value: function initialize() {
386 this.modalHeader.show(new _default$4(this.getHeaderOptions()));
387 }
388 },
389 {
390 key: "getModal",
391 value: function getModal() {
392 if (!this.modal) this.initModal();
393 return this.modal;
394 }
395 },
396 {
397 key: "initModal",
398 value: function initModal() {
399 var modalOptions = {
400 className: "elementor-templates-modal",
401 closeButton: false,
402 draggable: false,
403 hide: {
404 onOutsideClick: false,
405 onEscKeyPress: false
406 }
407 };
408 jQuery.extend(true, modalOptions, this.getModalOptions());
409 this.modal = elementorCommon.dialogsManager.createWidget("lightbox", modalOptions);
410 this.modal.getElements("message").append(this.modal.addElement("content"), this.modal.addElement("loading"));
411 if (modalOptions.draggable) this.draggableModal();
412 }
413 },
414 {
415 key: "showModal",
416 value: function showModal() {
417 this.getModal().show();
418 }
419 },
420 {
421 key: "hideModal",
422 value: function hideModal() {
423 this.getModal().hide();
424 }
425 },
426 {
427 key: "draggableModal",
428 value: function draggableModal() {
429 var $modalWidgetContent = this.getModal().getElements("widgetContent");
430 $modalWidgetContent.draggable({
431 containment: "parent",
432 stop: function stop() {
433 $modalWidgetContent.height("");
434 }
435 });
436 $modalWidgetContent.css("position", "absolute");
437 }
438 },
439 {
440 key: "getModalOptions",
441 value: function getModalOptions() {
442 return {};
443 }
444 },
445 {
446 key: "getLogoOptions",
447 value: function getLogoOptions() {
448 return {};
449 }
450 },
451 {
452 key: "getHeaderOptions",
453 value: function getHeaderOptions() {
454 return { closeType: "normal" };
455 }
456 },
457 {
458 key: "getHeaderView",
459 value: function getHeaderView() {
460 return this.modalHeader.currentView;
461 }
462 },
463 {
464 key: "showLoadingView",
465 value: function showLoadingView() {
466 this.modalLoading.show(new _default$2());
467 this.modalLoading.$el.show();
468 this.modalContent.$el.hide();
469 }
470 },
471 {
472 key: "hideLoadingView",
473 value: function hideLoadingView() {
474 this.modalContent.$el.show();
475 this.modalLoading.$el.hide();
476 }
477 },
478 {
479 key: "showLogo",
480 value: function showLogo() {
481 this.getHeaderView().logoArea.show(new _default$3(this.getLogoOptions()));
482 }
483 }
484 ]);
485 }(Marionette.LayoutView);
486
487 //#endregion
488 //#region assets/dev/js/admin/floating-elements/layout.js
489 function _callSuper(t, o, e) {
490 return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
491 }
492 function _isNativeReflectConstruct() {
493 try {
494 var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
495 } catch (t) {}
496 return (_isNativeReflectConstruct = function _isNativeReflectConstruct() {
497 return !!t;
498 })();
499 }
500 function _superPropGet(t, o, e, r) {
501 var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e);
502 return 2 & r && "function" == typeof p ? function(t) {
503 return p.apply(e, t);
504 } : p;
505 }
506 var _default = /*#__PURE__*/ function(_ModalLayout) {
507 function _default() {
508 _classCallCheck(this, _default);
509 return _callSuper(this, _default, arguments);
510 }
511 _inherits(_default, _ModalLayout);
512 return _createClass(_default, [
513 {
514 key: "getModalOptions",
515 value: function getModalOptions() {
516 return { id: "elementor-new-floating-elements-modal" };
517 }
518 },
519 {
520 key: "getLogoOptions",
521 value: function getLogoOptions() {
522 return { title: (0, _wordpress_i18n.__)("New Floating Elements", "elementor") };
523 }
524 },
525 {
526 key: "initialize",
527 value: function initialize() {
528 _superPropGet(_default, "initialize", this, 3)([]);
529 this.showLogo();
530 this.showContentView();
531 }
532 },
533 {
534 key: "showContentView",
535 value: function showContentView() {
536 this.modalContent.show(new view_default());
537 }
538 }
539 ]);
540 }(_default$1);
541
542 //#endregion
543 //#region assets/dev/js/admin/floating-elements/new-floating-elements.js
544 var NewFloatingElementsModule = elementorModules.ViewModule.extend({
545 getDefaultSettings: function getDefaultSettings() {
546 return { selectors: {
547 addButtonTopBar: "a.page-title-action[href*=\"e-floating-buttons\"]",
548 addButtonAdminBar: "#wp-admin-bar-new-e-floating-buttons a",
549 addButtonEmptyTemplate: "#elementor-template-library-add-new"
550 } };
551 },
552 getDefaultElements: function getDefaultElements() {
553 var selectors = this.getSettings("selectors");
554 return {
555 addButtonTopBar: document.querySelector(selectors.addButtonTopBar),
556 addButtonAdminBar: document.querySelector(selectors.addButtonAdminBar),
557 addButtonEmptyTemplate: document.querySelector(selectors.addButtonEmptyTemplate)
558 };
559 },
560 bindEvents: function bindEvents() {
561 if (this.elements.addButtonTopBar !== null) this.elements.addButtonTopBar.addEventListener("click", this.onAddButtonClick);
562 if (this.elements.addButtonAdminBar !== null) this.elements.addButtonAdminBar.addEventListener("click", this.onAddButtonClick);
563 if (this.elements.addButtonEmptyTemplate !== null) this.elements.addButtonEmptyTemplate.addEventListener("click", this.onAddButtonClick);
564 },
565 onInit: function onInit() {
566 elementorModules.ViewModule.prototype.onInit.apply(this, arguments);
567 this.layout = new _default();
568 },
569 onAddButtonClick: function onAddButtonClick(event) {
570 event.preventDefault();
571 this.layout.showModal();
572 }
573 });
574 document.addEventListener("DOMContentLoaded", function() {
575 window.elementorNewFloatingElements = new NewFloatingElementsModule();
576 });
577
578 //#endregion
579 })(wp.i18n);
580 //# sourceMappingURL=floating-elements-modal.js.map