| 1 |
/** |
| 2 |
* JavaScript code for the "Table" button in the TinyMCE editor toolbar. |
| 3 |
* |
| 4 |
* @package TablePress |
| 5 |
* @subpackage Views JavaScript |
| 6 |
* @author Tobias Bäthge |
| 7 |
* @since 1.0.0 |
| 8 |
*/ |
| 9 |
|
| 10 |
/* globals tinymce, tablepress_editor_button */ |
| 11 |
|
| 12 |
/* jshint strict: global */ |
| 13 |
'use strict'; // Necessary as this file does not use "import". |
| 14 |
|
| 15 |
/** |
| 16 |
* Register a button for the TinyMCE (aka Visual Editor) toolbar |
| 17 |
* |
| 18 |
* @since 1.0.0 |
| 19 |
*/ |
| 20 |
if ( 'undefined' !== typeof tinymce ) { |
| 21 |
tinymce.create( 'tinymce.plugins.TablePressPlugin', { |
| 22 |
init( ed, url ) { |
| 23 |
ed.addCommand( 'TablePress_insert_table', window.tablepress_open_shortcode_thickbox ); |
| 24 |
|
| 25 |
ed.addButton( 'tablepress_insert_table', { |
| 26 |
title: tablepress_editor_button.title, |
| 27 |
cmd: 'TablePress_insert_table', |
| 28 |
image: url.slice( 0, url.length - 8 ) + 'img/tablepress-editor-button.svg', |
| 29 |
} ); |
| 30 |
}, |
| 31 |
} ); |
| 32 |
tinymce.PluginManager.add( 'tablepress_tinymce', tinymce.plugins.TablePressPlugin ); |
| 33 |
} |
| 34 |
|