Editor - Enter Key

    It may sound crazy, but we need this page.

     In the editor the carriage return (enter key) behavior is inconsistent in Firefox.


    The Problem

    When using the "enter key" in the editor, the markup results are not what the user expects. Because of our varying usage of linebreaks (<br/>) and paragraphs (<p>), oftentimes documents will magically get visual linebreaks in places they should not.

    Problem, Demonstrated

    Carriage Return

    For example provided the following markup:


    <h1>Dekidev </h1> <br /> <br /> <p align="center"> <br /> </p> <p> <strong>At Amplify SD,</strong> we're passionate about San Diego


    music, but we'll admit we don't know everything. That's why you're going to tell the story -- about San Diego's best music venues, bands big and

    small, and the continually evolving history of the scene. </p>


    Place your insertion point immediately after the page title. Press enter as many times as you like. You'll notice the behavior is consistent with

    any word processor. For each carriage return you receive one new line. For example I hit enter three times and I get the following markup:


    <example_markup> <h1>Dekidev </h1> <br /> <br /> <br /> <br /> <br /> <p align="center"> <br /> </p> <p> <strong>At Amplify SD,</strong> we're passionate about San Diego music, but we'll admit we don't know everything. That's why you're going to tell the story -- about San Diego's best music venues, bands big and small, and the continually evolving history of the scene. </p>


    It behaves exactly as I would expect. Three carriage returns provides three new lines. Now with the same markup place your insertion point

    immediately at the end of the first paragraph (e.g.- "scene.|")


    Now press enter three times. I receive 5 new lines.


    <h1>Dekidev </h1> <br /> <br /> <br /> <br /> <br /> <p align="center"> <br /> </p> <p> <strong>At Amplify SD,</strong> we're passionate about San Diego music, but we'll admit we don't know everything. That's why you're going to tell the story -- about San Diego's best music venues, bands big and small, and the continually evolving history of the scene. </p> <br /> <p> <br /> </p> <br /> <p> <br /> </p> <p> <br /> </p>


    The desired behavior is that the user sees a new line for each carriage return. A proposal for what this would look like in markup is as follows:

    START: <p>A paragraph</p>


    ENTER: <p>A paragraph<br/></p>


    ENTER (again): <p>A paragraph</p> <p>&nbsp;</p>


    ENTER (again, again): <p>A paragraph</p> <p>&nbsp;<br/></p>


    ENTER (again, again, again): <p>A paragraph</p> <p>&nbsp;</p> <p>&nbsp;</p>

    Proposed Solutions

    The ENTER key will be handled differently in different situations. This behavior should be consistent across FireFox, IE6, and IE7.


    (Red I indicates active cursor)


    Within <hx> tags

    ENTER should ALWAYS break out of the <hx> tag into a new paragraph block.

    Example


    Initial Markup <h1>My header I</h1>
    Markup after 1 ENTER <h1>My header</h1>
    <p>I&nbsp;</p>


    Within <p> tags

    ENTER returns a new paragraph tag, SHIFT+ENTER returns a linebreak.

    Within <li> tags

    Note: Xinha already behaves as expected; this behavior should not be modified.


    Each ENTER should break out of an individual <li> element, unless, the previous element is an empty <li>, which should break the list (<ol>, <ul>) element.

    Example

    Markup
    <ul>
       <li>List item 1I</li>
    </ul>
    Markup after 1 ENTER <ul>
       <li>List item 1</li>
       <li>I&nbsp;</li>
    </ul>
    Markup after 2 ENTER <ul>
       <li>List item 1</li>
    </ul>
    <p>I&nbsp;</p>
    Tag page
    You must login to post a comment.

    Copyright © 2011 MindTouch, Inc. Powered by