Commit dc57f57d authored by KR Moorhouse's avatar KR Moorhouse Committed by GitHub

Merge pull request #3374 from wpninjas/issue#3373

Issue#3373
parents 36f3275f 1ed2385e
......@@ -210,7 +210,8 @@ define( [], function() {
getHelpText: function() {
// this.help_text = jQuery( this.help_text ).html();
return ( 'undefined' != typeof this.help_text ) ? this.help_text.replace(/"/g, """) : '';
// return ( 'undefined' != typeof this.help_text ) ? this.help_text.replace(/"/g, """) : '';
return ( 'undefined' != typeof this.help_text ) ? this.help_text : '';
},
maybeRenderHelp: function() {
......@@ -219,10 +220,15 @@ define( [], function() {
// text and not just HTML tags.
var check_text_par = document.createElement( 'p' );
check_text_par.innerHTML = this.help_text;
check_text_par.innerHTML = check_text_par.innerText || check_text_par.textContent;
var shouldRenderHelpText = false;
// Check for text or image tags
if ( 0 != jQuery.trim( jQuery( check_text_par ).text() ).length
|| 0 < jQuery( check_text_par ).find('img').length ) {
shouldRenderHelpText = true;
}
if ( 'undefined' != typeof this.help_text && 0 != jQuery.trim( jQuery( check_text_par ).text() ).length ) {
if ( 'undefined' != typeof this.help_text && shouldRenderHelpText ) {
var icon = document.createElement( 'span' );
icon.classList.add( 'fa', 'fa-info-circle', 'nf-help' );
icon.setAttribute( 'data-text', this.getHelpText() );
......
File mode changed from 100644 to 100755
File mode changed from 100755 to 100644
File mode changed from 100644 to 100755
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
......@@ -322,7 +322,10 @@ final class NF_Display_Render
if( isset( $field[ 'settings' ][ 'textarea_media' ] ) && $field[ 'settings' ][ 'textarea_media' ] ){
array_push( self::$form_uses_textarea_media, $form_id );
}
if( isset( $field[ 'settings' ][ 'help_text' ] ) && strip_tags( $field[ 'settings' ][ 'help_text' ] ) ){
// strip all tags except image tags
if( isset( $field[ 'settings' ][ 'help_text' ] ) &&
strip_tags( $field[ 'settings' ][ 'help_text' ], '<img>'
) ){
array_push( self::$form_uses_helptext, $form_id );
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment