# convertkit/2.3.4/resources/backend/js/tinymce.js

Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages, version 2.3.4. 101 lines.

- Page: https://pluginprobe.com/plugins/convertkit/2.3.4/code/resources/backend/js/tinymce.js
- Raw: https://pluginprobe.com/plugins/convertkit/2.3.4/raw/resources/backend/js/tinymce.js
- Modified: 2023-09-06T15:12:14+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/convertkit/2.3.4/code/resources/backend/js/tinymce.js#L10-L20`.

```javascript
/**
 * Handles registration of TinyMCE buttons.
 *
 * @since   1.9.6
 *
 * @package ConvertKit
 * @author ConvertKit
 */

/**
 * Registers the given block as a TinyMCE Plugin, with a button in
 * the Visual Editor toolbar.
 *
 * @since 	1.9.6
 *
 * @param 	object 	block 	Block
 */
function convertKitTinyMCERegisterPlugin( block ) {

	( function ( $ ) {

		tinymce.PluginManager.add(
			'convertkit_' + block.name,
			function ( editor, url ) {

				// Add Button to Visual Editor Toolbar.
				editor.addButton(
					'convertkit_' + block.name,
					{
						title: 	block.title,
						image: 	url + '../../../../' + block.icon,
						cmd: 	'convertkit_' + block.name,
					}
				);

				// Load View when button clicked.
				editor.addCommand(
					'convertkit_' + block.name,
					function () {

						// Close any existing QuickTags modal.
						convertKitQuickTagsModal.close();

						// Open the TinyMCE Modal.
						editor.windowManager.open(
							{
								id: 	'convertkit-modal-body',
								title: 	block.title,
								width: 	block.modal.width,

								// Set modal height up to a maximum of 580px.
								// Content will overflow-y to show a scrollbar where necessary.
								height: ( block.modal.height < 580 ? block.modal.height : 580 ),
								inline: 1,
								buttons: [
								{
									text: 'Cancel',
									classes: 'cancel'
								},
								{
									text: 'Insert',
									subtype: 'primary',
									classes: 'insert'
								}
								]
							}
						);

						// Perform an AJAX call to load the modal's view.
						$.post(
							ajaxurl,
							{
								'action': 		'convertkit_admin_tinymce_output_modal',
								'nonce':  		convertkit_admin_tinymce.nonce,
								'editor_type':  'tinymce',
								'shortcode': 	block.name
							},
							function ( response ) {

								// Inject HTML into modal.
								$( '#convertkit-modal-body-body' ).html( response );

								// Initialize tabbed interface.
								convertKitTabsInit();

								// Initialize color pickers.
								$( '.convertkit-color-picker' ).wpColorPicker();

							}
						);

					}
				);

			}
		);

	} )( jQuery );

}

```
