summaryrefslogtreecommitdiff
blob: 9825c1b4c4b8a04778bcef925d887c5aaead84f5 (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
/* 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 );
})();