| @@ -1,4 +1,5 @@ | ||
| 1 | +/*! elementor - v3.9.2 - 21-12-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 | \*******************************************/ |
| @@ -71,72 +73,33 @@ | ||
| 71 | 73 | var self = this; |
| 72 | 74 | if (!self.cache.$gutenberg.find('#elementor-switch-mode').length) { |
| 73 | 75 | self.cache.$gutenberg.find('.edit-post-header-toolbar').append(self.cache.$switchMode); |
| 74 | 76 | } |
| 75 | - if (this.hasIframe()) { | |
| 76 | - this.handleIframe(); | |
| 77 | - } | |
| 78 | 77 | if (!$('#elementor-editor').length) { |
| 79 | 78 | 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); | |
| 79 | + // TODO: `editor-block-list__layout` class for WP < 5.3 support. | |
| 80 | + self.cache.$gurenbergBlockList = self.cache.$gutenberg.find('.editor-block-list__layout, .editor-post-text-editor, .block-editor-block-list__layout'); | |
| 81 | + self.cache.$gurenbergBlockList.after(self.cache.$editorPanel); | |
| 86 | 82 | self.cache.$editorPanelButton = self.cache.$editorPanel.find('#elementor-go-to-edit-page-link'); |
| 87 | 83 | self.cache.$editorPanelButton.on('click', function (event) { |
| 88 | 84 | event.preventDefault(); |
| 89 | - self.handleEditButtonClick(); | |
| 85 | + self.animateLoader(); | |
| 86 | + | |
| 87 | + // 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 | + var isNewPost = 'auto-draft' === wp.data.select('core/editor').getCurrentPost().status; | |
| 90 | + if (isNewPost) { | |
| 91 | + var documentTitle = wp.data.select('core/editor').getEditedPostAttribute('title'); | |
| 92 | + if (!documentTitle) { | |
| 93 | + wp.data.dispatch('core/editor').editPost({ | |
| 94 | + title: 'Elementor #' + $('#post_ID').val() | |
| 95 | + }); | |
| 96 | + } | |
| 97 | + wp.data.dispatch('core/editor').savePost(); | |
| 98 | + } | |
| 99 | + self.redirectWhenSave(); | |
| 90 | 100 | }); |
| 91 | 101 | } |
| 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 | 102 | }, |
| 140 | 103 | bindEvents: function bindEvents() { |
| 141 | 104 | var self = this; |
| 142 | 105 | self.cache.$switchModeButton.on('click', function () { |