WordPress.org

Ready to get started?Download WordPress

Forums

Ultimate TinyMCE
[resolved] paragraph tags disappear between html and visual (27 posts)

  1. chrisdivyak
    Member
    Posted 1 year ago #

    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.

    http://wordpress.org/extend/plugins/ultimate-tinymce/

  2. grosner55
    Member
    Posted 1 year ago #

    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.

  3. Josh (WP Edit)
    Moderator and Editor Customizer
    Plugin Author

    Posted 1 year ago #

    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 ;)

  4. chrisdivyak
    Member
    Posted 1 year ago #

    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.

  5. Josh (WP Edit)
    Moderator and Editor Customizer
    Plugin Author

    Posted 1 year ago #

    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...

  6. SooBahkDo
    Member
    Posted 1 year ago #

    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.

  7. Josh (WP Edit)
    Moderator and Editor Customizer
    Plugin Author

    Posted 1 year ago #

    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...

  8. chrisdivyak
    Member
    Posted 1 year ago #

    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.

  9. singhrajveer858
    Member
    Posted 1 year ago #

    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.

  10. Josh (WP Edit)
    Moderator and Editor Customizer
    Plugin Author

    Posted 1 year ago #

    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.

  11. Rick Considine
    Member
    Posted 1 year ago #

    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!

  12. Josh (WP Edit)
    Moderator and Editor Customizer
    Plugin Author

    Posted 1 year ago #

    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 :)

  13. Rick Considine
    Member
    Posted 1 year ago #

    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?

  14. Josh (WP Edit)
    Moderator and Editor Customizer
    Plugin Author

    Posted 1 year ago #

    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".

  15. Rick Considine
    Member
    Posted 1 year ago #

    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.

  16. Josh (WP Edit)
    Moderator and Editor Customizer
    Plugin Author

    Posted 1 year ago #

    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:
    http://joshlobe.com/contact-me/

  17. Josh (WP Edit)
    Moderator and Editor Customizer
    Plugin Author

    Posted 1 year ago #

    I have added the P and BR tags buttons into both the visual and the text modes of the editor.

    I'm gonna mark this as Resolved. If anyone feels differently... I'll change it back.

    Also.. I'm open to any feedback with the buttons.

    Thanks!!

  18. Frank Gomez
    Member
    Posted 1 year ago #

    Dear Josh,

    Does your plugin "force" WordPress to display the p and br tags in the "visual" mode? or just make it easy for users to insert them?

    I know I have these tags in my posts but as you know wordpress strips them out.

    Basically I want to be able to "SEE" all of my code.

  19. Josh (WP Edit)
    Moderator and Editor Customizer
    Plugin Author

    Posted 1 year ago #

    Well.. it doesn't really "force" the tags to be allowed. What it does is add a class of "none" to the tag... rendering it a valid tag.

    So yes, you will be able to "see" them when switching between views. You won't see them in the visual mode.. as this would defeat the purpose. However, if you switch back and forth all day long.. you will still be able to see the tags in the "text" view.

    I don't know of any plugin which would show those tags in the visual editor.

  20. Frank Gomez
    Member
    Posted 1 year ago #

    I mispoke, I meant to say Text View (which I think of as the Visual).

    Is there problem or conflict if I have already added custom functions to prevent stripping of BR and P tags? (In other words Everything is working fine, but I can't see them which makes it hard to edit.

  21. Josh (WP Edit)
    Moderator and Editor Customizer
    Plugin Author

    Posted 1 year ago #

    I mean.. it's certainly possible. Have you added custom functions? Are you using a child theme?

    It shows them in my test sites content editors.. so I would think they would show in all themes... unless you have something telling it not to??

  22. Frank Gomez
    Member
    Posted 1 year ago #

    Yes, custom functions added
    Yes, child theme.

    I just thought I'd ask before I tried it.

    SO, I tried, it still don't see any P or BR tags in Text View. Perhaps my custom functions are interefering...

  23. Josh (WP Edit)
    Moderator and Editor Customizer
    Plugin Author

    Posted 1 year ago #

    Can you post them on pastebin.com? Then, post here the link they give you after you submit your code. That way, I can take a look at it and see if anything jumps out.

  24. Frank Gomez
    Member
    Posted 1 year ago #

  25. Josh (WP Edit)
    Moderator and Editor Customizer
    Plugin Author

    Posted 1 year ago #

    Yea, that first function is altering the output of the content variable, which is the content of your post/page.

    You can test it by commenting out that first function, refreshing your browser cache, and looking at a post/page to see if those tags show up.

    Here is a pastebin, which shows the top function commented out:
    http://pastebin.com/PfZgGR2X

  26. Frank Gomez
    Member
    Posted 1 year ago #

    Interesting, I did that and it took care of it but it reveals another problem with the gallery, There two br tags at end of the gallery (clear both), These seem totally unnecessary - Not your problem but interesting.
    I think 1 br tag is reasonable, 2 seems silly. If I want more space I will hit return to add a P tag.

    This page has an interesting solution which I'm going to try.

  27. Frank Gomez
    Member
    Posted 1 year ago #

    Tried it but it caused other problems, Thanks for your help anyway. I truly appreciate it.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic