summaryrefslogtreecommitdiff
blob: 8104ea3200e535c0d1b8b37845edd85a5366a76f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* 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 );
} )();