Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
edit(props) {
return <span data-is-active="{props.isActive}">{props.value}</span>;
},
});
//
// remove
//
RT.remove(VALUE);
RT.remove(VALUE, 10);
RT.remove(VALUE, 10, 20);
//
// removeFormat
//
RT.removeFormat(VALUE, 'foo');
RT.removeFormat(VALUE, 'foo', 10);
//
// replace
//
RT.replace(VALUE, 'foo', 'bar');
RT.replace(VALUE, /foo/, 'bar');
RT.replace(VALUE, 'foo', match => `${match}bar`);
RT.replace(VALUE, /foo/, match => `${match}bar`);
RT.replace(VALUE, 'foo', (match, a, b) => `${match} ${a} ${b}`);
//
// slice
//
RT.slice(VALUE);
RT.slice(VALUE, 10);
return <span data-is-active="{props.isActive}">{props.value}</span>;
},
});
//
// remove
//
RT.remove(VALUE);
RT.remove(VALUE, 10);
RT.remove(VALUE, 10, 20);
//
// removeFormat
//
RT.removeFormat(VALUE, 'foo');
RT.removeFormat(VALUE, 'foo', 10);
//
// replace
//
RT.replace(VALUE, 'foo', 'bar');
RT.replace(VALUE, /foo/, 'bar');
RT.replace(VALUE, 'foo', match => `${match}bar`);
RT.replace(VALUE, /foo/, match => `${match}bar`);
RT.replace(VALUE, 'foo', (match, a, b) => `${match} ${a} ${b}`);
//
// slice
//
RT.slice(VALUE);
RT.slice(VALUE, 10);
RT.slice(VALUE, 10, 20);
const createApplyFormat = ( textValue, colorType, textColor, highlightColor ) => {
// Normal text color
if ( colorType === '' ) {
if ( ! textColor ) {
return removeFormat(
textValue,
'ugb/highlight',
)
}
return applyFormat(
textValue,
{
type: 'ugb/highlight',
attributes: {
style: `color: ${ textColor };`,
},
}
)
}
const removeFootnote = ( value ) => {
const activeObject = getActiveObject( value );
if ( activeObject && activeObject.type === name ) {
return remove( value );
}
return removeFormat( value, name );
};
export function removeAnnotations( record ) {
return removeFormat( record, 'core/annotation', 0, record.text.length );
}
onChange={ ( color ) => {
if ( color ) {
onChange( applyFormat( value, {
type: name,
attributes: {
style: `color:${ color }`,
},
} ) );
return;
}
onChange( removeFormat( value, name ) );
} }
/>
onChange={ ( color ) => {
if ( color ) {
onChange( applyFormat( value, {
type: name,
attributes: {
style: `background-color:${ color }`,
},
} ) );
return;
}
onChange( removeFormat( value, name ) );
} }
/>
onRemoveFormat() {
const { onChange, speak } = this.props;
const linkSelection = this.getLinkSelection();
onChange( removeFormat( linkSelection, name ) );
speak( __( 'Link removed.' ), 'assertive' );
}
onChange={ ( color ) => {
if ( color ) {
const colorObject = getColorObjectByColorValue( colors, color );
onChange(
applyFormat( value, {
type: name,
attributes: colorObject ? {
class: getColorClassName( 'color', colorObject.slug ),
} : {
style: `color:${ color }`,
},
} )
);
} else {
onChange( removeFormat( value, name ) );
}
} }
>