diff --git a/gravity-forms/gw-rich-text-html-fields.php b/gravity-forms/gw-rich-text-html-fields.php
index a5d01f2c8..e743793d4 100644
--- a/gravity-forms/gw-rich-text-html-fields.php
+++ b/gravity-forms/gw-rich-text-html-fields.php
@@ -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() {
@@ -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);
+ });
}
} );