Skip to content

Commit 1be3b8e

Browse files
update
1 parent 2d2f9c0 commit 1be3b8e

File tree

5 files changed

+68
-40
lines changed

5 files changed

+68
-40
lines changed

assets/js/wcf-template-library.js

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -473,26 +473,35 @@
473473
loading(is_loading);
474474
_that.hide();
475475

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+
479481
$.get({ url: "https://block.animation-addons.com/wp-json/wp/v2/wcf-templates/json-content?url="+jurl, crossDomain: true })
480482
.done(function (data) {
481-
let options = { at: position };
483+
console.log(data);
482484
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+
496505

497506
}
498507
});
@@ -509,7 +518,9 @@
509518
$e.run("document/elements/import", {
510519
model: window.elementor.elementsModel,
511520
data: e,
521+
options: options
512522
});
523+
513524
is_loading = false;
514525
window.wcftmLibrary.hide();
515526
},

0 commit comments

Comments
 (0)