Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion packages/format-library/src/underline/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import { __ } from '@wordpress/i18n';
import { toggleFormat } from '@wordpress/rich-text';
import {
RichTextShortcut,
RichTextToolbarButton,
__unstableRichTextInputEvent,
} from '@wordpress/block-editor';
import { formatUnderline } from '@wordpress/icons';

const name = 'core/underline';
const title = __( 'Underline' );
Expand All @@ -19,7 +21,7 @@ export const underline = {
attributes: {
style: 'style',
},
edit( { value, onChange } ) {
edit( { isActive, value, onChange, onFocus } ) {
const onToggle = () => {
onChange(
toggleFormat( value, {
Expand All @@ -30,6 +32,7 @@ export const underline = {
title,
} )
);
onFocus();
};

return (
Expand All @@ -43,6 +46,13 @@ export const underline = {
inputType="formatUnderline"
onInput={ onToggle }
/>
<RichTextToolbarButton
icon={ formatUnderline }
title={ title }
onClick={ onToggle }
isActive={ isActive }
role="menuitemcheckbox"
/>
</>
);
},
Expand Down
Loading