Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions gravity-forms/gw-rich-text-html-fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
*
* @todo
* 1. Add merge tag selector.
* 2. Allow switching to text mode: window.switchEditors.go( 'rich_field_content', mode )
* 3. Add support for inserting images.
* 2. Add support for inserting images.
*/

add_action( 'admin_init', function() {
Expand Down Expand Up @@ -68,8 +67,16 @@
} );
} );
jQuery( document).on( 'tinymce-editor-setup', function ( event, editor ) {
if ( editor.id === 'field_rich_content' ) {
var editorId = 'field_rich_content';
if ( editor.id === editorId ) {
editor.settings.toolbar1 = 'bold,italic,underline,bullist,numlist,alignleft,aligncenter,alignright,link';

// Switch to visual/text mode.
jQuery(`#wp-${editorId}-wrap .switch-tmce, #wp-${editorId}-wrap .switch-html`).on('click', function() {
var mode = jQuery(this).hasClass('switch-tmce') ? 'tmce' : 'html';

window.switchEditors.go(editorId, mode);
});
}
} );
</script>
Expand Down
Loading