| 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 |
/* global tinymce , tablepress_editor_button*/ |
| 11 |
|
| 12 |
( function() { |
| 13 |
|
| 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 |
*/ |
| 26 |
tinymce.create( 'tinymce.plugins.TablePressPlugin', { |
| 27 |
init: function( ed, url ) { |
| 28 |
ed.addCommand( 'TablePress_insert_table', window.tablepress_open_shortcode_thickbox ); |
| 29 |
|
| 30 |
ed.addButton( 'tablepress_insert_table', { |
| 31 |
title: tablepress_editor_button.title, |
| 32 |
cmd: 'TablePress_insert_table', |
| 33 |
image: url.slice( 0, url.length - 2 ) + 'img/tablepress-editor-button.png' |
| 34 |
} ); |
| 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 |
*/ |
| 48 |
} ); |
| 49 |
tinymce.PluginManager.add( 'tablepress_tinymce', tinymce.plugins.TablePressPlugin ); |
| 50 |
|
| 51 |
} )(); |
| 52 |
|