Skip to content

Commit

Permalink
Fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
hypest committed Apr 25, 2019
1 parent 9c298c8 commit 2b11074
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions packages/block-editor/src/components/rich-text/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,9 @@ export class RichText extends Component {
// value. This also provides an opportunity for the parent component to
// determine whether the before/after value has changed using a trivial
// strict equality operation.
if ( isEmpty( after ) && before.text.length == currentRecord.text.length ) {
if ( isEmpty( after ) && before.text.length === currentRecord.text.length ) {
before = currentRecord;
} else if ( isEmpty( before ) && after.text.length == currentRecord.text.length ) {
} else if ( isEmpty( before ) && after.text.length === currentRecord.text.length ) {
after = currentRecord;
}

Expand Down Expand Up @@ -309,10 +309,8 @@ export class RichText extends Component {
} );
this.splitContent( currentRecord );
} else {
// if ( ! event.nativeEvent.firedAfterTextChanged ) {
const insertedLineSeparator = { needsSelectionUpdate: true, ...insertLineSeparator( currentRecord ) };
this.onFormatChange( insertedLineSeparator, ! this.firedAfterTextChanged );
// }
const insertedLineSeparator = { needsSelectionUpdate: true, ...insertLineSeparator( currentRecord ) };
this.onFormatChange( insertedLineSeparator, ! this.firedAfterTextChanged );
}
} else if ( event.shiftKey || ! this.onSplit ) {
const insertedLineBreak = { needsSelectionUpdate: true, ...insert( currentRecord, '\n' ) };
Expand Down Expand Up @@ -578,7 +576,7 @@ export class RichText extends Component {

// This logic will handle the selection when two blocks are merged or when block is split
// into two blocks
if ( nextTextContent.startsWith( this.savedContent ) && this.savedContent && this.savedContent.length > 0) {
if ( nextTextContent.startsWith( this.savedContent ) && this.savedContent && this.savedContent.length > 0 ) {
let length = this.savedContent.length;
if ( length === 0 && nextTextContent !== this.props.value ) {
length = this.props.value.length;
Expand Down Expand Up @@ -616,13 +614,13 @@ export class RichText extends Component {
// ** compare with this.lastContent for optimizing performance by not forcing Aztec with text it already has
// , but compare with props.value to not lose "half word" text because of Android virtual keyb autosuggestion behavior
if ( ( typeof nextProps.value !== 'undefined' ) &&
( typeof this.props.value !== 'undefined' ) &&
( Platform.OS === 'ios' || ( Platform.OS == 'android' && ( ! this.comesFromAztec || ! this.firedAfterTextChanged ) ) ) &&
nextProps.value !== previousValueToCheck ) {
this.lastEventCount = undefined; // force a refresh on the native side
( typeof this.props.value !== 'undefined' ) &&
( Platform.OS === 'ios' || ( Platform.OS === 'android' && ( ! this.comesFromAztec || ! this.firedAfterTextChanged ) ) ) &&
nextProps.value !== previousValueToCheck ) {
this.lastEventCount = undefined; // force a refresh on the native side
}

if ( Platform.OS == 'android' && this.comesFromAztec === false ) {
if ( Platform.OS === 'android' && this.comesFromAztec === false ) {
if ( this.needsSelectionUpdate ) {
this.lastEventCount = undefined; // force a refresh on the native side
}
Expand Down

0 comments on commit 2b11074

Please sign in to comment.