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

Switching Quote block with HTML tags in it splits it in two #1765

Closed
hedgefield opened this issue Jul 6, 2017 · 7 comments
Closed

Switching Quote block with HTML tags in it splits it in two #1765

hedgefield opened this issue Jul 6, 2017 · 7 comments
Assignees
Labels
[Type] Bug An existing feature does not function as intended
Milestone

Comments

@hedgefield
Copy link

Steps to Reproduce

  1. Create a new post, type some text in a Text block
  2. Select part of the text and turn it into a link
  3. Turn the block into a quote
  4. Turn the block back into text, and it splits in two

breaking blocks

Version 0.3.0

Expected Behavior

For the text to stay together in one block.

Current Behavior

The text gets split into two blocks.

@hedgefield hedgefield changed the title Switching Quote block with HTML tags splits it in two Switching Quote block with HTML tags in it splits it in two Jul 6, 2017
@westonruter
Copy link
Member

There seems to be some issues with the block transformation:

transform: ( { value, citation, ...attrs } ) => {
const textElement = value[ 0 ];
if ( ! textElement ) {
return createBlock( 'core/text', {
content: citation,
} );
}
const textContent = isString( textElement ) ? textElement : textElement.props.children;
if ( Array.isArray( value ) || citation ) {
const text = createBlock( 'core/text', {
content: textContent,
} );
const quote = createBlock( 'core/quote', {
...attrs,
citation,
value: Array.isArray( value ) ? value.slice( 1 ) : '',
} );
return [ text, quote ];
}
return createBlock( 'core/text', {
content: textContent,
} );

I'm taking a look.

@westonruter westonruter self-assigned this Jul 6, 2017
@westonruter westonruter added the [Type] Bug An existing feature does not function as intended label Jul 6, 2017
@westonruter
Copy link
Member

I think the issue may have been introduced by #1078, where a Text block now only contains a single paragraph. /cc @iseulde

@westonruter
Copy link
Member

See one possible improvement in #1774.

@karmatosed
Copy link
Member

I am still seeing this in 1.0.

@karmatosed karmatosed added this to the Beta 1.2 milestone Sep 4, 2017
@BoardJames
Copy link

I just tried to replicate this and I am not seeing the link split off as in the video. It is still creating 2 blocks though which is probably not what we want when the quote attribution field is empty.
p-link-to-quote-conv

@BoardJames BoardJames self-assigned this Sep 6, 2017
@mtias mtias modified the milestones: Beta, Needs to happen, Beta 1.2 Sep 6, 2017
@jasmussen
Copy link
Contributor

I can't reproduce the "breaking on the link" issue, but it still does create two blocks, and I think #3559 is related or the same.

@jorgefilipecosta
Copy link
Member

Thank you for your report @hedgefield this should be fixed with the merge of #3802.

Tug pushed a commit that referenced this issue Jan 16, 2020
Fix SelectControl to display label instead of value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

7 participants