├── complex-popup-button.js ├── custom-icon-button.js ├── custom-icon.png ├── dashicons-button.js ├── examples ├── btn1.jpeg ├── btn2.jpeg ├── btn3.jpeg ├── btn4.jpeg ├── btn5.jpeg ├── btn6.jpeg ├── btn7.jpeg ├── btn8.jpeg └── btn9.jpeg ├── gavickpro-tc.php ├── icon-button.js ├── popup-button.js ├── style.css ├── sub-submenu-button.js ├── submenu-button.js └── text-button.js /complex-popup-button.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | tinymce.PluginManager.add('gavickpro_tc_button', function( editor, url ) { 3 | editor.addButton( 'gavickpro_tc_button', { 4 | title: 'My test button', 5 | type: 'menubutton', 6 | icon: 'icon gavickpro-own-icon', 7 | menu: [ 8 | { 9 | text: 'Custom h3 tag', 10 | onclick: function() { 11 | editor.windowManager.open( { 12 | title: 'Insert h3 tag', 13 | body: [{ 14 | type: 'textbox', 15 | name: 'title', 16 | label: 'Your title' 17 | }], 18 | onsubmit: function( e ) { 19 | editor.insertContent( '

' + e.data.title + '

'); 20 | } 21 | }); 22 | } 23 | }, 24 | { 25 | text: 'Custom header tag', 26 | onclick: function() { 27 | editor.windowManager.open( { 28 | title: 'Insert header tag', 29 | body: [{ 30 | type: 'textbox', 31 | name: 'title', 32 | label: 'Your title' 33 | }, 34 | { 35 | type: 'textbox', 36 | name: 'id', 37 | label: 'Header anchor' 38 | }, 39 | { 40 | type: 'listbox', 41 | name: 'level', 42 | label: 'Header level', 43 | 'values': [ 44 | {text: '

', value: '3'}, 45 | {text: '

', value: '4'}, 46 | {text: '

', value: '5'}, 47 | {text: '
', value: '6'} 48 | ] 49 | }], 50 | onsubmit: function( e ) { 51 | editor.insertContent( '' + e.data.title + ''); 52 | } 53 | }); 54 | } 55 | } 56 | ] 57 | }); 58 | }); 59 | })(); -------------------------------------------------------------------------------- /custom-icon-button.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | tinymce.PluginManager.add('gavickpro_tc_button', function( editor, url ) { 3 | editor.addButton( 'gavickpro_tc_button', { 4 | title: 'My test button', 5 | icon: 'icon gavickpro-own-icon', 6 | onclick: function() { 7 | editor.insertContent('Hello World!'); 8 | } 9 | }); 10 | }); 11 | })(); -------------------------------------------------------------------------------- /custom-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GavickPro/TinyMCE-4-own-buttons/464e37eb91235a1593936c943cc093526b089467/custom-icon.png -------------------------------------------------------------------------------- /dashicons-button.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | tinymce.PluginManager.add('gavickpro_tc_button', function( editor, url ) { 3 | editor.addButton( 'gavickpro_tc_button', { 4 | title: 'My test button', 5 | icon: 'icon dashicons-wordpress-alt', 6 | onclick: function() { 7 | editor.insertContent('Hello World!'); 8 | } 9 | }); 10 | }); 11 | })(); -------------------------------------------------------------------------------- /examples/btn1.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GavickPro/TinyMCE-4-own-buttons/464e37eb91235a1593936c943cc093526b089467/examples/btn1.jpeg -------------------------------------------------------------------------------- /examples/btn2.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GavickPro/TinyMCE-4-own-buttons/464e37eb91235a1593936c943cc093526b089467/examples/btn2.jpeg -------------------------------------------------------------------------------- /examples/btn3.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GavickPro/TinyMCE-4-own-buttons/464e37eb91235a1593936c943cc093526b089467/examples/btn3.jpeg -------------------------------------------------------------------------------- /examples/btn4.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GavickPro/TinyMCE-4-own-buttons/464e37eb91235a1593936c943cc093526b089467/examples/btn4.jpeg -------------------------------------------------------------------------------- /examples/btn5.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GavickPro/TinyMCE-4-own-buttons/464e37eb91235a1593936c943cc093526b089467/examples/btn5.jpeg -------------------------------------------------------------------------------- /examples/btn6.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GavickPro/TinyMCE-4-own-buttons/464e37eb91235a1593936c943cc093526b089467/examples/btn6.jpeg -------------------------------------------------------------------------------- /examples/btn7.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GavickPro/TinyMCE-4-own-buttons/464e37eb91235a1593936c943cc093526b089467/examples/btn7.jpeg -------------------------------------------------------------------------------- /examples/btn8.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GavickPro/TinyMCE-4-own-buttons/464e37eb91235a1593936c943cc093526b089467/examples/btn8.jpeg -------------------------------------------------------------------------------- /examples/btn9.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GavickPro/TinyMCE-4-own-buttons/464e37eb91235a1593936c943cc093526b089467/examples/btn9.jpeg -------------------------------------------------------------------------------- /gavickpro-tc.php: -------------------------------------------------------------------------------- 1 | ' + e.data.title + '
'); 20 | } 21 | }); 22 | } 23 | }, 24 | { 25 | text: 'Custom h4 tag', 26 | onclick: function() { 27 | editor.windowManager.open( { 28 | title: 'Insert h4 tag', 29 | body: [{ 30 | type: 'textbox', 31 | name: 'title', 32 | label: 'Your title' 33 | }], 34 | onsubmit: function( e ) { 35 | editor.insertContent( '

' + e.data.title + '

'); 36 | } 37 | }); 38 | } 39 | } 40 | ] 41 | }); 42 | }); 43 | })(); -------------------------------------------------------------------------------- /style.css: -------------------------------------------------------------------------------- 1 | i.mce-i-icon { 2 | font: 400 20px/1 dashicons; 3 | padding: 0; 4 | vertical-align: top; 5 | speak: none; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | margin-left: -2px; 9 | padding-right: 2px 10 | } 11 | 12 | i.gavickpro-own-icon { 13 | background-image: url('custom-icon.png'); 14 | } -------------------------------------------------------------------------------- /sub-submenu-button.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | tinymce.PluginManager.add('gavickpro_tc_button', function( editor, url ) { 3 | editor.addButton( 'gavickpro_tc_button', { 4 | title: 'My test button', 5 | type: 'menubutton', 6 | icon: 'icon gavickpro-own-icon', 7 | menu: [ 8 | { 9 | text: 'Menu item I', 10 | value: 'Text from menu item I', 11 | onclick: function() { 12 | editor.insertContent(this.value()); 13 | } 14 | }, 15 | { 16 | text: 'Menu item II', 17 | value: 'Text from menu item II', 18 | onclick: function() { 19 | editor.insertContent(this.value()); 20 | }, 21 | menu: [ 22 | { 23 | text: 'First submenu item', 24 | value: 'Text from sub sub menu', 25 | onclick: function(e) { 26 | e.stopPropagation(); 27 | editor.insertContent(this.value()); 28 | } 29 | }, 30 | { 31 | text: 'Second submenu item', 32 | value: 'Text from sub sub menu', 33 | onclick: function(e) { 34 | e.stopPropagation(); 35 | editor.insertContent(this.value()); 36 | } 37 | } 38 | ] 39 | }, 40 | { 41 | text: 'Menu item III', 42 | value: 'Text from menu item III', 43 | onclick: function() { 44 | editor.insertContent(this.value()); 45 | } 46 | } 47 | ] 48 | }); 49 | }); 50 | })(); -------------------------------------------------------------------------------- /submenu-button.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | tinymce.PluginManager.add('gavickpro_tc_button', function( editor, url ) { 3 | editor.addButton( 'gavickpro_tc_button', { 4 | title: 'My test button', 5 | type: 'menubutton', 6 | icon: 'icon gavickpro-own-icon', 7 | menu: [ 8 | { 9 | text: 'Menu item I', 10 | value: 'Text from menu item I', 11 | onclick: function() { 12 | editor.insertContent(this.value()); 13 | } 14 | } 15 | ] 16 | }); 17 | }); 18 | })(); -------------------------------------------------------------------------------- /text-button.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | tinymce.PluginManager.add('gavickpro_tc_button', function( editor, url ) { 3 | editor.addButton( 'gavickpro_tc_button', { 4 | text: 'My test button', 5 | icon: false, 6 | onclick: function() { 7 | editor.insertContent('Hello World!'); 8 | } 9 | }); 10 | }); 11 | })(); --------------------------------------------------------------------------------