- From: David Young <dyoung@pobox.com>
- Date: Sat, 16 Jun 2012 17:34:52 -0500
- To: whatwg@lists.whatwg.org
On Wed, Jun 13, 2012 at 10:11:26PM +0000, Ian Hickson wrote: > On Wed, 2 May 2012, Alfonso Mart?nez de Lizarrondo wrote: > > > > Recently I wrote such a plugin for CKEditor, it can be tested here: > > http://alfonsoml.blogspot.com.es/2012/04/placeholder-text-in-ckeditor.html > > I don't think that too many people request this feature, but that might > > be simply because there are other bigger problems and they don't want to > > waste the time with these details :-) > > > > In my checks to see if the editor is empty I decided that empty means no > > real content, only a paragraph or new line, and of course every browser > > decided that clearing the content might mean a different default content > > In the end this is the check that I'm using at the moment (I didn't > > perform extensive tests, just enough to check that it seemed to work) > > > > var value = data.replace( /[\n|\t]*/g, '' ).toLowerCase(); > > if ( !value || value == '<br>' || value == '<p> <br></p>' || value == > > '<p><br></p>' || value == '<p> </p>' ) > > return true; > > Now there's a problem we should fix. Having five different representations > of "nothing" seems like a terrible position for us to be in. How many cursor positions are there in each of those strings? I think that if there is more than one possible cursor position, then the state of the editor is "some content" instead of "no content." I submit that only the empty string (value == '') is "no content". :-) Dave -- David Young dyoung@pobox.com Urbana, IL (217) 721-9981
Received on Saturday, 16 June 2012 22:37:13 UTC