Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RNMobile] Add content alignment options to paragraph block (updating release branch) #18433

Merged
merged 3 commits into from
Nov 14, 2019
Merged
Show file tree
Hide file tree
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

This file was deleted.

15 changes: 13 additions & 2 deletions packages/block-library/src/paragraph/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { View } from 'react-native';
import { __ } from '@wordpress/i18n';
import { Component } from '@wordpress/element';
import { createBlock } from '@wordpress/blocks';
import { RichText } from '@wordpress/block-editor';
import { AlignmentToolbar, BlockControls, RichText } from '@wordpress/block-editor';

/**
* Internal dependencies
Expand Down Expand Up @@ -47,12 +47,22 @@ class ParagraphEdit extends Component {
} = this.props;

const {
placeholder,
align,
content,
placeholder,
} = attributes;

return (
<View>
<BlockControls>
<AlignmentToolbar
isCollapsed={ false }
value={ align }
onChange={ ( nextAlign ) => {
setAttributes( { align: nextAlign } );
} }
/>
</BlockControls>
<RichText
identifier="content"
tagName="p"
Expand All @@ -78,6 +88,7 @@ class ParagraphEdit extends Component {
onReplace={ onReplace }
onRemove={ onReplace ? () => onReplace( [] ) : undefined }
placeholder={ placeholder || __( 'Start writing…' ) }
textAlign={ align }
/>
</View>
);
Expand Down