How to use the @wordpress/editor.RichText.isEmpty function in @wordpress/editor

To help you get started, we’ve selected a few @wordpress/editor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Automattic / wp-calypso / packages / jetpack-blocks / src / blocks / videopress / save.js View on Github external
*
		 * @see https://github.com/WordPress/gutenberg/blob/3f1324b53cc8bb45d08d12d5321d6f88510bed09/packages/blocks/src/api/serializer.js#L78-L96
		 * @see https://github.com/WordPress/gutenberg/blob/c5f9bd88125282a0c35f887cc8d835f065893112/packages/editor/src/hooks/generated-class-name.js#L42
		 * @see https://github.com/Automattic/wp-calypso/pull/30546#issuecomment-463637946
		 */
		return CoreVideoSave( props );
	}

	const url = `https://videopress.com/v/${ guid }`;

	return (
		<figure>
			<div>
				{ `\n${ url }\n` /* URL needs to be on its own line. */ }
			</div>
			{ ! RichText.isEmpty( caption ) &amp;&amp; (
				
			) }
		</figure>
	);
};
github front / gutenberg-js / src / js / gutenberg-overrides / packages / block-library / build-module / cover-image / index.js View on Github external
const { url, title, hasParallax, dimRatio, align, contentAlign, data } = attributes;
  const style = backgroundImageStyles(url);
  const classes = classnames(
    className,
    dimRatioToClass(dimRatio),
    {
      'has-background-dim': dimRatio !== 0,
      'has-parallax': hasParallax,
      [ `has-${contentAlign}-content` ]: contentAlign !== 'center',
    },
    align ? `align${align}` : null,
  );

  return (
    <div style="{">
      { ! RichText.isEmpty(title) &amp;&amp; (
        
      ) }
    </div>
  );
};
github front / gutenberg-js / src / js / gutenberg-overrides / @wordpress / block-library / build-module / cover / index.js View on Github external
const classes = classnames(
        'wp-block-cover-image',
        dimRatioToClass(dimRatio),
        overlayColorClass,
        {
          'has-background-dim': dimRatio !== 0,
          'has-parallax': hasParallax,
          [ `has-${contentAlign}-content` ]: contentAlign !== 'center',
        },
        align ? `align${align}` : null,
      );

      return (
        <div style="{">
          { ! RichText.isEmpty(title) &amp;&amp; (
            
          ) }
        </div>
      );
    },
  }, {
github Yoast / wordpress-seo / js / src / structured-data-blocks / valueBlocks / Duration.js View on Github external
static Content( { attributes } ) {
		const { days, hours, minutes } = attributes;

		const timeString = buildDurationString( { days, hours, minutes } );

		return 
			<p>
				<span>
					{  }
					{ RichText.isEmpty( attributes.legend ) &amp;&amp; Duration.getDefaultDurationLegend() }
					&nbsp;
				</span>
				{ timeString + ". " }
			</p>
		;
	}
}
github Automattic / wp-calypso / packages / jetpack-blocks / src / blocks / videopress / edit.js View on Github external
onClick={ this.switchToEditing }
								icon="edit"
							/&gt;
						
					
					<figure>
						{ /*
							Disable the video player so the user clicking on it won't play the
							video when the controls are enabled.
						*/ }
						
							<div>
								
							</div>
						
						{ ( ! RichText.isEmpty( caption ) || isSelected ) &amp;&amp; (
							 setAttributes( { caption: value } ) }
								inlineToolbar
							/&gt;
						) }
					</figure>
				
			);
		}
	};
github Automattic / jetpack / extensions / blocks / gif / edit.js View on Github external
/&gt;
									);
								} ) }
							
						) }
						<div style="{">
							<div tabindex="0" role="button">
							</div></div>
github front / gutenberg-js / src / js / gutenberg-overrides / @wordpress / block-library / build-module / cover / index.js View on Github external
<div style="{" data-url="{">
            { VIDEO_BACKGROUND_TYPE === backgroundType &amp;&amp; (
              <video src="{" loop="" muted="" autoplay="">
            ) }
            { (! RichText.isEmpty(title) || isSelected) &amp;&amp; (
              
            ) }
          </video></div>
        
      );
    }
  ),
github front / gutenberg-js / src / js / gutenberg-overrides / @wordpress / block-library / build-module / image / index.js View on Github external
});

        const image = (
          <img height="{" width="{" id="" alt="{" src="{">
        );

        return (
          <figure>
            { href ? <a href="{">{ image }</a> : image }
            { ! RichText.isEmpty(caption) &amp;&amp;  }
          </figure>
        );
      },
    },
github WordPress / gutenberg / packages / block-library / src / image / index.js View on Github external
const { url, alt, caption, align, href, width, height, id } = attributes;

				const image = (
					<img height="{" width="{" id="" alt="{" src="{">
				);

				return (
					<figure align="">
						{ href ? <a href="{">{ image }</a> : image }
						{ ! RichText.isEmpty( caption ) &amp;&amp;  }
					</figure>
				);
			},
		},