WordPress.org

Ready to get started?Download WordPress

Forums

Tiny MCE defaults (22 posts)

  1. Starejosel
    Member
    Posted 1 year ago #

    I am running WP 3.4.2, BBpress 2.1.2, and the latest Graphene theme.
    I am the admin on a poetry board. I would like to change the default behavior of Tiny MCE so that in the Visual editor a return is a line break and not a paragraph (which results in double spacing). I know that shift return gives a simple line break, but I would like to swap these two behaviors. Also many users of the board type up their work in MS word and then paste it into the editor. If they do this in the Visual editor, it becomes double spaced (not if they paste it in the HTML editor). Again, I would like to change this so that the text does not come out double spaced. I found some information in the codex:
    HERE but I am afraid
    that I don't know enough to be able to use this information. Any help would be appreciated.

  2. s_ha_dum
    Member
    Posted 1 year ago #

    They shouldn't be pasting from Word, or any other word processor, at all without using the "Paste from Word" tool-- middle of the second row of buttons in the visual editor. As you can see, it leads to formatting issues and you will eventually have more serious trouble than just double-spacing.

    The only way I know to change this is going to be global for the whole site, and it would be kind-of a tricky hack. Manipulating markup is not straightforward. I couldn't tell you exactly what to do off the top of my head if I had to.

  3. Starejosel
    Member
    Posted 1 year ago #

    Thanks,
    I tried using the Paste from Word and the Paste as Text tabs, and it didn't help--still double spaced. Curiously, if I paste from textedit
    (default Mac text editor), there is no problem. Could the "Paste from Word" function be modified?

    I did find a suggestion somewhere to change the spacing but using

    .tinymce-content p {
        padding: 0;
        margin: 2px 0;
    }

    as a custom CSS in the graphene theme, but it didn't work and actually broke the editor for topics posts and was a hassle to fix.

    Any suggestions would be most welcome!

  4. Starejosel
    Member
    Posted 1 year ago #

    Can I do anything with the Advanced TinyMCE Config plugin? It looks promising, I just don't know what I should try.

    Any help would be most appreciated!

  5. s_ha_dum
    Member
    Posted 1 year ago #

    ..but it didn't work and actually broke the editor for topics posts and was a hassle to fix.

    What you are trying to do will also break the editor for topics and posts. That is part of the problem with the fix you have envisioned.

    I told you to use the "Paste from Word" tool, not because it will fix your issue, necessarily, but because you will end up with other problems if you don't. I've seen numerous cases of this. Word Processors are not meant to be code editors, and that is what you are using them for whether you know it or not. Word Processors insert all kinds of invisible control characters and other markup that should not be in a web page. It will break things. That is why you use "Paste from Word".

    I really am trying to figure out a good way for you to do this. Are you poems posted in their own post type by any chance? Or on a particular page? I am trying to isolate them so that changes don't break other things. What is your URL?

  6. Starejosel
    Member
    Posted 1 year ago #

    Thank you! Here is the link: http://poetryroundup.us/whup and here is an example of what happens when people paste in their text: http://poetryroundup.us/whup/forums/poem/my-unravished-bride/. I have fixed most of the posts by hand (as admin--it is a pretty light traffic site).

    It would be perfect to just fix it for topic starts in the forum

    http://poetryroundup.us/whup/forums/forum/poems-and-prose-about-poems/dr-whup-ass-bitchass-poetry-roundup/

    which seems to turn a specific topic URL into just

    http://poetryroundup.us/whup/forums/poem/\[specific_topic]

    (presumably due to permalinks, but I don't understand how WP makes up addresses).

    Thanks again for your interest!

    Martin

    Again, any help would be appreciated!

  7. s_ha_dum
    Member
    Posted 1 year ago #

    Try:

    .bbp-parent-forum-5 .bbp-reply-content p {
        padding: 0;
        margin: 2px 0;
    }
  8. Starejosel
    Member
    Posted 1 year ago #

    OK, I'll try it, but before I do, can I ask a couple of questions--where did you find that it is parent-forum-5, and should it be .bbp-reply-content
    or .bbp-topics-content , and why?

    Thanks a lot!

    Martin

    p.s. I am already moving the content panel around on the page:

    #bbpress-forums div.bbp-topic-content, #bbpress-forums div.bbp-reply-content {
        margin-left: 100px;
        padding: 12px 0 12px 0;
    }

    Can I add the redefinition of p into that? How should I do that? What does the div. in front of bbp-topic-content do?

    Sorry about all these questions!
    Thanks a lot!

    Martin

    oops--I see that firebug answers a lot of my questions. I still have
    a problem; if I understand what this fix does, it doesn't change the html that TinyMCE produces, just shrinks the space for < p > < /p >.
    But if someone pastes from, e.g., textedit, or uses the HTML panel rather than the Visual Editor, then the p's are really between paragraphs and the lines are in just separated by < br >. I don't
    want to mess up their formatting!

    Thanks again!

  9. s_ha_dum
    Member
    Posted 1 year ago #

    OK, I'll try it, but before I do, can I ask a couple of questions--where did you find that it is parent-forum-5, and should it be .bbp-reply-content
    or .bbp-topics-content , and why?

    It is in the generated page source. Open the page in a browser, view source, and look around.

    if I understand what this fix does, it doesn't change the html that TinyMCE produces, just shrinks the space for < p > < /p >.

    Right.

    But if someone pastes from, e.g., textedit, or uses the HTML panel rather than the Visual Editor, then the p's are really between paragraphs and the lines are in just separated by < br >. I don't want to mess up their formatting!

    If your people are inputting inconsistent data, which is what is happening, you are going to be stuck with cleaning up the mess. You may h ave to style the <br/> tag to match the <p> tag, and who knows what else. That is just what you will have to accept if you are going to allow willie-nillie data.

  10. Starejosel
    Member
    Posted 1 year ago #

    Poking around with firebug, it looks that what I need to restrict to is:
    (1) it should be in a class typic-type-topic
    (2) the div class bbp-reply-content should not contain any < br >'s.
    Can one add that into the conditions?

    Thanks a lot!

    Martin

  11. s_ha_dum
    Member
    Posted 1 year ago #

    (2) the div class bbp-reply-content should not contain any < br >'s.

    You probably can't prevent that... well, stripping those tags will open a whole new set of problems.

  12. Starejosel
    Member
    Posted 1 year ago #

    That is just what you will have to accept if you are going to allow willie-nillie data.

    Have you ever tried to tell a bunch of poets what to do :) ?

    But I think that if I can add the two conditions above, I should be good.

    Thanks again!

    Martin

  13. Starejosel
    Member
    Posted 1 year ago #

    You probably can't prevent that... well, stripping those tags will open a whole new set of problems.

    I don't want to strip them, I just want to restrict the redefintion of < p > to topics that do not contain < br >'s.

  14. s_ha_dum
    Member
    Posted 1 year ago #

    I don't want to strip them, I just want to restrict the redefintion of < p > to topics that do not contain < br >'s.

    Oh... that you cannot do. CSS is not capable of that kind of logic. I guess you could scan the post body before it prints to the screen and insert another class that you could target.

  15. Starejosel
    Member
    Posted 1 year ago #

    OK, thanks--I think that I can figure out some sort of a compromise so that I shrink the paragraph space a bit to make the double space stuff look OK but not so much that the other stuff looks bad. I'll fiddle.

    Thanks a lot. I guess though this doesn't really solve the original problem of changing TinyMCE's behavior.

    Should I mark this as resolved?

  16. s_ha_dum
    Member
    Posted 1 year ago #

    Your original proposal seemed likely, to me, to be very complicated and prone to error, so I steered you away from it. If the CSS solution is acceptable then resolve the thread. Otherwise, leave it open. I don't think I have to time to bite into that TinyMCE project though.

  17. Starejosel
    Member
    Posted 1 year ago #

    OK, thanks--actually, I do have some hope of doing better using
    br~p to look for p's that follow a br--would that work?
    Can I do a series of redefinitions with increasingly restrictive selectors? In which order should I put them?

    Thanks again!
    Martin

  18. s_ha_dum
    Member
    Posted 1 year ago #

    You could select a <br/> that is inside a <p> tag but not one that 'follows' it, strictly speaking.

    Can I do a series of redefinitions with increasingly restrictive selectors? In which order should I put them?

    Most restrictive last.

  19. Starejosel
    Member
    Posted 1 year ago #

    Can I select a p tag that contains a br tag?

    Thanks again!

    Martin

  20. s_ha_dum
    Member
    Posted 1 year ago #

    Can I select a p tag that contains a br tag?

    No. You can't have those kinds of conditionals.

  21. Starejosel
    Member
    Posted 1 year ago #

    The solution still doesn't look great. I'll leave it open and hope for some new idea. Thanks for all your time and effort.

  22. Starejosel
    Member
    Posted 1 year ago #

    I have been trying some more; here is the latest status:
    (I am presenting it as code to avoid problems with html that is in
    the message):

    the problem is to swap the default behavior and 
    make return give a br tag and shift return give a p tag.  
    The TinyMCE wiki http://www.tinymce.com/wiki.php/Configuration
    seems to say that is the way to do it is by setting 
    forced_root_block to false.
    
    However, when I tried that using the
    Advanced TinyMCE Configuration plugin by Andrew Ozz ,
    I found:
    
    If I use it to set 
    forced_root_block to false, 
    nothing changes. 
    
    If I set forced_root_block to true, which I expected
    to do nothing, it breaks the editor: 
    The buttons don't work, and anything that I type
    into the Visual editor 
    gets wiped out when I switch to html.
    
    If I set forced_root_block to just a space,
    when I typed in 
    
    test
    test
    test
    test
    
    test
    test
    
     it produces the following html:
    
    < >< >test
    <!-- -->
    <div>test</div>
    <div>test</div>
    <div>test</div>
    <div></div>
    <div>test</div>
    <div>test</div>
    <div></div>
    
    which displays as 
    
    < >< >test
    
    test
    test
    test
    test
    test
    
    after submitting.
    
    Finally, if I set forced_root_block to div,
    when I typed in 
    
    test
    test
    test
    test
    
    test
    test
    
    it produces
    
    <div>test</div>
    <div>test</div>
    <div>test</div>
    <div>test</div>
    <div></div>
    <div>test</div>
    <div>test</div>
    <div></div>
    
    which displays as 
    
    test
    test
    test
    test
    test
    test
    
    and there seems to be no way to produce a break.
    
    I hope that this data is useful.

    Any help would be greatly appreciated.

Topic Closed

This topic has been closed to new replies.

About this Topic