Version Description
- Fix MCE Previews that were broken in WP 4.2
Download this release
Release Info
Developer | tlovett1 |
Plugin | Custom Contact Forms |
Version | 6.7.1 |
Comparing to | |
See all releases |
Code changes from version 6.7.0 to 6.7.1
- build/js/form-mce.min.js +1 -1
- custom-contact-forms.php +1 -1
- js/form-mce.js +61 -73
- readme.txt +5 -2
build/js/form-mce.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(function(
|
1 |
+
(function(){wp.mce.ccfForm={template:wp.ccf.utils.template("ccf-form-mce-preview"),initialize:function(){wp.ccf.dispatcher.on("saveFormComplete",this.triggerRefresh,this),this.fetch()},triggerRefresh:function(e){e===wp.ccf.forms.findWhere({ID:parseInt(this.shortcode.attrs.named.id)})&&(this.renderPreviews(),this.render(this.getHtml()))},fetch:function(){var e=this,t=parseInt(e.shortcode.attrs.named.id),i=wp.ccf.forms.findWhere({ID:t});i?(e.renderPreviews(),e.render(e.getHtml())):(wp.ccf.forms.formsFetching[t]!==void 0?e.formFetch=wp.ccf.forms.formsFetching[t]:(i=new wp.ccf.models.Form({ID:t}),e.formFetch=i.fetch(),wp.ccf.forms.formsFetching[t]=e.formFetch),e.formFetch.complete(function(){"resolved"===e.formFetch.state()&&i!==void 0&&(wp.ccf.forms.add(i),delete wp.ccf.forms.formsFetching[t]),e.renderPreviews(),e.render(e.getHtml())}))},renderPreviews:function(){var e=parseInt(this.shortcode.attrs.named.id),t=wp.ccf.forms.findWhere({ID:e});if(t){var i=t.get("fields");i.each(function(e){var t=document.getElementById("ccf-"+e.get("type")+"-preview-template");if(t){var i=wp.ccf.utils.template("ccf-"+e.get("type")+"-preview-template")({field:e.toJSON(),mce:!0});e.set("preview",i)}})}},getHtml:function(){var e=parseInt(this.shortcode.attrs.named.id);if(this.formFetch===void 0||"resolved"===this.formFetch.state()||"rejected"===this.formFetch.state()){var t=wp.ccf.forms.findWhere({ID:e});return this.formFetch===void 0?this.template({form:t.toJSON()}):"resolved"===this.formFetch.state()?this.template({form:t.toJSON()}):wp.ccf.utils.template("ccf-form-mce-error-preview")()}return!1},edit:function(){var e=this.shortcode.attrs.named.id,t=wp.ccf.forms.findWhere({ID:parseInt(e)});return t?(wp.ccf.show(t),void 0):!1}},wp.mce.views.register("ccf_form",wp.mce.ccfForm)})(jQuery);
|
custom-contact-forms.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin URI: http://www.taylorlovett.com
|
5 |
* Description: Build beautiful custom forms the WordPress way. View live previews of your forms while you build them.
|
6 |
* Author: Taylor Lovett
|
7 |
-
* Version: 6.7.
|
8 |
* Author URI: http://www.taylorlovett.com
|
9 |
*/
|
10 |
|
4 |
* Plugin URI: http://www.taylorlovett.com
|
5 |
* Description: Build beautiful custom forms the WordPress way. View live previews of your forms while you build them.
|
6 |
* Author: Taylor Lovett
|
7 |
+
* Version: 6.7.1
|
8 |
* Author URI: http://www.taylorlovett.com
|
9 |
*/
|
10 |
|
js/form-mce.js
CHANGED
@@ -1,109 +1,97 @@
|
|
1 |
( function( $ ){
|
2 |
|
3 |
wp.mce.ccfForm = {
|
4 |
-
|
5 |
|
6 |
-
|
|
|
7 |
|
8 |
-
|
9 |
-
|
10 |
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
-
|
|
|
14 |
|
15 |
-
|
16 |
-
this.shortcode = options.shortcode;
|
17 |
|
18 |
-
|
19 |
|
20 |
-
|
21 |
-
},
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
|
|
|
|
27 |
}
|
28 |
-
},
|
29 |
-
fetch: function() {
|
30 |
-
var SELF = this;
|
31 |
-
|
32 |
-
var id = parseInt( SELF.shortcode.attrs.named.id );
|
33 |
-
|
34 |
-
var form = wp.ccf.forms.findWhere( { ID: id } );
|
35 |
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
} else {
|
41 |
-
form = new wp.ccf.models.Form( { ID: id } );
|
42 |
-
SELF.formFetch = form.fetch();
|
43 |
-
wp.ccf.forms.formsFetching[id] = SELF.formFetch;
|
44 |
}
|
45 |
|
46 |
-
SELF.formFetch.complete( function() {
|
47 |
-
if ( 'resolved' === SELF.formFetch.state() && typeof form !== 'undefined' ) {
|
48 |
-
wp.ccf.forms.add( form );
|
49 |
-
delete wp.ccf.forms.formsFetching[id];
|
50 |
-
}
|
51 |
-
|
52 |
-
SELF.renderPreviews();
|
53 |
-
|
54 |
-
SELF.render( true );
|
55 |
-
});
|
56 |
-
} else {
|
57 |
SELF.renderPreviews();
|
58 |
|
59 |
-
SELF.render(
|
60 |
-
}
|
61 |
-
}
|
|
|
62 |
|
63 |
-
|
64 |
-
|
|
|
65 |
|
66 |
-
|
|
|
67 |
|
68 |
-
|
69 |
-
var fields = form.get( 'fields' );
|
70 |
|
71 |
-
|
72 |
-
|
73 |
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
|
|
|
|
|
|
81 |
|
82 |
-
|
83 |
-
|
84 |
|
85 |
-
|
86 |
-
|
87 |
|
88 |
-
|
|
|
|
|
|
|
89 |
return this.template( { form: form.toJSON() } );
|
90 |
} else {
|
91 |
-
|
92 |
-
return this.template( { form: form.toJSON() } );
|
93 |
-
} else {
|
94 |
-
return wp.ccf.utils.template( 'ccf-form-mce-error-preview' )();
|
95 |
-
}
|
96 |
}
|
97 |
}
|
98 |
-
|
99 |
-
return false;
|
100 |
}
|
|
|
|
|
101 |
},
|
102 |
|
103 |
-
edit: function(
|
104 |
-
var
|
105 |
|
106 |
-
var id = data.replace( /^.*id=('|")([0-9]+)('|").*$/i, '$2' );
|
107 |
var form = wp.ccf.forms.findWhere( { ID: parseInt( id ) } );
|
108 |
|
109 |
if ( form ) {
|
1 |
( function( $ ){
|
2 |
|
3 |
wp.mce.ccfForm = {
|
4 |
+
template: wp.ccf.utils.template( 'ccf-form-mce-preview' ),
|
5 |
|
6 |
+
initialize: function( options ) {
|
7 |
+
wp.ccf.dispatcher.on( 'saveFormComplete', this.triggerRefresh, this );
|
8 |
|
9 |
+
this.fetch();
|
10 |
+
},
|
11 |
|
12 |
+
triggerRefresh: function( form ) {
|
13 |
+
if ( form === wp.ccf.forms.findWhere( { ID: parseInt( this.shortcode.attrs.named.id ) } ) ) {
|
14 |
+
this.renderPreviews();
|
15 |
+
this.render( this.getHtml() );
|
16 |
+
}
|
17 |
+
},
|
18 |
|
19 |
+
fetch: function() {
|
20 |
+
var SELF = this;
|
21 |
|
22 |
+
var id = parseInt( SELF.shortcode.attrs.named.id );
|
|
|
23 |
|
24 |
+
var form = wp.ccf.forms.findWhere( { ID: id } );
|
25 |
|
26 |
+
if ( ! form ) {
|
|
|
27 |
|
28 |
+
if ( typeof wp.ccf.forms.formsFetching[id] !== 'undefined' ) {
|
29 |
+
SELF.formFetch = wp.ccf.forms.formsFetching[id];
|
30 |
+
} else {
|
31 |
+
form = new wp.ccf.models.Form( { ID: id } );
|
32 |
+
SELF.formFetch = form.fetch();
|
33 |
+
wp.ccf.forms.formsFetching[id] = SELF.formFetch;
|
34 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
+
SELF.formFetch.complete( function() {
|
37 |
+
if ( 'resolved' === SELF.formFetch.state() && typeof form !== 'undefined' ) {
|
38 |
+
wp.ccf.forms.add( form );
|
39 |
+
delete wp.ccf.forms.formsFetching[id];
|
|
|
|
|
|
|
|
|
40 |
}
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
SELF.renderPreviews();
|
43 |
|
44 |
+
SELF.render( SELF.getHtml() );
|
45 |
+
});
|
46 |
+
} else {
|
47 |
+
SELF.renderPreviews();
|
48 |
|
49 |
+
SELF.render( SELF.getHtml() );
|
50 |
+
}
|
51 |
+
},
|
52 |
|
53 |
+
renderPreviews: function() {
|
54 |
+
var id = parseInt( this.shortcode.attrs.named.id );
|
55 |
|
56 |
+
var form = wp.ccf.forms.findWhere( { ID: id } );
|
|
|
57 |
|
58 |
+
if ( form ) {
|
59 |
+
var fields = form.get( 'fields' );
|
60 |
|
61 |
+
fields.each( function( field ) {
|
62 |
+
var template = document.getElementById( 'ccf-' + field.get( 'type' ) + '-preview-template' );
|
63 |
+
|
64 |
+
if ( template ) {
|
65 |
+
var preview = wp.ccf.utils.template( 'ccf-' + field.get( 'type' ) + '-preview-template' )( { field: field.toJSON(), mce: true } );
|
66 |
+
field.set( 'preview', preview );
|
67 |
+
}
|
68 |
+
});
|
69 |
+
}
|
70 |
+
},
|
71 |
|
72 |
+
getHtml: function() {
|
73 |
+
var id = parseInt( this.shortcode.attrs.named.id );
|
74 |
|
75 |
+
if ( typeof this.formFetch === 'undefined' || this.formFetch.state() === 'resolved' || this.formFetch.state() === 'rejected' ) {
|
76 |
+
var form = wp.ccf.forms.findWhere( { ID: id } );
|
77 |
|
78 |
+
if ( typeof this.formFetch === 'undefined' ) {
|
79 |
+
return this.template( { form: form.toJSON() } );
|
80 |
+
} else {
|
81 |
+
if ( this.formFetch.state() === 'resolved' ) {
|
82 |
return this.template( { form: form.toJSON() } );
|
83 |
} else {
|
84 |
+
return wp.ccf.utils.template( 'ccf-form-mce-error-preview' )();
|
|
|
|
|
|
|
|
|
85 |
}
|
86 |
}
|
|
|
|
|
87 |
}
|
88 |
+
|
89 |
+
return false;
|
90 |
},
|
91 |
|
92 |
+
edit: function() {
|
93 |
+
var id = this.shortcode.attrs.named.id;
|
94 |
|
|
|
95 |
var form = wp.ccf.forms.findWhere( { ID: parseInt( id ) } );
|
96 |
|
97 |
if ( form ) {
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: tlovett1
|
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=HR34W94MM53RQ
|
4 |
Tags: contact form, web form, custom contact form, custom forms, captcha form, contact fields, form mailers, forms
|
5 |
Requires at least: 3.9
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag: 6.7.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -35,6 +35,9 @@ For questions, feature requests, and support concerning the Custom Contact Forms
|
|
35 |
|
36 |
== Changelog ==
|
37 |
|
|
|
|
|
|
|
38 |
= 6.7.0 =
|
39 |
* Ability to pause forms
|
40 |
* Emulate Backbone HTTP via filter instead of API hack
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=HR34W94MM53RQ
|
4 |
Tags: contact form, web form, custom contact form, custom forms, captcha form, contact fields, form mailers, forms
|
5 |
Requires at least: 3.9
|
6 |
+
Tested up to: 4.3
|
7 |
+
Stable tag: 6.7.1
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
35 |
|
36 |
== Changelog ==
|
37 |
|
38 |
+
= 6.7.1 =
|
39 |
+
* Fix MCE Previews that were broken in WP 4.2
|
40 |
+
|
41 |
= 6.7.0 =
|
42 |
* Ability to pause forms
|
43 |
* Emulate Backbone HTTP via filter instead of API hack
|