How to use the @wordpress/rich-text.toggleFormat function in @wordpress/rich-text

To help you get started, we’ve selected a few @wordpress/rich-text 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 DefinitelyTyped / DefinitelyTyped / types / wordpress__rich-text / wordpress__rich-text-tests.tsx View on Github external
RT.split(VALUE, 'foo');
RT.split(VALUE, 5);
RT.split(VALUE, 'foo', 10);
RT.split(VALUE, 5, 10);
RT.split(VALUE, undefined, 5);

//
// toHTMLString
//
RT.toHTMLString({ value: VALUE });
RT.toHTMLString({ value: VALUE, multilineTag: 'p' });

//
// toggleFormat
//
RT.toggleFormat(VALUE, FORMAT);

//
// unregisterFormatType
//
RT.unregisterFormatType('foo');

//
// store
//
dispatch('core/rich-text').addFormatTypes({
    className: null,
    edit: () => null,
    name: 'my/foo',
    tagName: 'a',
    title: 'foo',
});
github godaddy-wordpress / coblocks / src / formats / uppercase / index.js View on Github external
		const onToggle = () => onChange( toggleFormat( value, { type: name } ) );
github WordPress / gutenberg / packages / format-library / src / underline / index.js View on Github external
const onToggle = () => {
			onChange(
				toggleFormat( value, {
					type: name,
					attributes: {
						style: 'text-decoration: underline;',
					},
				} ) );
		};
github WordPress / gutenberg / packages / format-library / src / bold / index.js View on Github external
		const onToggle = () => onChange( toggleFormat( value, { type: name } ) );
github WordPress / gutenberg / packages / format-library / src / code / index.js View on Github external
		const onToggle = () => onChange( toggleFormat( value, { type: name } ) );
github WordPress / gutenberg / packages / format-library / src / strikethrough / index.js View on Github external
		const onToggle = () => onChange( toggleFormat( value, { type: name } ) );
github Automattic / wp-calypso / apps / wpcom-block-editor / src / default / features / rich-text.js View on Github external
const onToggle = () =>
				onChange(
					toggleFormat( value, {
						type: 'wpcom/underline',
						attributes: {
							style: 'text-decoration: underline;',
						},
					} )
				);
github WordPress / gutenberg / packages / format-library / src / italic / index.js View on Github external
		const onToggle = () => onChange( toggleFormat( value, { type: name } ) );