[Webkit-unassigned] [Bug 59961] New: Implement webkit-defaultBlock execCommand, to let authors choose the default block element

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon May 2 14:23:36 PDT 2011


https://bugs.webkit.org/show_bug.cgi?id=59961

           Summary: Implement webkit-defaultBlock execCommand, to let
                    authors choose the default block element
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: All
        OS/Version: All
            Status: UNCONFIRMED
          Severity: Enhancement
          Priority: P2
         Component: HTML Editing
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: bloom at google.com
                CC: ojan at chromium.org


Opera silently included a new execCommand in Opera 11.10, "opera-defaultBlock". It lets authors set the default block element for rich text editors on the page to either 'p' or 'div'. If other browsers adopt a similar execCommand, it could make it much easier for authors to get consistent rich text editing behavior that they want (without resorting to a hacks involving listening to keyboard events and mangling the DOM when the user presses [return]).

Note that this only affects the default block, which is usually not used. For example, pressing [return] inside of <body contentEditable><p>foo[caret]</p></body> or <body contentEditable><div>foo[caret]</div></body> will always create another <p> or <div> respectively, regardless of the default block.

For example, if the default block is set to <p>...

<body contentEditable>foo[caret]</body> --> pressing [return] creates a <p> (default block is used)
<body><div contentEditable>foo[caret]</div></body> --> pressing [return] creates a <p> (default block is used)
<body contentEditable><div>foo[caret]</div></body> --> pressing [return] creates a <div> (default block is ignored)
<body contentEditable><ol><li>foo</li><li>bar[caret]</li></ol></body> --> pressing [return] creates an <li> (default block is ignored)
<bdoy contentEditable><ol><li>foo</li><li>[caret]</li></ol></body> --> pressing [return] creates a <p> (default block is used)

Implementing this in WebKit could be as simple as adding a webkit-defaultBlock command that lets authors specify whether to create a 'p' or a 'div' here: http://trac.webkit.org/browser/trunk/Source/WebCore/editing/htmlediting.cpp?rev=85256#L831

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list