-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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/refactor rich text sizing code #14164
Changes from 4 commits
2991d5a
a53c580
8b705c9
c39453c
c18e528
227b67a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,6 @@ import { RichText } from '@wordpress/editor'; | |
/** | ||
* Internal dependencies | ||
*/ | ||
import styles from './style.scss'; | ||
|
||
const name = 'core/paragraph'; | ||
|
||
|
@@ -23,10 +22,6 @@ class ParagraphEdit extends Component { | |
super( props ); | ||
this.splitBlock = this.splitBlock.bind( this ); | ||
this.onReplace = this.onReplace.bind( this ); | ||
|
||
this.state = { | ||
aztecHeight: 0, | ||
}; | ||
} | ||
|
||
/** | ||
|
@@ -99,8 +94,6 @@ class ParagraphEdit extends Component { | |
content, | ||
} = attributes; | ||
|
||
const minHeight = styles.blockText.minHeight; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not clear to me why There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was testing if we actually needed this, and find out that we don't... we don't need to force a minHeight the component will size itself to whatever text size. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I removed the minHeight from all blocks that were using it. So that way the block code will be less aware of the platform. |
||
|
||
return ( | ||
<View> | ||
<RichText | ||
|
@@ -110,10 +103,7 @@ class ParagraphEdit extends Component { | |
onFocus={ this.props.onFocus } // always assign onFocus as a props | ||
onBlur={ this.props.onBlur } // always assign onBlur as a props | ||
onCaretVerticalPositionChange={ this.props.onCaretVerticalPositionChange } | ||
style={ { | ||
...style, | ||
minHeight: Math.max( minHeight, this.state.aztecHeight ), | ||
} } | ||
style={ style } | ||
onChange={ ( nextContent ) => { | ||
setAttributes( { | ||
content: nextContent, | ||
|
@@ -122,9 +112,6 @@ class ParagraphEdit extends Component { | |
onSplit={ this.splitBlock } | ||
onMerge={ mergeBlocks } | ||
onReplace={ this.onReplace } | ||
onContentSizeChange={ ( event ) => { | ||
this.setState( { aztecHeight: event.aztecHeight } ); | ||
} } | ||
placeholder={ placeholder || __( 'Start writing…' ) } | ||
/> | ||
</View> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should not it be declared the other way round?
style={ { minHeight, ...style } }
Otherwise if I set a style to a particular Heading block that has a minHeight different from the default value
const minHeight = styles.blockText.minHeight;
it will be override by this.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are correct let me correct this.