TinyMCE Advanced
Add Image w/ Caption before Heading (4 posts)

  1. KennyLL
    Posted 4 years ago #

    I've discovered that it is impossible to insert an image with a caption at the beginning of a page/post that begins with a Heading tag (h2, h3, etc.) without gaining extra unwanted formatting.

    We would usually place our cursor before the first character in the editor, then insert the image setting it to 'Align Left' (adds a float: left;). Without a caption, this would usually add the image tag within the first text block, whether a heading or paragraph tag. Then the text floats nicely around it.

    But when the first line is a heading, and the image has a caption, the caption DIV is added before the text BUT an empty paragraph is added after (<p> </p>). So there is extra unwanted spacing on top of the first heading.

    If we manually remove the empty paragraph in HTML view, it just adds it back in when switching to Visual view and publishing.

    If the first line is a paragraph, though, it seems to work like you would expect and does not add the extra blank paragraph.

    - Anyone have this issue before? How do you add an image with a caption before a heading?

    - Any idea where in the code this would be happening so that whatever is NOT happening with a paragraph could be made to work with headings??



  2. christyk
    Posted 4 years ago #

    I'm having this same problem. I noticed that it was images with captions but hadn't noticed the association with H1, H2, etc. Now I see that is my problem as well. Would love to hear some feedback/suggestions anyone has to offer. In the meantime, I'll keep looking.

  3. Andrew Ozz
    WordPress Dev
    Plugin Author

    Posted 4 years ago #

    Sounds like problem with the editor, not necessarily with the plugin. Will investigate further.

  4. christyk
    Posted 4 years ago #

    Yes, most likely is the editor. After some research, I figured out adding <div> tags around the images keeps the extra paragraphs from being added.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • TinyMCE Advanced
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic