Skip to content

Commit

Permalink
Change leave to exit
Browse files Browse the repository at this point in the history
  • Loading branch information
talldan committed Oct 25, 2018
1 parent 03fb275 commit ac5d270
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions docs/data/data-core-editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -1640,9 +1640,9 @@ Returns an action object used in signalling that the user has stopped typing.

Returns an action object used in signalling that the caret has entered formatted text.

### leaveFormattedText
### exitFormattedText

Returns an action object used in signalling that the user caret has left formatted text.
Returns an action object used in signalling that the user caret has exited formatted text.

### createNotice

Expand Down
6 changes: 3 additions & 3 deletions packages/editor/src/components/rich-text/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ export class RichText extends Component {
if ( formats[ start ] ) {
this.props.onEnterFormattedText();
} else {
this.props.onLeaveFormattedText();
this.props.onExitFormattedText();
}

if ( start !== this.state.start || end !== this.state.end ) {
Expand Down Expand Up @@ -987,15 +987,15 @@ const RichTextContainer = compose( [
redo,
undo,
enterFormattedText,
leaveFormattedText,
exitFormattedText,
} = dispatch( 'core/editor' );

return {
onCreateUndoLevel: createUndoLevel,
onRedo: redo,
onUndo: undo,
onEnterFormattedText: enterFormattedText,
onLeaveFormattedText: leaveFormattedText,
onExitFormattedText: exitFormattedText,
};
} ),
withSafeTimeout,
Expand Down
6 changes: 3 additions & 3 deletions packages/editor/src/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -548,13 +548,13 @@ export function enterFormattedText() {
}

/**
* Returns an action object used in signalling that the user caret has left formatted text.
* Returns an action object used in signalling that the user caret has exited formatted text.
*
* @return {Object} Action object.
*/
export function leaveFormattedText() {
export function exitFormattedText() {
return {
type: 'LEAVE_FORMATTED_TEXT',
type: 'EXIT_FORMATTED_TEXT',
};
}

Expand Down
2 changes: 1 addition & 1 deletion packages/editor/src/store/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ export function isCaretWithinFormattedText( state = false, action ) {
case 'ENTER_FORMATTED_TEXT':
return true;

case 'LEAVE_FORMATTED_TEXT':
case 'EXIT_FORMATTED_TEXT':
return false;
}

Expand Down
10 changes: 5 additions & 5 deletions packages/editor/src/store/test/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
startTyping,
stopTyping,
enterFormattedText,
leaveFormattedText,
exitFormattedText,
fetchReusableBlocks,
saveReusableBlock,
deleteReusableBlock,
Expand Down Expand Up @@ -362,10 +362,10 @@ describe( 'actions', () => {
} );
} );

describe( 'leaveFormattedText', () => {
it( 'should return the LEAVE_FORMATTED_TEXT action', () => {
expect( leaveFormattedText() ).toEqual( {
type: 'LEAVE_FORMATTED_TEXT',
describe( 'exitFormattedText', () => {
it( 'should return the EXIT_FORMATTED_TEXT action', () => {
expect( exitFormattedText() ).toEqual( {
type: 'EXIT_FORMATTED_TEXT',
} );
} );
} );
Expand Down
2 changes: 1 addition & 1 deletion packages/editor/src/store/test/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1327,7 +1327,7 @@ describe( 'state', () => {

it( 'should set the flag to false', () => {
const state = isCaretWithinFormattedText( true, {
type: 'LEAVE_FORMATTED_TEXT',
type: 'EXIT_FORMATTED_TEXT',
} );

expect( state ).toBe( false );
Expand Down

0 comments on commit ac5d270

Please sign in to comment.