pressbooks / pressbooks-book

McLuhan is the default book theme for Pressbooks.
https://pressbooks.org
GNU General Public License v3.0
20 stars 16 forks source link

Left-aligned and right-aligned images inside of textboxes don't respect borders #636

Open mcgratay opened 4 years ago

mcgratay commented 4 years ago

Prerequisites

Description

If an image in a textbox is aligned left or right so that text wraps around it, that image will not respect the bottom border of the textbox. The image and any attached caption will flow over the textbox in all export formats. Note that this bug does not seem to affect the webbook format, but does appear in in the visual editor.

Notes:

Visual editor view of a small textbooks with a right-aligned image: Screen Shot 2019-12-04 at 11 56 01 AM

This issue is particularly hard to work around in ebook format because the image may flow over

Screen Shot 2019-12-04 at 11 53 00 AM

or even onto the next page Screen Shot 2019-12-04 at 11 53 12 AM

depending on the size of the screen and the reader's settings. Image styles in all formats should be changed so that the textbox bottom border padding accounts for side-aligned images and their captions.

Example: https://imageinatextbox.textopress.com/

Steps to Reproduce

  1. Create a new chapter and add a textbox
  2. Inside the textbox, add a small amount of filler text and an image that may extend be larger than the paragraph
  3. Edit the image alignment so that it aligns to the right or left
  4. Save the chapter and export to all formats

Expected behavior: All content inside of a textbox is contained within the borders of the textbox in all formats.

Actual behavior: Right or left-aligned images may flow over the border of a textbox.

SteelWagstaff commented 4 years ago

For ideas on fixing, see https://stackoverflow.com/a/35280358

SteelWagstaff commented 4 years ago

Adding #tinymce.wp-editor .textbox, .textbox { overflow:auto; } to custom styles appears to fix issue for webbook (and visual editor), but adding something similar to ebook & pdf stylesheet does not produce satisfactory resolution for ebook or PDF exports.