PluginProbe
Elementor Website Builder – more than just a page builder / 3.8.0-beta1
Elementor Website Builder – more than just a page builder v3.8.0-beta1
4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 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 All 457 releases
← All changes | assets/js/gutenberg.js +160 -125 4.3.0-beta1 → 3.8.0-beta1 View file →
@@ -1,130 +1,165 @@
1 -(function(_wordpress_i18n) {
1 +/*! elementor - v3.7.6 - 19-09-2022 */
2 +/******/ (() => { // webpackBootstrap
3 +/******/ "use strict";
4 +/******/ var __webpack_modules__ = ({
2 5
3 -//#region \0rolldown/runtime.js
4 - var __defProp = Object.defineProperty;
5 - var __name = (target, value) => __defProp(target, "name", {
6 - value,
7 - configurable: true
8 - });
6 +/***/ "@wordpress/i18n":
7 +/*!**************************!*\
8 + !*** external "wp.i18n" ***!
9 + \**************************/
10 +/***/ ((module) => {
9 11
10 -//#endregion
12 +module.exports = wp.i18n;
11 13
12 -//#region assets/dev/js/admin/gutenberg.js
13 - (function($) {
14 - "use strict";
15 - var ElementorGutenbergApp = {
16 - cacheElements: function cacheElements() {
17 - var self = this;
18 - self.isElementorMode = ElementorGutenbergSettings.isElementorMode;
19 - self.cache = {};
20 - self.cache.$gutenberg = $("#editor");
21 - self.cache.$switchMode = $($("#elementor-gutenberg-button-switch-mode").html());
22 - self.cache.$switchModeButton = self.cache.$switchMode.find("#elementor-switch-mode-button");
23 - self.bindEvents();
24 - self.toggleStatus();
25 - wp.data.subscribe(function() {
26 - setTimeout(function() {
27 - self.buildPanel();
28 - }, 1);
29 - });
30 - },
31 - buildPanel: function buildPanel() {
32 - var self = this;
33 - if (!self.cache.$gutenberg.find("#elementor-switch-mode").length) self.cache.$gutenberg.find(".edit-post-header-toolbar").append(self.cache.$switchMode);
34 - if (this.hasIframe()) this.handleIframe();
35 - if (!$("#elementor-editor").length) {
36 - self.cache.$editorPanel = $($("#elementor-gutenberg-panel").html());
37 - var editorButtonParent = self.cache.$gutenberg.find(".block-editor-writing-flow");
38 - if (!editorButtonParent.length) editorButtonParent = self.cache.$gutenberg.find(".is-desktop-preview");
39 - self.cache.$gurenbergBlockList = editorButtonParent;
40 - self.cache.$gurenbergBlockList.append(self.cache.$editorPanel);
41 - self.cache.$editorPanelButton = self.cache.$editorPanel.find("#elementor-go-to-edit-page-link");
42 - self.cache.$editorPanelButton.on("click", function(event) {
43 - event.preventDefault();
44 - self.handleEditButtonClick();
45 - });
46 - }
47 - },
48 - handleIframe: function handleIframe() {
49 - this.hideIframeContent();
50 - this.buildPanelTopBar();
51 - },
52 - hasIframe: function hasIframe() {
53 - return !!this.cache.$gutenberg.find("iframe[name=\"editor-canvas\"]").length;
54 - },
55 - hideIframeContent: function hideIframeContent() {
56 - if (!this.isElementorMode) return;
57 - this.cache.$gutenberg.find("iframe[name=\"editor-canvas\"]").contents().find("body").append("<style>\n .editor-post-text-editor,\n .block-editor-block-list__layout {\n display: none;\n }\n\n body {\n padding: 0 !important;\n }\n </style>");
58 - },
59 - buildPanelTopBar: function buildPanelTopBar() {
60 - var self = this;
61 - if (!$("#elementor-edit-mode-button").length && this.isElementorMode) {
62 - self.cache.$editorBtnTop = $($("#elementor-gutenberg-button-tmpl").html());
63 - self.cache.$gutenberg.find(".edit-post-header-toolbar").append(self.cache.$editorBtnTop);
64 - $("#elementor-edit-mode-button").on("click", function(event) {
65 - event.preventDefault();
66 - self.handleEditButtonClick(false);
67 - });
68 - }
69 - },
70 - handleEditButtonClick: function handleEditButtonClick() {
71 - var withAnimation = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
72 - var self = this;
73 - if (withAnimation) self.animateLoader();
74 - if ("auto-draft" === wp.data.select("core/editor").getCurrentPost().status) {
75 - if (!wp.data.select("core/editor").getEditedPostAttribute("title")) wp.data.dispatch("core/editor").editPost({ title: "Elementor #" + $("#post_ID").val() });
76 - wp.data.dispatch("core/editor").savePost();
77 - }
78 - self.redirectWhenSave();
79 - },
80 - bindEvents: function bindEvents() {
81 - var self = this;
82 - self.cache.$switchModeButton.on("click", function() {
83 - if (self.isElementorMode) elementorCommon.dialogsManager.createWidget("confirm", {
84 - message: (0, _wordpress_i18n.__)("Please note that you are switching to WordPress default editor. Your current layout, design and content might break.", "elementor"),
85 - headerMessage: (0, _wordpress_i18n.__)("Back to WordPress Editor", "elementor"),
86 - strings: {
87 - confirm: (0, _wordpress_i18n.__)("Continue", "elementor"),
88 - cancel: (0, _wordpress_i18n.__)("Cancel", "elementor")
89 - },
90 - defaultOption: "confirm",
91 - onConfirm: function onConfirm() {
92 - var wpEditor = wp.data.dispatch("core/editor");
93 - wpEditor.editPost({ gutenberg_elementor_mode: false });
94 - wpEditor.savePost();
95 - self.isElementorMode = !self.isElementorMode;
96 - self.toggleStatus();
97 - }
98 - }).show();
99 - else {
100 - self.isElementorMode = !self.isElementorMode;
101 - self.toggleStatus();
102 - self.cache.$editorPanelButton.trigger("click");
103 - }
104 - });
105 - },
106 - redirectWhenSave: function redirectWhenSave() {
107 - var self = this;
108 - setTimeout(function() {
109 - if (wp.data.select("core/editor").isSavingPost()) self.redirectWhenSave();
110 - else location.href = ElementorGutenbergSettings.editLink;
111 - }, 300);
112 - },
113 - animateLoader: function animateLoader() {
114 - this.cache.$editorPanelButton.addClass("elementor-animate");
115 - },
116 - toggleStatus: function toggleStatus() {
117 - jQuery("body").toggleClass("elementor-editor-active", this.isElementorMode).toggleClass("elementor-editor-inactive", !this.isElementorMode);
118 - },
119 - init: function init() {
120 - this.cacheElements();
121 - }
122 - };
123 - $(function() {
124 - ElementorGutenbergApp.init();
125 - });
126 - })(jQuery);
14 +/***/ })
127 15
128 -//#endregion
129 -})(wp.i18n);
16 +/******/ });
17 +/************************************************************************/
18 +/******/ // The module cache
19 +/******/ var __webpack_module_cache__ = {};
20 +/******/
21 +/******/ // The require function
22 +/******/ function __webpack_require__(moduleId) {
23 +/******/ // Check if module is in cache
24 +/******/ var cachedModule = __webpack_module_cache__[moduleId];
25 +/******/ if (cachedModule !== undefined) {
26 +/******/ return cachedModule.exports;
27 +/******/ }
28 +/******/ // Create a new module (and put it into the cache)
29 +/******/ var module = __webpack_module_cache__[moduleId] = {
30 +/******/ // no module.id needed
31 +/******/ // no module.loaded needed
32 +/******/ exports: {}
33 +/******/ };
34 +/******/
35 +/******/ // Execute the module function
36 +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
37 +/******/
38 +/******/ // Return the exports of the module
39 +/******/ return module.exports;
40 +/******/ }
41 +/******/
42 +/************************************************************************/
43 +var __webpack_exports__ = {};
44 +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
45 +(() => {
46 +/*!*******************************************!*\
47 + !*** ../assets/dev/js/admin/gutenberg.js ***!
48 + \*******************************************/
49 +/* provided dependency */ var __ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n")["__"];
50 +
51 +
52 +/* global ElementorGutenbergSettings */
53 +(function ($) {
54 + 'use strict';
55 +
56 + var ElementorGutenbergApp = {
57 + cacheElements: function cacheElements() {
58 + var self = this;
59 + self.isElementorMode = ElementorGutenbergSettings.isElementorMode;
60 + self.cache = {};
61 + self.cache.$gutenberg = $('#editor');
62 + self.cache.$switchMode = $($('#elementor-gutenberg-button-switch-mode').html());
63 + self.cache.$switchModeButton = self.cache.$switchMode.find('#elementor-switch-mode-button');
64 + self.bindEvents();
65 + self.toggleStatus();
66 + wp.data.subscribe(function () {
67 + setTimeout(function () {
68 + self.buildPanel();
69 + }, 1);
70 + });
71 + },
72 + buildPanel: function buildPanel() {
73 + var self = this;
74 +
75 + if (!self.cache.$gutenberg.find('#elementor-switch-mode').length) {
76 + self.cache.$gutenberg.find('.edit-post-header-toolbar').append(self.cache.$switchMode);
77 + }
78 +
79 + if (!$('#elementor-editor').length) {
80 + self.cache.$editorPanel = $($('#elementor-gutenberg-panel').html()); // TODO: `editor-block-list__layout` class for WP < 5.3 support.
81 +
82 + self.cache.$gurenbergBlockList = self.cache.$gutenberg.find('.editor-block-list__layout, .editor-post-text-editor, .block-editor-block-list__layout');
83 + self.cache.$gurenbergBlockList.after(self.cache.$editorPanel);
84 + self.cache.$editorPanelButton = self.cache.$editorPanel.find('#elementor-go-to-edit-page-link');
85 + self.cache.$editorPanelButton.on('click', function (event) {
86 + event.preventDefault();
87 + self.animateLoader(); // A new post is initialized as an 'auto-draft'.
88 + // if the post is not a new post it should not save it to avoid some saving conflict between elementor and gutenberg.
89 +
90 + var isNewPost = 'auto-draft' === wp.data.select('core/editor').getCurrentPost().status;
91 +
92 + if (isNewPost) {
93 + var documentTitle = wp.data.select('core/editor').getEditedPostAttribute('title');
94 +
95 + if (!documentTitle) {
96 + wp.data.dispatch('core/editor').editPost({
97 + title: 'Elementor #' + $('#post_ID').val()
98 + });
99 + }
100 +
101 + wp.data.dispatch('core/editor').savePost();
102 + }
103 +
104 + self.redirectWhenSave();
105 + });
106 + }
107 + },
108 + bindEvents: function bindEvents() {
109 + var self = this;
110 + self.cache.$switchModeButton.on('click', function () {
111 + if (self.isElementorMode) {
112 + elementorCommon.dialogsManager.createWidget('confirm', {
113 + message: __('Please note that you are switching to WordPress default editor. Your current layout, design and content might break.', 'elementor'),
114 + headerMessage: __('Back to WordPress Editor', 'elementor'),
115 + strings: {
116 + confirm: __('Continue', 'elementor'),
117 + cancel: __('Cancel', 'elementor')
118 + },
119 + defaultOption: 'confirm',
120 + onConfirm: function onConfirm() {
121 + var wpEditor = wp.data.dispatch('core/editor');
122 + wpEditor.editPost({
123 + gutenberg_elementor_mode: false
124 + });
125 + wpEditor.savePost();
126 + self.isElementorMode = !self.isElementorMode;
127 + self.toggleStatus();
128 + }
129 + }).show();
130 + } else {
131 + self.isElementorMode = !self.isElementorMode;
132 + self.toggleStatus();
133 + self.cache.$editorPanelButton.trigger('click');
134 + }
135 + });
136 + },
137 + redirectWhenSave: function redirectWhenSave() {
138 + var self = this;
139 + setTimeout(function () {
140 + if (wp.data.select('core/editor').isSavingPost()) {
141 + self.redirectWhenSave();
142 + } else {
143 + location.href = ElementorGutenbergSettings.editLink;
144 + }
145 + }, 300);
146 + },
147 + animateLoader: function animateLoader() {
148 + this.cache.$editorPanelButton.addClass('elementor-animate');
149 + },
150 + toggleStatus: function toggleStatus() {
151 + jQuery('body').toggleClass('elementor-editor-active', this.isElementorMode).toggleClass('elementor-editor-inactive', !this.isElementorMode);
152 + },
153 + init: function init() {
154 + this.cacheElements();
155 + }
156 + };
157 + $(function () {
158 + ElementorGutenbergApp.init();
159 + });
160 +})(jQuery);
161 +})();
162 +
163 +/******/ })()
164 +;
130 165 //# sourceMappingURL=gutenberg.js.map