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

When blocks are emptied in content, TinyMCE passes in an empty <br /> to the Redux State. #561

Closed
BE-Webdesign opened this issue Apr 28, 2017 · 8 comments
Labels
[Type] Question Questions about the design or development of the editor.

Comments

@BE-Webdesign
Copy link
Contributor

BE-Webdesign commented Apr 28, 2017

When a block with an editable component is emptied, the Redux state on UPDATE_BLOCK for that block becomes:

{
  attributes: {
    content: {
      type: 'p',
      key: '0',
      ref: null,
      props: {
        children: {
          type: 'br',
          key: '0',
          ref: null,
          props: {},
          _owner: null
        }
      },
      _owner: null
    }
  }
}

Maybe this is a non issue as any block with an Editable component will most likely need this to happen for TinyMCE to work. This could potentially make the final output of a block weird through save() as we will be adding in empty <br /> tags. Maybe this is the intended behavior to represent an empty block in the final rendering of post_content?

@BE-Webdesign BE-Webdesign added the [Type] Question Questions about the design or development of the editor. label Apr 28, 2017
@ellatrix
Copy link
Member

This is to pad empty nodes. Normally they are stripped when getting the content, but we get the raw content. getContent({ format: 'raw' })

@ellatrix
Copy link
Member

(Which is just innerHTML + some internal stuff stripped that may affect undo levels.)

@BE-Webdesign
Copy link
Contributor Author

BE-Webdesign commented Apr 28, 2017

I think this will impact save() for a block correct? Does it matter that the component we render in save() will have a <br /> as its content, if it is empty?

@aduth
Copy link
Member

aduth commented May 1, 2017

@iseulde Is this fixed by #523?

I think this will impact save() for a block correct?

It could, since the value for the content attributes would be non-empty so far as being an element, but still "bogus" content.

@ellatrix
Copy link
Member

ellatrix commented May 1, 2017

@aduth Looks like it. Should just be a p with empty props.

@ellatrix
Copy link
Member

@BE-Webdesign Is this still an issue?

@BE-Webdesign
Copy link
Contributor Author

No idea, let me check.

@BE-Webdesign
Copy link
Contributor Author

Looks good, content is now just an empty array.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Question Questions about the design or development of the editor.
Projects
None yet
Development

No branches or pull requests

3 participants