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 · 6 comments
Closed

Indenting paragraph in HTML view causes an error #14672

vesaraiskila opened this issue Mar 28, 2019 · 6 comments
Labels
[Block] Paragraph Affects the Paragraph Block [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed

Comments

@vesaraiskila
Copy link

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
Copy link

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

@swissspidy swissspidy added the [Block] Paragraph Affects the Paragraph Block label Mar 28, 2019
@swissspidy
Copy link
Member

Let's close this in favor of #14554.

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

@swissspidy swissspidy added the [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed label Mar 29, 2019
@vesaraiskila
Copy link
Author

@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
Copy link
Member

aduth 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
Copy link
Author

vesaraiskila commented Mar 30, 2019 via email

@phpbits
Copy link
Contributor

phpbits commented Feb 11, 2020

@vesaraiskila If you are still looking for a way to indent Paragraph on Gutenberg editor, you can use EditorsKit plugin. I've recently added Indent and Outdent Formats. Here's how it works. Thanks!

Indenting paragraph

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Paragraph Affects the Paragraph Block [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed
Projects
None yet
Development

No branches or pull requests

5 participants