Image HTML incorrect in classic editor
-
Hello,
I’ve been using the AMP plugin in a custom theme and so far it’s awesome!
On a few of my pages, I use the gutenberg editor to add images that have text right and left aligned. All is well there.
However when I edit the description for tags or categories, which uses the classic editor, the generated HTML doesn’t wrap text correctly around images.
Basically, the generated markup includes an tag (converted to amp-img correctly by the AMP plugin) but there are the following differences that cause problems:
- On gutenberg, the entire image’s markup is contained within a top-level div with the <i>data-amp-layout</i> attribute set to “responsive”, and a class attribute set to “wp-block-image” PLUS any custom classes defined in the editor. This div tag is completely missing in the classic editor.
- The <i>img</i> tag is not contained within a <i>figure</i> element with the “alignright is-resized” or “alignleft is-resized” class attributes like in gutenberg in the classic editor.
- The image caption shows up as a shortcode and unformatted text, instead of a <i>figcaption</i> element nested within the <i>figure</i> element as on gutenberg.
- The <i>img</i> tag includes rightalign/leftaling class attributes that cause the image to shift left and right improperly.
For now I’m using the text mode of the classic editor to add all this modified HTML myself, but it’s quite verbose and hacky. Just figured y’all should put this on your roadmap at some point.
Thank you!
Jayme
- The topic ‘Image HTML incorrect in classic editor’ is closed to new replies.