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

Indenting paragraph in HTML view causes an error #14672

Closed
vesaraiskila opened this issue Mar 28, 2019 · 5 comments

Comments

Projects
None yet
4 participants
@vesaraiskila
Copy link

commented Mar 28, 2019

Describe the bug
Using <p style="padding-left: 30px;"> in a block causes an error message

To Reproduce
Steps to reproduce the behavior:

  1. Create a new text block.
  2. Choose to edit it in HTML format.
  3. Enter the following in the block:

<p style="padding-left: 30px;">This is a paragraph to be indented.</p>

4: Click the three dots to open the dialog to switch to visual editing mode.

Expected behavior
The block is shown visually.

Observed behavior
The error "This block contains unexpected or invalid content" is shown. (In Finnish in the screensot below)

Screenshots
The error message:
image

When selecting "Ratkaise" (=Resolve) the following is @shown:
image

Desktop (please complete the following information):

  • OS: Windows 7
  • Browser: Opera
  • Browser version: 58
  • WordPress version: 5.1.1

@swissspidy

@michaelswengel

This comment has been minimized.

Copy link

commented Mar 28, 2019

We really need the ability to indent natively in Gutenberg. This is a very important feature for many.

@swissspidy

This comment has been minimized.

Copy link
Member

commented Mar 29, 2019

Let's close this in favor of #14554.

Getting a validation error after changing a block's expected markup is intended behavior.

@vesaraiskila

This comment has been minimized.

Copy link
Author

commented Mar 29, 2019

@swissspidy, I would like to know in what way

<p style="padding-left: 30px;"> </p>

is non-expected. It is, after all (as far as I know) valid HTML.

In addition, after resolving the error so that the desired indentation is maintained (ie, by converting the block to HTML), editing the block is cumbersome, as it can only be edited in HTML format, not graphically.

@aduth

This comment has been minimized.

Copy link
Member

commented Mar 29, 2019

Block validation is not simply a matter of verifying that the contents are valid HTML. The paragraph block cannot support this style attribute. The message is shown because it otherwise risks content loss (it can't handle the style, and thus it would be removed next time a save occurs).

There are pending discussion for ideas in improving block invalidation at #7604.

Based on how the paragraph block works, I suspect you may find some luck with the following variation:

<p><span style="padding-left: 40px;"></span>Hello</p>
@vesaraiskila

This comment has been minimized.

Copy link
Author

commented Mar 30, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.