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

Verse: Enable the line breaks #52928

Merged
merged 1 commit into from
Jul 25, 2023
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
5 changes: 0 additions & 5 deletions packages/block-library/src/verse/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,13 @@ import {
AlignmentToolbar,
useBlockProps,
} from '@wordpress/block-editor';
import { createBlock, getDefaultBlockName } from '@wordpress/blocks';

export default function VerseEdit( {
attributes,
setAttributes,
mergeBlocks,
onRemove,
style,
insertBlocksAfter,
} ) {
const { textAlign, content } = attributes;
const blockProps = useBlockProps( {
Expand Down Expand Up @@ -58,9 +56,6 @@ export default function VerseEdit( {
textAlign={ textAlign }
{ ...blockProps }
__unstablePastePlainText
__unstableOnSplitAtEnd={ () =>
insertBlocksAfter( createBlock( getDefaultBlockName() ) )
}
/>
</>
);
Expand Down
6 changes: 2 additions & 4 deletions packages/block-library/src/verse/test/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,13 @@ describe( 'Verse block', () => {
const verseTextInput = await screen.findByPlaceholderText(
'Write verse…'
);
typeInRichText( verseTextInput, 'A great statement.Again', {
finalSelectionStart: 18,
finalSelectionEnd: 18,
} );
typeInRichText( verseTextInput, 'A great statement.' );
fireEvent( verseTextInput, 'onKeyDown', {
nativeEvent: {},
preventDefault() {},
keyCode: ENTER,
} );
typeInRichText( verseTextInput, 'Again' );

// Assert
expect( getEditorHtml() ).toMatchInlineSnapshot( `
Expand Down
Loading