|
473 | 473 | loading(is_loading); |
474 | 474 | _that.hide(); |
475 | 475 |
|
476 | | - let curPos = currentSection.parents('.elementor-add-section-inline').index(); |
477 | | - if(jurl){ |
478 | | - let position = curPos; |
| 476 | + let curPos = currentSection.parents('.elementor-add-section-inline').index(); |
| 477 | + |
| 478 | + let options = { at: curPos }; |
| 479 | + if(jurl){ |
| 480 | + |
479 | 481 | $.get({ url: "https://block.animation-addons.com/wp-json/wp/v2/wcf-templates/json-content?url="+jurl, crossDomain: true }) |
480 | 482 | .done(function (data) { |
481 | | - let options = { at: position }; |
| 483 | + console.log(data); |
482 | 484 | if (data?.content) { |
483 | | - |
484 | | - $e.run("document/elements/import", { |
485 | | - model: window.elementor.elementsModel, |
486 | | - data: data, |
487 | | - options: options, |
488 | | - }); |
489 | | - |
490 | | - is_loading = false; |
491 | | - window.wcftmLibrary.hide(); |
492 | | - |
493 | | - elementor.notifications.showToast({ |
494 | | - message: elementor.translate("Content Pasted!"), |
495 | | - }); |
| 485 | + |
| 486 | + window.wcftmLibrary.currentRequest = elementorCommon.ajax.addRequest("get_wcf_template_data", { |
| 487 | + unique_id: template_id, |
| 488 | + data: { |
| 489 | + edit_mode: !0, |
| 490 | + display: !0, |
| 491 | + template_id: template_id, |
| 492 | + json_data : data |
| 493 | + }, |
| 494 | + success: function (e) { |
| 495 | + $e.run("document/elements/import", { |
| 496 | + model: window.elementor.elementsModel, |
| 497 | + data: e, |
| 498 | + options: options |
| 499 | + }); |
| 500 | + is_loading = false; |
| 501 | + window.wcftmLibrary.hide(); |
| 502 | + }, |
| 503 | + }).fail(function () {}); |
| 504 | + |
496 | 505 |
|
497 | 506 | } |
498 | 507 | }); |
|
509 | 518 | $e.run("document/elements/import", { |
510 | 519 | model: window.elementor.elementsModel, |
511 | 520 | data: e, |
| 521 | + options: options |
512 | 522 | }); |
| 523 | + |
513 | 524 | is_loading = false; |
514 | 525 | window.wcftmLibrary.hide(); |
515 | 526 | }, |
|
0 commit comments