tinymce-plugin-form-button.js 878 B

12345678910111213141516171819202122232425262728293031323334
  1. /* global grunionEditorView, tinymce */
  2. (function() {
  3. tinymce.create( 'tinymce.plugins.grunion_form', {
  4. init : function( editor ) {
  5. editor.addButton( 'grunion', {
  6. title : grunionEditorView.labels.tinymce_label,
  7. cmd : 'grunion_add_form',
  8. icon : 'grunion'
  9. });
  10. editor.addCommand('grunion_add_form', function() {
  11. if ( grunionEditorView.default_form ) {
  12. editor.execCommand( 'mceInsertContent', 0, '[contact-form]' + grunionEditorView.default_form + '[/contact-form]' );
  13. } else {
  14. editor.execCommand( 'mceInsertContent', 0, '[contact-form /]' );
  15. }
  16. });
  17. },
  18. createControl : function() {
  19. return null;
  20. },
  21. getInfo : function() {
  22. return {
  23. longname : 'Grunion Contact Form',
  24. author : 'Automattic',
  25. version : '1'
  26. };
  27. }
  28. });
  29. tinymce.PluginManager.add( 'grunion_form', tinymce.plugins.grunion_form );
  30. })();