PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 2.3.4
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v2.3.4
3.4.2 3.4.1 3.4.0 3.3.9 3.3.8 3.3.7 3.3.6 3.3.5 3.3.4 3.3.3 3.3.2 3.3.1 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3.0 2.3.1 2.3.2 All 195 releases
convertkit / resources / backend / js / tinymce.js

tinymce.js in Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages 2.3.4, at resources/backend/js/tinymce.js

101 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * Handles registration of TinyMCE buttons.
3 *
4 * @since 1.9.6
5 *
6 * @package ConvertKit
7 * @author ConvertKit
8 */
9
10 /**
11 * Registers the given block as a TinyMCE Plugin, with a button in
12 * the Visual Editor toolbar.
13 *
14 * @since 1.9.6
15 *
16 * @param object block Block
17 */
18 function convertKitTinyMCERegisterPlugin( block ) {
19
20 ( function ( $ ) {
21
22 tinymce.PluginManager.add(
23 'convertkit_' + block.name,
24 function ( editor, url ) {
25
26 // Add Button to Visual Editor Toolbar.
27 editor.addButton(
28 'convertkit_' + block.name,
29 {
30 title: block.title,
31 image: url + '../../../../' + block.icon,
32 cmd: 'convertkit_' + block.name,
33 }
34 );
35
36 // Load View when button clicked.
37 editor.addCommand(
38 'convertkit_' + block.name,
39 function () {
40
41 // Close any existing QuickTags modal.
42 convertKitQuickTagsModal.close();
43
44 // Open the TinyMCE Modal.
45 editor.windowManager.open(
46 {
47 id: 'convertkit-modal-body',
48 title: block.title,
49 width: block.modal.width,
50
51 // Set modal height up to a maximum of 580px.
52 // Content will overflow-y to show a scrollbar where necessary.
53 height: ( block.modal.height < 580 ? block.modal.height : 580 ),
54 inline: 1,
55 buttons: [
56 {
57 text: 'Cancel',
58 classes: 'cancel'
59 },
60 {
61 text: 'Insert',
62 subtype: 'primary',
63 classes: 'insert'
64 }
65 ]
66 }
67 );
68
69 // Perform an AJAX call to load the modal's view.
70 $.post(
71 ajaxurl,
72 {
73 'action': 'convertkit_admin_tinymce_output_modal',
74 'nonce': convertkit_admin_tinymce.nonce,
75 'editor_type': 'tinymce',
76 'shortcode': block.name
77 },
78 function ( response ) {
79
80 // Inject HTML into modal.
81 $( '#convertkit-modal-body-body' ).html( response );
82
83 // Initialize tabbed interface.
84 convertKitTabsInit();
85
86 // Initialize color pickers.
87 $( '.convertkit-color-picker' ).wpColorPicker();
88
89 }
90 );
91
92 }
93 );
94
95 }
96 );
97
98 } )( jQuery );
99
100 }
101