• Resolved chrisdivyak

    (@chrisdivyak)


    I am having trouble with my paragraph tags disappearing when I go between HTML and Visual modes in WordPress. It works fine until I switch to the Visual editor which shows the paragraph styling and then when I go to update (or back to HTML mode) it strips all of my paragraph tags. I feel that this is an easy fix but I haven’t found one that worked.

    I have also tried toggling on and off the “Disable wpautop” which doesn’t make a difference either way. Any help would be greatly appreciated.

    https://www.ads-software.com/extend/plugins/ultimate-tinymce/

Viewing 15 replies - 1 through 15 (of 26 total)
  • experiencing same issue as chrisdivyak – the paragraph tags <p></p> along with
    tags vanish when switching to visual and back to html view. Looks like this started with latest update to version 3.3.

    Plugin Author Josh

    (@josh401)

    Okay… to my understanding… removing the wpautop filter has the following effects on the editor:

    1. Stops WP from “guessing” where p and br tags should be inserted. So, all content basically runs together when viewed on the front end, regardless of how it was formatted in the visual editor.

    2. In HTML mode, you can now use p and br tags (which should function as expected, and save)… but you can not switch to visual mode. If you switch modes.. the tags get stripped out.

    So, here is the issue…

    How do we create content in the HTML side using p and br tags (and any others)… switch to Visual mode (where the formatting is already kept).. and then switch back to HTML mode (where currently the formatting is being stripped)… but we want to keep the HTML formatting we entered in the first place.

    So, where is the issue? It seems that when the editor switches from HTML to visual… the visual side “recognizes” all the tags and displays them properly. But, when you switch back to HTML… it appears the editor doesn’t know how to convert those tags back into HTML.

    Is there a workaround for this (other than never switching to visual)? I’m not sure…

    I’m going to do some research and see what I can find. If you have any links or references where you have seen this working before… please include them here.

    Perhaps all three of us working together can find a solution ??

    Thread Starter chrisdivyak

    (@chrisdivyak)

    Josh, that is exactly what is happening. It seems to happen with both
    and <p> tags but nothing else. All of my spans and divs are there. I haven’t found a work around and spent some time yesterday trying to find a fix with no luck. I will try again today to see what I can find. It seems like spitting out paragraph tags would be pretty essential to any WYSIWYG editor so I am kind of shocked this is even an issue.

    Plugin Author Josh

    (@josh401)

    Okay… well, I’ve got it working… kinda….

    Here’s an example:

    If you type the following into the editor on the HTML side:

    <div>
       <p>Line One</p>
       <p>Line Two</p>
    </div>

    It will save. Also if you switch to the visual editor and back.. the tags will be retained… but the spacing is lost. Resulting in the following code:

    <div><p>Line One</p><p>Line Two</p></div>

    Basically, it keeps the tags… but removes any other spacing whatsoever. In my opinion, this can be very difficult to read and make adjustments.

    So… I’m still looking also…

    I agree that a solution to this is needed.

    When I paste this into HTML

    <div>
    <p>Line One</p>
    <p>Line Two</p>
    </div>

    Then switch to visual and back I get:

    <div>

    Line One

    Line Two

    </div>

    Thanks to all chiming in to provide info.

    Plugin Author Josh

    (@josh401)

    Well… I’m still stuck at my example above. I can get the tags to stay preserved… but the spacing of the HTML code gets all ran together.

    It would be totally awesome if I can find a way to also preserve the line spacing in the HTML mode when switching between the two…

    Thread Starter chrisdivyak

    (@chrisdivyak)

    Same here. I think this will be an interim solution until a better one is found. Thanks to all for looking into this and helping point me in the right direction. It is much appreciated.

    Hi All,

    I have found the solution for the line break.
    You need to put the <br class=”blank” /> to preserve the line space between visual and html editor.

    But still finding solution for preserve the paragraph between these two modes.

    Plugin Author Josh

    (@josh401)

    Hi, and thanks singhrajveer858!!

    I’m going to code some buttons to make it easier to work with line breaks. And, I want to allow some changing of the filters used to initialize the tinymce window.

    I think giving some more advanced options will allow users to configure the initialization in different ways.

    I’ll look at a solution for p tags also.

    Really looking forward to this fix, too! In our case we want users to be able to wrap clean text from their editors in paragraph tags (that stick, of course), so they can use several UTMCE coded styles we’ve set up for the “p” selector.

    Line break control would be a godsend, too!

    Plugin Author Josh

    (@josh401)

    Understood Rick!

    I’m going to make the buttons. But, you might want to check out the “tagwrap” button I made. It allows you to choose from every HTML5 compliant tag.. and use it with your content. It is still a work in progress.. but has a TON of potential. Give it some “usage” and give me some feedback ??

    I’ll work on the buttons. Promise ??

    Thanks Josh!

    Love this plugin and am especially impressed with the Classes/ID add-on, which I have working to good effect. Tried the html5 button, and have some initial feedback:

    In the Visual Editor, when the tagwrap button (I’m testing divs) is applied to selected text that has content on the line before and after, the text is deleted and the opening and closing tags are inserted, and can see them in the HTML view, but the (now empty) tagged line doesn’t display in the Visual Editor until you switch to HTML view and back again. That’s problematic for a user who doesn’t know to switch and switch back, and even more confusing if the tagged (and now deleted and empty) line is at the end of the content, since without switching to HTML View and back again, the user can’t access the line at all.

    The p tag seems to preserve the content, (though I haven’t removed the wpautop filter and tested that).

    Maybe I’m missing something. Shouldn’t the tagwrap actually “wrap” and preserve selected text?

    Plugin Author Josh

    (@josh401)

    Yes, it should.

    However, keep in mind that addon is freaking HUGE. Each one of those tags has seven files associated with it. So, something like 300 files in that addon.

    But, I coded it that way to give it the best possibility for future enhancements and features.

    It needs a LOT of work… but the foundation is there… and as soon as I get a little time, I want to get back in there and tweak each one of those tags some more.

    I’m working right now on two buttons. One to simply insert linebreaks which will be safe. The other… to preserve paragraph tags.

    I have it working… mostly ?? There are a couple little “bugs”… but it’s performing better than I originally anticipated at this point.

    I have incorporated into my PRO version, and will be setting up a release in the next two days. Once I have some feedback, and see if it will be generally accepted… then I’ll also make it available in my lite version.

    Soooo… that’s the “sit rep”.

    Thanks again for the quick response Josh. I appreciate the depth of the challenge. For now I’ll work around it using the p tags and the Classes/ID plugin (which is awesome!) to keep the client users sane.

    Will check out the new pro release. Sounds good.

    Plugin Author Josh

    (@josh401)

    No worries.

    Why don’t you go ahead and shoot me an email so I can respond to you.

    I have something I want you to try!!

    You can contact me by using my form here:
    https://joshlobe.com/contact-me/

Viewing 15 replies - 1 through 15 (of 26 total)
  • The topic ‘paragraph tags disappear between html and visual’ is closed to new replies.