editor.js
31 lines
| 1 | jQuery(window).ready(function () { |
| 2 | if (typeof elementor === 'undefined') { |
| 3 | return; |
| 4 | } |
| 5 | |
| 6 | // Form edit link |
| 7 | elementor.channels.editor.on('surecart:form:edit', function (view) { |
| 8 | let block_id = view.elementSettingsModel.get('sc_form_block'); |
| 9 | if (!block_id) { |
| 10 | return; |
| 11 | } |
| 12 | |
| 13 | let win = window.open( |
| 14 | scElementorData.site_url + |
| 15 | `/wp-admin/post.php?post=${block_id}&action=edit`, |
| 16 | '_blank' |
| 17 | ); |
| 18 | win.focus(); |
| 19 | }); |
| 20 | |
| 21 | // Form create link |
| 22 | elementor.channels.editor.on('surecart:form:create', function () { |
| 23 | let win = window.open( |
| 24 | scElementorData.site_url + |
| 25 | `/wp-admin/post-new.php?post_type=sc_form`, |
| 26 | '_blank' |
| 27 | ); |
| 28 | win.focus(); |
| 29 | }); |
| 30 | }); |
| 31 |