| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | /** |
| 2 | - * JavaScript code for the "Table" button in the TinyMCE editor toolbar | |
| 2 | + * JavaScript code for the "Table" button in the TinyMCE editor toolbar. | |
| 3 | 3 | * |
| 4 | 4 | * @package TablePress |
| 5 | 5 | * @subpackage Views JavaScript |
| 6 | 6 | * @author Tobias Bäthge |
| @@ -6,46 +6,28 @@ | ||
| 6 | 6 | * @author Tobias Bäthge |
| 7 | 7 | * @since 1.0.0 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -/* global tinymce , tablepress_editor_button*/ | |
| 10 | +/* globals tinymce, tablepress_editor_button */ | |
| 11 | 11 | |
| 12 | -( function() { | |
| 12 | +/* jshint strict: global */ | |
| 13 | +'use strict'; // Necessary as this file does not use "import". | |
| 13 | 14 | |
| 14 | - 'use strict'; | |
| 15 | - | |
| 16 | - // only do this if TinyMCE is available | |
| 17 | - if ( 'undefined' === typeof( tinymce ) ) { | |
| 18 | - return; | |
| 19 | - } | |
| 20 | - | |
| 21 | - /** | |
| 22 | - * Register a button for the TinyMCE (aka Visual Editor) toolbar | |
| 23 | - * | |
| 24 | - * @since 1.0.0 | |
| 25 | - */ | |
| 15 | +/** | |
| 16 | + * Register a button for the TinyMCE (aka Visual Editor) toolbar | |
| 17 | + * | |
| 18 | + * @since 1.0.0 | |
| 19 | + */ | |
| 20 | +if ( 'undefined' !== typeof tinymce ) { | |
| 26 | 21 | tinymce.create( 'tinymce.plugins.TablePressPlugin', { |
| 27 | - init: function( ed, url ) { | |
| 22 | + init( ed, url ) { | |
| 28 | 23 | ed.addCommand( 'TablePress_insert_table', window.tablepress_open_shortcode_thickbox ); |
| 29 | 24 | |
| 30 | 25 | ed.addButton( 'tablepress_insert_table', { |
| 31 | 26 | title: tablepress_editor_button.title, |
| 32 | 27 | cmd: 'TablePress_insert_table', |
| 33 | - image: url.slice( 0, url.length - 2 ) + 'img/tablepress-editor-button.png' | |
| 28 | + image: url.slice( 0, url.length - 8 ) + 'img/tablepress-editor-button.svg', | |
| 34 | 29 | } ); |
| 35 | - } | |
| 36 | -/* // no real need for getInfo(), as it is not displayed/used anywhere | |
| 37 | - , | |
| 38 | - getInfo: function() { | |
| 39 | - return { | |
| 40 | - longname: 'TablePress', | |
| 41 | - author: 'Tobias Bäthge', | |
| 42 | - authorurl: 'https://tobias.baethge.com/', | |
| 43 | - infourl: 'https://tablepress.org/', | |
| 44 | - version: '1.0.0' | |
| 45 | - }; | |
| 46 | - } | |
| 47 | -*/ | |
| 30 | + }, | |
| 48 | 31 | } ); |
| 49 | 32 | tinymce.PluginManager.add( 'tablepress_tinymce', tinymce.plugins.TablePressPlugin ); |
| 50 | - | |
| 51 | -} )(); | |
| 33 | +} | |