| @@ -1,4 +1,5 @@ | ||
| 1 | +/*! elementor - v3.7.3 - 29-08-2022 */ | |
| 1 | 2 | /******/ (() => { // webpackBootstrap |
| 2 | 3 | /******/ "use strict"; |
| 3 | 4 | /******/ var __webpack_modules__ = ({ |
| 4 | 5 | |
| @@ -38,9 +39,10 @@ | ||
| 38 | 39 | /******/ return module.exports; |
| 39 | 40 | /******/ } |
| 40 | 41 | /******/ |
| 41 | 42 | /************************************************************************/ |
| 42 | -// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. | |
| 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. | |
| 43 | 45 | (() => { |
| 44 | 46 | /*!*******************************************!*\ |
| 45 | 47 | !*** ../assets/dev/js/admin/gutenberg.js ***! |
| 46 | 48 | \*******************************************/ |
| @@ -68,75 +70,41 @@ | ||
| 68 | 70 | }); |
| 69 | 71 | }, |
| 70 | 72 | buildPanel: function buildPanel() { |
| 71 | 73 | var self = this; |
| 74 | + | |
| 72 | 75 | if (!self.cache.$gutenberg.find('#elementor-switch-mode').length) { |
| 73 | 76 | self.cache.$gutenberg.find('.edit-post-header-toolbar').append(self.cache.$switchMode); |
| 74 | 77 | } |
| 75 | - if (this.hasIframe()) { | |
| 76 | - this.handleIframe(); | |
| 77 | - } | |
| 78 | + | |
| 78 | 79 | if (!$('#elementor-editor').length) { |
| 79 | - self.cache.$editorPanel = $($('#elementor-gutenberg-panel').html()); | |
| 80 | - var editorButtonParent = self.cache.$gutenberg.find('.block-editor-writing-flow'); | |
| 81 | - if (!editorButtonParent.length) { | |
| 82 | - editorButtonParent = self.cache.$gutenberg.find('.is-desktop-preview'); | |
| 83 | - } | |
| 84 | - self.cache.$gurenbergBlockList = editorButtonParent; | |
| 85 | - self.cache.$gurenbergBlockList.append(self.cache.$editorPanel); | |
| 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); | |
| 86 | 84 | self.cache.$editorPanelButton = self.cache.$editorPanel.find('#elementor-go-to-edit-page-link'); |
| 87 | 85 | self.cache.$editorPanelButton.on('click', function (event) { |
| 88 | 86 | event.preventDefault(); |
| 89 | - self.handleEditButtonClick(); | |
| 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(); | |
| 90 | 105 | }); |
| 91 | 106 | } |
| 92 | - }, | |
| 93 | - handleIframe: function handleIframe() { | |
| 94 | - this.hideIframeContent(); | |
| 95 | - this.buildPanelTopBar(); | |
| 96 | - }, | |
| 97 | - // Sometimes Gutenberg uses iframe instead of div. | |
| 98 | - hasIframe: function hasIframe() { | |
| 99 | - return !!this.cache.$gutenberg.find('iframe[name="editor-canvas"]').length; | |
| 100 | - }, | |
| 101 | - hideIframeContent: function hideIframeContent() { | |
| 102 | - if (!this.isElementorMode) { | |
| 103 | - return; | |
| 104 | - } | |
| 105 | - var style = "<style>\n\t\t\t\t.editor-post-text-editor,\n\t\t\t\t.block-editor-block-list__layout {\n\t\t\t\t\tdisplay: none;\n\t\t\t\t}\n\n\t\t\t\tbody {\n\t\t\t\t\tpadding: 0 !important;\n\t\t\t\t}\n\t\t\t</style>"; | |
| 106 | - this.cache.$gutenberg.find('iframe[name="editor-canvas"]').contents().find('body').append(style); | |
| 107 | - }, | |
| 108 | - buildPanelTopBar: function buildPanelTopBar() { | |
| 109 | - var self = this; | |
| 110 | - if (!$('#elementor-edit-mode-button').length && this.isElementorMode) { | |
| 111 | - self.cache.$editorBtnTop = $($('#elementor-gutenberg-button-tmpl').html()); | |
| 112 | - self.cache.$gutenberg.find('.edit-post-header-toolbar').append(self.cache.$editorBtnTop); | |
| 113 | - $('#elementor-edit-mode-button').on('click', function (event) { | |
| 114 | - event.preventDefault(); | |
| 115 | - self.handleEditButtonClick(false); | |
| 116 | - }); | |
| 117 | - } | |
| 118 | - }, | |
| 119 | - handleEditButtonClick: function handleEditButtonClick() { | |
| 120 | - var withAnimation = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; | |
| 121 | - var self = this; | |
| 122 | - if (withAnimation) { | |
| 123 | - self.animateLoader(); | |
| 124 | - } | |
| 125 | - | |
| 126 | - // A new post is initialized as an 'auto-draft'. | |
| 127 | - // if the post is not a new post it should not save it to avoid some saving conflict between elementor and gutenberg. | |
| 128 | - var isNewPost = 'auto-draft' === wp.data.select('core/editor').getCurrentPost().status; | |
| 129 | - if (isNewPost) { | |
| 130 | - var documentTitle = wp.data.select('core/editor').getEditedPostAttribute('title'); | |
| 131 | - if (!documentTitle) { | |
| 132 | - wp.data.dispatch('core/editor').editPost({ | |
| 133 | - title: 'Elementor #' + $('#post_ID').val() | |
| 134 | - }); | |
| 135 | - } | |
| 136 | - wp.data.dispatch('core/editor').savePost(); | |
| 137 | - } | |
| 138 | - self.redirectWhenSave(); | |
| 139 | 107 | }, |
| 140 | 108 | bindEvents: function bindEvents() { |
| 141 | 109 | var self = this; |
| 142 | 110 | self.cache.$switchModeButton.on('click', function () { |