Pleiades / closure-library

Automatically exported from code.google.com/p/closure-library
0 stars 0 forks source link

TagOnEnterHandler editor plugin: clearing the field goes back to <br> #89

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
1. Create an Editor Field, and set the enter tag to P by:

this.myfield.registerPlugin(new 
goog.editor.plugins.TagOnEnterHandler(goog.dom.TagName.P));

2. Open you test application. Verify that it uses <P> tags for paragraphs
3. Completely clear the field, and type again.

At that point we should still have <P> tags generated, but now enter will 
create <BR> tags.

Using: svn checkout r9 in Google Chrome Linux (4.0.249.30)

Original issue reported on code.google.com by elois...@gmail.com on 11 Dec 2009 at 1:38

GoogleCodeExporter commented 8 years ago

Original comment by pall...@google.com on 15 Jul 2011 at 1:34

GoogleCodeExporter commented 8 years ago
I have also encountered this and traced it back to the fact that EnterHandler 
is using keyPress to capture backspaces, but keyPress is not reliably triggered 
for backspace. It does not trigger for me in Chrome/OSX.

I resolved it by add a keyDown handler which calls the appropriate method. 

Original comment by jonat...@livefyre.com on 24 May 2012 at 9:50

Attachments:

GoogleCodeExporter commented 8 years ago
The above fix unfortunately doesn't keep closure from creating <br>s in 
addition to <p>s in firefox (up to 23.0.1 as of now).
To re-create:
start out with editor on one paragraph: <p>hello</p>
hit enter for new line: <p>hello</p><p> </p>
type a char: <p>hello</p><p>x <br></p>

Original comment by elgha...@gmail.com on 20 Aug 2013 at 10:25