Skip to content

Commit

Permalink
Format Library: Code => Inline Code (#15199)
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix authored May 2, 2019
1 parent b36a56d commit 8f0cb51
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 12 deletions.
5 changes: 3 additions & 2 deletions packages/format-library/src/bold/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import { toggleFormat } from '@wordpress/rich-text';
import { RichTextToolbarButton, RichTextShortcut, __unstableRichTextInputEvent } from '@wordpress/block-editor';

const name = 'core/bold';
const title = __( 'Bold' );

export const bold = {
name,
title: __( 'Bold' ),
title,
tagName: 'strong',
className: null,
edit( { isActive, value, onChange } ) {
Expand All @@ -26,7 +27,7 @@ export const bold = {
<RichTextToolbarButton
name="bold"
icon="editor-bold"
title={ __( 'Bold' ) }
title={ title }
onClick={ onToggle }
isActive={ isActive }
shortcutType="primary"
Expand Down
5 changes: 3 additions & 2 deletions packages/format-library/src/code/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import { toggleFormat } from '@wordpress/rich-text';
import { RichTextShortcut, RichTextToolbarButton } from '@wordpress/block-editor';

const name = 'core/code';
const title = __( 'Inline Code' );

export const code = {
name,
title: __( 'Code' ),
title,
tagName: 'code',
className: null,
edit( { value, onChange, isActive } ) {
Expand All @@ -25,7 +26,7 @@ export const code = {
/>
<RichTextToolbarButton
icon="editor-code"
title={ __( 'Code' ) }
title={ title }
onClick={ onToggle }
isActive={ isActive }
shortcutType="access"
Expand Down
5 changes: 3 additions & 2 deletions packages/format-library/src/image/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { computeCaretRect } from '@wordpress/dom';
const ALLOWED_MEDIA_TYPES = [ 'image' ];

const name = 'core/image';
const title = __( 'Inline Image' );

const stopKeyPropagation = ( event ) => event.stopPropagation();

Expand All @@ -28,7 +29,7 @@ const PopoverAtImage = ( { dependencies, ...props } ) => {

export const image = {
name,
title: __( 'Image' ),
title,
keywords: [ __( 'photo' ), __( 'media' ) ],
object: true,
tagName: 'img',
Expand Down Expand Up @@ -98,7 +99,7 @@ export const image = {
<MediaUploadCheck>
<RichTextToolbarButton
icon={ <SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><Path d="M4 16h10c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v9c0 1.1.9 2 2 2zM4 5h10v9H4V5zm14 9v2h4v-2h-4zM2 20h20v-2H2v2zm6.4-8.8L7 9.4 5 12h8l-2.6-3.4-2 2.6z" /></SVG> }
title={ __( 'Inline Image' ) }
title={ title }
onClick={ this.openModal }
isActive={ isObjectActive }
/>
Expand Down
5 changes: 3 additions & 2 deletions packages/format-library/src/italic/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import { toggleFormat } from '@wordpress/rich-text';
import { RichTextToolbarButton, RichTextShortcut, __unstableRichTextInputEvent } from '@wordpress/block-editor';

const name = 'core/italic';
const title = __( 'Italic' );

export const italic = {
name,
title: __( 'Italic' ),
title,
tagName: 'em',
className: null,
edit( { isActive, value, onChange } ) {
Expand All @@ -26,7 +27,7 @@ export const italic = {
<RichTextToolbarButton
name="italic"
icon="editor-italic"
title={ __( 'Italic' ) }
title={ title }
onClick={ onToggle }
isActive={ isActive }
shortcutType="primary"
Expand Down
5 changes: 3 additions & 2 deletions packages/format-library/src/link/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ import { RichTextToolbarButton, RichTextShortcut } from '@wordpress/block-editor
import InlineLinkUI from './inline';

const name = 'core/link';
const title = __( 'Link' );

export const link = {
name,
title: __( 'Link' ),
title,
tagName: 'a',
className: null,
attributes: {
Expand Down Expand Up @@ -102,7 +103,7 @@ export const link = {
{ ! isActive && <RichTextToolbarButton
name="link"
icon="admin-links"
title={ __( 'Link' ) }
title={ title }
onClick={ this.addLink }
isActive={ isActive }
shortcutType="primary"
Expand Down
5 changes: 3 additions & 2 deletions packages/format-library/src/strikethrough/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import { toggleFormat } from '@wordpress/rich-text';
import { RichTextToolbarButton, RichTextShortcut } from '@wordpress/block-editor';

const name = 'core/strikethrough';
const title = __( 'Strikethrough' );

export const strikethrough = {
name,
title: __( 'Strikethrough' ),
title,
tagName: 's',
className: null,
edit( { isActive, value, onChange } ) {
Expand All @@ -25,7 +26,7 @@ export const strikethrough = {
/>
<RichTextToolbarButton
icon="editor-strikethrough"
title={ __( 'Strikethrough' ) }
title={ title }
onClick={ onToggle }
isActive={ isActive }
shortcutType="access"
Expand Down

0 comments on commit 8f0cb51

Please sign in to comment.