66/* global jQuery, WCF_Addons_Editor*/
77
88( function ( $ , window , document , config ) {
9- elementor . hooks . addAction ( "panel/open_editor/widget/wcf--mailchimp" , function ( panel , model , view ) {
10- var ajax_request = function ajax_request ( $api ) {
11- jQuery . ajax ( {
12- type : "post" ,
13- dataType : "json" ,
14- url : config . ajaxUrl ,
15- data : {
16- action : "mailchimp_api" ,
17- nonce : config . _wpnonce ,
18- api : $api
19- } ,
20- success : function success ( response ) {
21- var audience = panel . $el . find ( '[data-setting="mailchimp_lists"]' ) ;
22- if ( Object . keys ( response ) . length ) {
23- var data = {
24- id : Object . keys ( response ) ,
25- text : Object . values ( response )
26- } ;
27- var newOption = new Option ( data . text , data . id , false , false ) ;
28- audience . append ( newOption ) . trigger ( "change" ) ;
29- } else {
30- audience . empty ( ) ;
31- }
9+ elementor . hooks . addAction (
10+ "panel/open_editor/widget/wcf--mailchimp" ,
11+ function ( panel , model , view ) {
12+ const ajax_request = function ( $api ) {
13+ jQuery . ajax ( {
14+ type : "post" ,
15+ dataType : "json" ,
16+ url : config . ajaxUrl ,
17+ data : {
18+ action : "mailchimp_api" ,
19+ nonce : config . _wpnonce ,
20+ api : $api ,
21+ } ,
22+ success : function ( response ) {
23+ const audience = panel . $el . find ( '[data-setting="mailchimp_lists"]' ) ;
24+ if ( Object . keys ( response ) . length ) {
25+ const data = {
26+ id : Object . keys ( response ) ,
27+ text : Object . values ( response ) ,
28+ } ;
29+ const newOption = new Option ( data . text , data . id , false , false ) ;
30+ audience . append ( newOption ) . trigger ( "change" ) ;
31+ } else {
32+ audience . empty ( ) ;
33+ }
34+ } ,
35+ } ) ;
36+ } ;
37+
38+ } ) ;
39+
40+ // Custom Css
41+ elementor . hooks . addFilter ( 'editor/style/styleText' , function ( css , context ) {
42+ if ( ! context ) {
43+ return ;
44+ }
45+ const model = context . model ,
46+ customCSS = model . get ( 'settings' ) . get ( 'wcf_custom_css' ) ;
47+ let selector = '.elementor-element.elementor-element-' + model . get ( 'id' ) ;
48+ if ( 'document' === model . get ( 'elType' ) ) {
49+ selector = elementor . config . document . settings . cssWrapperSelector ;
3250 }
33- } ) ;
34- } ;
35- } ) ;
51+ if ( customCSS ) {
52+ css += customCSS . replace ( / s e l e c t o r / g, selector ) ;
53+ }
54+ return css ;
55+ } ) ;
56+
57+
3658
37- // Custom Css
38- elementor . hooks . addFilter ( 'editor/style/styleText' , function ( css , context ) {
39- if ( ! context ) {
40- return ;
41- }
42- var model = context . model ,
43- customCSS = model . get ( 'settings' ) . get ( 'wcf_custom_css' ) ;
44- var selector = '.elementor-element.elementor-element-' + model . get ( 'id' ) ;
45- if ( 'document' === model . get ( 'elType' ) ) {
46- selector = elementor . config . document . settings . cssWrapperSelector ;
47- }
48- if ( customCSS ) {
49- css += customCSS . replace ( / s e l e c t o r / g, selector ) ;
50- }
51- return css ;
52- } ) ;
53- } ) ( jQuery , window , document , WCF_Addons_Editor ) ;
59+
60+ } ) ( jQuery , window , document , WCF_Addons_Editor ) ;
0 commit comments