|
9 | 9 |
|
10 | 10 | function getUniqueId( elements ) { |
11 | 11 | elements.forEach( function( item, index ) { |
12 | | - item.id = elementor.helpers.getUniqueID(); |
| 12 | + item.id = elementorCommon.helpers.getUniqueId(); |
13 | 13 | if( item.elements.length > 0 ) { |
14 | 14 | getUniqueId( item.elements ); |
15 | 15 | } |
|
133 | 133 | copiedElement.elementCode = element.model.toJSON(); |
134 | 134 | xdLocalStorage.setItem( 'mighty-xscp-element', JSON.stringify(copiedElement), function (data) { |
135 | 135 | elementor.notifications.showToast({ |
136 | | - message: elementor.translate('Element Copied!') |
| 136 | + message: elementor.translate('Element Copied! 🎉') |
137 | 137 | }); |
138 | 138 | }); |
139 | 139 | } |
|
146 | 146 | pasteElement( JSON.parse( newElement.value ), element ); |
147 | 147 |
|
148 | 148 | elementor.notifications.showToast({ |
149 | | - message: elementor.translate('Element Pasted!') |
| 149 | + message: elementor.translate('Element Pasted! 🎉') |
150 | 150 | }); |
151 | 151 | }); |
152 | 152 | } |
|
167 | 167 |
|
168 | 168 | xdLocalStorage.setItem( 'mighty-xscp-page-sections', JSON.stringify(allSections), function (data) { |
169 | 169 | elementor.notifications.showToast({ |
170 | | - message: elementor.translate('All Sections Copied!') |
| 170 | + message: elementor.translate('All Sections Copied! 🎉') |
171 | 171 | }); |
172 | 172 | }); |
173 | 173 | } |
|
188 | 188 | }) |
189 | 189 | .then(response => response.json()) |
190 | 190 | .then((tmpl) => { |
| 191 | + |
| 192 | + var elements = getUniqueId( tmpl.data.data.template.content ); |
| 193 | + |
191 | 194 | if ( MightyLibrary.elementorCompatible ) { |
192 | 195 | // Compatibility for older elementor versions |
193 | | - elementor.sections.currentView.addChildModel(tmpl.data.data.template.content) |
| 196 | + elementor.sections.currentView.addChildModel( elements ) |
194 | 197 | } else { |
195 | | - elementor.previewView.addChildModel(tmpl.data.data.template.content) |
| 198 | + elementor.previewView.addChildModel( elements ) |
196 | 199 | } |
197 | 200 | elementor.notifications.showToast({ |
198 | | - message: elementor.translate('Page Pasted!') |
| 201 | + message: elementor.translate('Page Pasted! 🎉') |
199 | 202 | }); |
200 | 203 | }) |
201 | 204 | .catch(function(error) { |
|
0 commit comments