Results 1 to 5 of 5

Thread: Can the Enter key use <div> instead of <p> in HTML editor?

  1. #1
    beq
    beq is offline Member
    Join Date
    Oct 2007
    Location
    USA
    Posts
    11
    Rep Power
    7

    Default Can the Enter key use <div> instead of <p> in HTML editor?

    When composing an HTML email message, I prefer the Enter key to not skip a line (ie. I don't want "double spacing"). This is the way WYSIWYG word editors behave, and most local email apps as well as Gmail, Yahoo Mail, etc, also behave this way.

    Can the Zimbra HTML editor be configured to behave this way too? In other words, can the Enter key generate <div> tags instead of <p> tags?

    The following explanation (although about an unrelated HTML editor) has more details:

    http://blog.fastmail.fm/2007/10/03/h...-fckeditor-25/
    Quote Originally Posted by FM
    One of the features I really wanted to use was the new EnterMode option which allows you to control if the Enter key generates either a <br>, a <p> or a <div> tag. This turns out to be surprisingly important because of the way HTML works versus the way people expect WYSIWYG style editors to work.

    The problem resolves around two conflicting observations


    1. When people hit Enter, they want the cursor to drop directly to the next line and not leave any vertical gap
    2. When people hit Enter, they expect a paragraph of text to created and treated as a "block" of text for block level formatting items (eg indent, right-to-left display, etc)

    The problem is that in HTML, to create a new “block” of text, you use <p> markers around the text. Unfortunately by default browsers includes some vertical spacing between blocks of paragraph text. So if you set EnterMode=p, then when you hit Enter, it does create a new <p> block, but also the cursor moves down what appears to be around 1.5 lines, rather than directly to the next line. Now you can explicitly set the spacing on paragraphs so that it bunches paragraphs directly underneath each other with no gap, but you need to apply that to the whole document, which means that if you reply to existing text that contains <p> tags, those will all be bunched next to each other as well, even if that’s not how the original author intended it and can make it hard to separate out paragraphs. Basically there’s a disconnect between the semantic nature of the HTML and the way it’s displayed.

    Going the other way, if you use <br> markers, these don’t create new “blocks” of text, they merely designate points in the big block of text where to insert a line-break. While this might sound fine, it creates problems when you then try and perform actions on blocks of text (eg center, or turn into a list, or change to right-to-left text display, etc). Despite these issues, the fact that inserting a <br> moves the cursor immediately to the next line which is what most people expect, is the reason most online HTML editors use this approach.

    The final approach is to use <div> markers. In fact, div markers are an excellent compromise. They do create new HTML blocks making formatting easier, but by default don’t include any extra vertical spacing, so they create the “cursor drops down only one line” effect. Interestingly, the HTML editor in Outlook Express has always used <div> markers when using the Enter key, and in most cases it creates exactly the effect people want.

  2. #2
    Dirk's Avatar
    Dirk is offline Moderator
    Join Date
    May 2006
    Location
    England.
    Posts
    927
    Rep Power
    9

    Default

    The double spacing problem is restricted to Internet Explorer, are you using that? I use Firefox only and have no such issue.

    I'd imagine you could edit the source to change the inserted tags, but it would be overwritted each upgrade and if it was as simple as that to fix, the devs would have done it already.

    You can, if I recall right, press ctrl+enter to get a single line, this was all explained somewhere but I cant remember which post it was in, see if you have more luck with the search

  3. #3
    beq
    beq is offline Member
    Join Date
    Oct 2007
    Location
    USA
    Posts
    11
    Rep Power
    7

    Default

    Thanks you're right, Zimbra HTML editor does not have this issue in Firefox.

    It should be noted that in IE, I've had the same "double-space-on-Enter" paragraph issue with other open-source webmail HTML editors. Firefox behaved correctly with some of those editors -- but with the rest of them, Firefox also had the same issue. I wonder why Firefox only works correctly with some editors but not others?

    Then again, major webmails like Gmail, Yahoo Mail, etc, do not have this issue at all, whether in Firefox or in IE. It's all so confusing


    Anyways as you said, I can use Shift+Enter in IE to get a single line. In fact, Shift+Enter usually worked for me with other problematic webmail editors that I mentioned, both in IE and in Firefox (with those specific editors where Firefox exhibited the same issue).

    This paragraph behavior seems to be configurable with at least some of the other webmail editors though. Because one email provider was able to change a setting to flip this behavior around -- so that pressing Enter gives you a single line, and pressing Shift+Enter gives you the double line to separate paragraphs.

  4. #4
    beq
    beq is offline Member
    Join Date
    Oct 2007
    Location
    USA
    Posts
    11
    Rep Power
    7

    Default

    I just found two other threads, dated 03-15-2007 and 07-12-2007

    Also found Bug 3264

    According to the Paraq Shah in the bug report, IE inserts <p> and FF inserts <br>. The blog I quoted in my original post above explains why <br> isn't an optimal solution either, in regards to paragraph formatting separation. Is it true then that <div> is the best solution, for both IE and FF??

  5. #5
    beq
    beq is offline Member
    Join Date
    Oct 2007
    Location
    USA
    Posts
    11
    Rep Power
    7

    Default

    Code:
    Change 73533 by mihai@mihai3 on 2007/11/12 02:02:03
    
    	Bug: 3264
    	
    	Added inline style "p { margin 0 }", so that IE paragraphs appear as
    	single lines.  That's not The Right Solution, but seems the best we 
    	can do.
    	
    	Bug 3264 - HTML compose: lines are double spaced
    Very nice, thanks for the update on bugzilla I'd like to test it on the hosted demo soon...


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 02-04-2006, 08:09 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •