| @@ -59,11 +59,11 @@ | ||
| 59 | 59 | |
| 60 | 60 | // Define shortcode. |
| 61 | 61 | $shortcode = $shortcodes[ $shortcode_name ]; |
| 62 | 62 | |
| 63 | - // Show a message in the modal if no API Key is specified. | |
| 64 | - if ( array_key_exists( 'has_api_key', $shortcode ) && ! $shortcode['has_api_key'] ) { | |
| 65 | - $notice = $shortcode['no_api_key']; | |
| 63 | + // Show a message in the modal if no Access Token is specified. | |
| 64 | + if ( array_key_exists( 'has_access_token', $shortcode ) && ! $shortcode['has_access_token'] ) { | |
| 65 | + $notice = $shortcode['no_access_token']; | |
| 66 | 66 | require_once CONVERTKIT_PLUGIN_PATH . '/views/backend/tinymce/modal-notice.php'; |
| 67 | 67 | die(); |
| 68 | 68 | } |
| 69 | 69 | |
| @@ -73,10 +73,16 @@ | ||
| 73 | 73 | require_once CONVERTKIT_PLUGIN_PATH . '/views/backend/tinymce/modal-notice.php'; |
| 74 | 74 | die(); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - // Output the modal. | |
| 78 | - require_once CONVERTKIT_PLUGIN_PATH . '/views/backend/tinymce/modal.php'; | |
| 77 | + // If we have less than two panels defined in the shortcode properties, output a basic modal. | |
| 78 | + if ( count( $shortcode['panels'] ) < 2 ) { | |
| 79 | + require_once CONVERTKIT_PLUGIN_PATH . '/views/backend/tinymce/modal.php'; | |
| 80 | + die(); | |
| 81 | + } | |
| 82 | + | |
| 83 | + // Output tabbed view. | |
| 84 | + require_once CONVERTKIT_PLUGIN_PATH . '/views/backend/tinymce/modal-tabbed.php'; | |
| 79 | 85 | die(); |
| 80 | 86 | |
| 81 | 87 | } |
| 82 | 88 | |
| @@ -95,9 +101,9 @@ | ||
| 95 | 101 | return; |
| 96 | 102 | } |
| 97 | 103 | |
| 98 | 104 | // Enqueue Quicktag JS. |
| 99 | - wp_enqueue_script( 'convertkit-admin-quicktags', CONVERTKIT_PLUGIN_URL . 'resources/backend/js/quicktags.js', array( 'jquery', 'quicktags' ), CONVERTKIT_PLUGIN_VERSION, true ); | |
| 105 | + wp_enqueue_script( 'convertkit-admin-quicktags', CONVERTKIT_PLUGIN_URL . 'resources/backend/js/quicktags.js', array( 'quicktags' ), CONVERTKIT_PLUGIN_VERSION, true ); | |
| 100 | 106 | |
| 101 | 107 | // Make shortcodes available as convertkit_quicktags JS variable. |
| 102 | 108 | wp_localize_script( 'convertkit-admin-quicktags', 'convertkit_quicktags', $shortcodes ); |
| 103 | 109 | |
| @@ -112,12 +118,8 @@ | ||
| 112 | 118 | |
| 113 | 119 | // Enqueue Quicktag CSS. |
| 114 | 120 | wp_enqueue_style( 'convertkit-admin-quicktags', CONVERTKIT_PLUGIN_URL . 'resources/backend/css/quicktags.css', array(), CONVERTKIT_PLUGIN_VERSION ); |
| 115 | 121 | |
| 116 | - // Enqueue WordPress JS and CSS. | |
| 117 | - wp_enqueue_script( 'wp-color-picker' ); | |
| 118 | - wp_enqueue_style( 'wp-color-picker' ); | |
| 119 | - | |
| 120 | 122 | // Output Backbone View Template. |
| 121 | 123 | add_action( 'wp_print_footer_scripts', array( $this, 'output_quicktags_modal' ) ); |
| 122 | 124 | add_action( 'admin_print_footer_scripts', array( $this, 'output_quicktags_modal' ) ); |
| 123 | 125 | |
| @@ -141,10 +143,11 @@ | ||
| 141 | 143 | return $plugins; |
| 142 | 144 | } |
| 143 | 145 | |
| 144 | 146 | // Enqueue TinyMCE CSS and JS. |
| 145 | - wp_enqueue_script( 'convertkit-admin-tinymce', CONVERTKIT_PLUGIN_URL . 'resources/backend/js/tinymce.js', array( 'jquery' ), CONVERTKIT_PLUGIN_VERSION, true ); | |
| 146 | - wp_enqueue_script( 'convertkit-admin-modal', CONVERTKIT_PLUGIN_URL . 'resources/backend/js/modal.js', array( 'jquery' ), CONVERTKIT_PLUGIN_VERSION, true ); | |
| 147 | + wp_enqueue_script( 'convertkit-admin-tabs', CONVERTKIT_PLUGIN_URL . 'resources/backend/js/tabs.js', array( 'jquery' ), CONVERTKIT_PLUGIN_VERSION, true ); | |
| 148 | + wp_enqueue_script( 'convertkit-admin-tinymce', CONVERTKIT_PLUGIN_URL . 'resources/backend/js/tinymce.js', array(), CONVERTKIT_PLUGIN_VERSION, true ); | |
| 149 | + wp_enqueue_script( 'convertkit-admin-modal', CONVERTKIT_PLUGIN_URL . 'resources/backend/js/modal.js', array(), CONVERTKIT_PLUGIN_VERSION, true ); | |
| 147 | 150 | wp_enqueue_style( 'convertkit-admin-tinymce', CONVERTKIT_PLUGIN_URL . 'resources/backend/css/tinymce.css', array(), CONVERTKIT_PLUGIN_VERSION ); |
| 148 | 151 | |
| 149 | 152 | // Register JS variable convertkit_admin_tinymce.nonce for AJAX calls. |
| 150 | 153 | wp_localize_script( |
| @@ -204,10 +207,20 @@ | ||
| 204 | 207 | |
| 205 | 208 | ?> |
| 206 | 209 | <script type="text/template" id="tmpl-convertkit-quicktags-modal"> |
| 207 | 210 | <div id="convertkit-quicktags-modal"> |
| 208 | - <div class="media-frame-title"><h1>Title</h1></div> | |
| 209 | - <div class="media-frame-content">Content</div> | |
| 211 | + <div class="media-frame-title"><h1></h1></div> | |
| 212 | + <div class="media-frame-content"></div> | |
| 213 | + <div class="media-frame-toolbar"> | |
| 214 | + <div class="media-toolbar"> | |
| 215 | + <div class="media-toolbar-secondary"> | |
| 216 | + <button type="button" class="button button-large cancel"><?php esc_html_e( 'Cancel', 'convertkit' ); ?></button> | |
| 217 | + </div> | |
| 218 | + <div class="media-toolbar-primary"> | |
| 219 | + <button type="button" class="button button-primary button-large"><?php esc_html_e( 'Insert', 'convertkit' ); ?></button> | |
| 220 | + </div> | |
| 221 | + </div> | |
| 222 | + </div> | |
| 210 | 223 | </div> |
| 211 | 224 | </script> |
| 212 | 225 | <?php |
| 213 | 226 | |