pressbooks-book icon indicating copy to clipboard operation
pressbooks-book copied to clipboard

Paragraphs after images do not indent in webbook and PDF formats

Open mcgratay opened this issue 5 years ago • 2 comments

Description

Paragraphs that begin directly after an image in the body of the text do not indent, even when the Paragraph Separation setting is set to "Indented paragraphs."

This occurs in all tested themes (incl in testing: Adunis, Andreesen, Bradbury, McLUhan).

The issue affects the webbook and PDF formats, but not ebook.

Example: https://paragraphafterimage.textopress.com Screen Shot 2019-06-27 at 11 16 56 AM

Screen Shot 2019-06-27 at 11 16 28 AM

Steps to Reproduce

  1. Create a chapter and add an image
  2. Add at least one paragraph after that chapter
  3. Go to Appearance > Theme Options and save the Paragraph Separation setting as "Indent Paragraphs"
  4. Export and view in web and PDF formats

Expected behavior: All paragraphs adhere to the paragraph style set in the theme options

Actual behavior: Paragraphs after images will not indent

mcgratay avatar Jun 27 '19 15:06 mcgratay

The issue here is the the text indentation rule targets .chapter p + p elements only (see https://github.com/pressbooks/pressbooks-book/blob/46e41fb60b177edf3db32991e8561a5bc35899bd/packages/buckram/assets/styles/components/elements/_paragraphs.scss#L20) and paragraphs that occur after images don't match the pattern, because the image element is usually wrapped inside of a div or figure. We have a rule that accounts for paragraphs which follow floated elements (https://github.com/pressbooks/pressbooks-book/blob/46e41fb60b177edf3db32991e8561a5bc35899bd/packages/buckram/assets/styles/components/elements/_paragraphs.scss#L47-L68) but this doesn't catch paragraphs which follow non-aligned image elements. Perhaps the original rule could be changed to .chapter * + p?

SteelWagstaff avatar Dec 07 '19 20:12 SteelWagstaff

Basically, we need to make sure we're catching paragraphs which follow images with the alignnone property set.

SteelWagstaff avatar Feb 29 '20 21:02 SteelWagstaff