summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/modules/contact-form/js/tinymce-plugin-form-button.js')
-rw-r--r--plugins/jetpack/modules/contact-form/js/tinymce-plugin-form-button.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/plugins/jetpack/modules/contact-form/js/tinymce-plugin-form-button.js b/plugins/jetpack/modules/contact-form/js/tinymce-plugin-form-button.js
new file mode 100644
index 00000000..9825c1b4
--- /dev/null
+++ b/plugins/jetpack/modules/contact-form/js/tinymce-plugin-form-button.js
@@ -0,0 +1,34 @@
+/* global grunionEditorView, tinymce */
+(function() {
+ tinymce.create( 'tinymce.plugins.grunion_form', {
+
+ init : function( editor ) {
+ editor.addButton( 'grunion', {
+ title : grunionEditorView.labels.tinymce_label,
+ cmd : 'grunion_add_form',
+ icon : 'grunion'
+ });
+ editor.addCommand('grunion_add_form', function() {
+ if ( grunionEditorView.default_form ) {
+ editor.execCommand( 'mceInsertContent', 0, '[contact-form]' + grunionEditorView.default_form + '[/contact-form]' );
+ } else {
+ editor.execCommand( 'mceInsertContent', 0, '[contact-form /]' );
+ }
+ });
+ },
+
+ createControl : function() {
+ return null;
+ },
+
+ getInfo : function() {
+ return {
+ longname : 'Grunion Contact Form',
+ author : 'Automattic',
+ version : '1'
+ };
+ }
+ });
+
+ tinymce.PluginManager.add( 'grunion_form', tinymce.plugins.grunion_form );
+})(); \ No newline at end of file