I have found a great tutorial about making a custom button to the tinymce.
http://qnimate.com/adding-buttons-to-wordpress-visual-editor/
You can just follow this guide and copy all of it. Don’t forget to activate your new plugin in the plugin menu (in admin panel).
Then you can just change the code inside index.js and especially in the
ed.addCommand("green_command", function() {
For making the background of the selected cell toggle (on/off) you just change the code like this:
//button functionality.
ed.addCommand("green_command", function() {
ed.formatter.register('termin_format', {
selector: 'td',
styles: { backgroundColor: '#adf2a7'},
});
ed.formatter.toggle('termin_format');
});
Related Posts:
- How to add “Insert/Edit link” button in custom popup tinymce window?
- Add popup window to TinyMCE buttons
- How i can i add a split button or list box to the WordPress TinyMCE instance
- TinyMCE Anchor Button not showing
- Adding TinyMCE custom buttons when using teeny_mce_before_init
- Visual Editor freezing on text highlight since 4.3
- Add table controls with wp_editor minimal editor configuration (‘teeny’)
- Add buttons to the new TinyMCE WP Editor. Javascript API
- Can i set css class for table via TinyMCE [closed]
- TinyMCE: Move buttons from 2nd row to top row
- Adding a Media Button to the WordPress Content Editor
- Wordpres Tinymce custom button (Gavick guide)
- How to insert image from link in TinyMCE
- add button to tinymce
- How do I include a TinyMCE editor in the frontend?
- Remove HTML editor and visual/HTML tabs from TinyMCE
- Stop editor from removing tags and replacing them with nbsp
- Possible to stop WordPress from adding p1, p2… classes to p tags in TinyMCE?
- Custom Tiny MCE button to bring up a custom php popup
- Add unique class or ID information to tinyMCE
- How can I stop TinyMCE from converting my HTML entities to characters?
- How to keep non-breaking spaces in the visual editor?
- Is there a way to prevent the Editor from modifying my HTML
- Remove “Are You Sure” dialogue when leaving editor
- Creating a custom MCE view for your shortcodes [closed]
- Apply custom style to single word in WordPress
- How to customize the symbols that appear in the Visual Editor insert custom character
- How to keep a textarea and stop tinymce?
- TinyMCE Editor Set Default Tab
- TinyMCE – Show Advanced Options (2nd Row) By Default
- Disable TinyMCE autoformatting
- Count Words using tinymce in the front-end
- TinyMCE – Add class to OL – selector doesn’t seem to get parent OL,UL, just LI’s (4.6.3)
- tinyMCE.activeEditor = null WP editor loaded in ‘Text’ mode?
- Keep pasted pre formatted code as it is -with tabs- in visual editor
- TinyMCE Keyup Function
- Using main style.css with add_editor_style
- Hide TinyMCE controls in TinyMCE 4 (WordPress 3.9)
- Access tinymce from thickbox
- How can I troubleshoot why TinyMCE won’t load custom plugins in the visual editor?
- TinyMCE Editor as component in Gutenberg Block
- TinyMce in WordPress – Getting the “fullscreen” button to stay on the right when customising button layout
- WordPress editor strips out anchor tags when they appear on their own line
- wp_editor on input changes content
- Sortable WYSIWYG editor
- How do I add a TinyMCE row that all users can see, instead of just admins?
- How to disable formatting
- Add table button in editor without Plugin
- How to get line breaks to translate to paragraphs?
- Localize variables with TinyMCE script
- Prevent the Editor From Moving My
- Shift-Enter in tinyMCE (wp 3.3.1) not working
- TInyMCE object Tag stripped
- Adding custom styles to elements, without creating new elements
- allowing all HTML tags in tinymce editor
- Keyup events in tinymce editor not working
- Tiny MCE doesn’t look anything like my blog
- Save WYSIWYG editor plugin settings, only works after second save
- Front-end image upload from TinyME [closed]
- TinyMCE – no auto formatting using the_editor()?
- How to force insertion in editor
- Embed iFrame in WordPress 3.0.1
- Sanitizing textarea for wp_insert_post with TinyMCE enabled or disabled
- Visual Editor is blank – 404 for plugin js
- Getting shortcode attribute values and shortcode content with JavaScript regex
- Allowing style tag in TinyMCE editor
- Insert media button will always add into the same tinyMCE editor
- Change the background of the TinyMCE editor with available WP arguments
- remove WYSIWYG editor but keep media button
- TinyMCE doesn’t work correctly in the Media Modal Window
- WordPress Tiny MCE won’t accept line breaks
- wp_tiny_mce function not found
- TinyMCE strips off the href tag inside span, if i change from text to visual
- Loading a self-hosted custom @font-face into TinyMCE dropdowns (Classic Editor) via ‘tiny_mce_before_init’ filter
- tinymce and responsive line-breaks (short words after a period)
- Client on iPad accidentally adding tag to posts while writing
- TinyMCE function causes issue in AVADA theme
- WordPress Editor without buttons
- Adding microdata using Structured Data Markup Helper HTML
- wp_editor customization
- `tinyMCE is not defined` after migrating site to server
- WordPress adding extra html coding to my data on saving
- wp_editor Too Tall when Content is Loaded
- mce_external_languages: how does it really work?
- TinyMCE HTML Encode Backslash
- Revealing ‘code’ hidden button in TinyMCE4 and WordPress 3.9.x
- Edit body image after insertion in 3.9.1
- Customize TinyMCE Buttons
- regEx wp core file
- Adding New Row of Custom TinyMCE
- Using TinyMCE fiddle for node filter to add id attribute to anchors
- WYSIWYG with HTML source?
- Multiple TinyMCEs breaking Distraction Free Writing
- prevent caching during tinymce custom button development
- How do I separate my theme’s styles from editor styles?
- WordPress removes paragraphs. How to disable this behavior?
- WordPress and TinyMCE Advanced: Failed to load javascript
- WPAlchemy – Multiple TinyMCE editor blank (can’t add text)
- Add custom classes to TinyMCE generated markup
- install tinymce plugin [closed]