Skip to content

Commit

Permalink
Rich Text: Remove overridden underline format
Browse files Browse the repository at this point in the history
  • Loading branch information
ntsekouras committed Sep 10, 2024
1 parent 8c2159a commit 8259c1b
Showing 1 changed file with 2 additions and 35 deletions.
37 changes: 2 additions & 35 deletions apps/wpcom-block-editor/src/default/features/rich-text.js
Original file line number Diff line number Diff line change
@@ -1,43 +1,10 @@
/* global wpcomGutenberg */
import { RichTextToolbarButton } from '@wordpress/block-editor';
import { compose, ifCondition } from '@wordpress/compose';
import { withSelect, withDispatch, select, subscribe } from '@wordpress/data';
import { toggleFormat, registerFormatType, unregisterFormatType } from '@wordpress/rich-text';
import { withSelect, withDispatch } from '@wordpress/data';
import { registerFormatType } from '@wordpress/rich-text';
import { get } from 'lodash';

const unsubscribe = subscribe( () => {
const underlineFormat = select( 'core/rich-text' ).getFormatType( 'core/underline' );
if ( ! underlineFormat ) {
return;
}
unsubscribe();
const settings = unregisterFormatType( 'core/underline' );
registerFormatType( 'wpcom/underline', {
...settings,
name: 'wpcom/underline',
edit( { isActive, value, onChange } ) {
const onToggle = () =>
onChange(
toggleFormat( value, {
type: 'wpcom/underline',
attributes: {
style: 'text-decoration: underline;',
},
} )
);

return (
<RichTextToolbarButton
icon="editor-underline"
title={ settings.title }
onClick={ onToggle }
isActive={ isActive }
/>
);
},
} );
} );

const RichTextJustifyButton = ( { blockId, isBlockJustified, updateBlockAttributes } ) => {
const onToggle = () =>
updateBlockAttributes( blockId, { align: isBlockJustified ? null : 'justify' } );
Expand Down

0 comments on commit 8259c1b

Please sign in to comment.