You are not logged in.
I just wanted to see if anyone knows of a way to get out of a list programmatically in FireFox?
If you set config.mozParaHandler to "built-in", which passes the ENTER key onto the internal handler, FireFox correctly "gets out of" ordered and unordered lists on double enter. I presume it's a feature of the in-browser ENTER key handler.
However if you select dirty or best for mozParaHandler, the ENTER behavior is intercepted by dom_checkInsertP() or the EnterParagraphs plugin respectively.
Right now it looks like the only way to to "get out of" the list is to let FireFox process the ENTER keypress internally (i.e. by not calling _stopEvent() and letting firefox do it's thing).
Aside from letting the event propagate into the browser, is there any programmatic way to force your way out of a list? (you'll notice that you can't get out of the list by hitting ENTER twice. You have to select the list icon again which passes the command directly to the browser execCommand.)
thanks,
-- Yermo
-----------------------------------------------------------------------------------------
Content Management with Business Intelligence [url]http://www.formvista.com[/url]
Offline
Taken from dom_checkInsertP this should help
var sel = this._getSelection();
sel.removeAllRanges();
sel.collapse(newblock,0);
that would put the cursor at offset 0 inside newblock (which is just a dom element).
James Sleeman
Offline
Taken from dom_checkInsertP this should help
[code] var sel = this._getSelection();
sel.removeAllRanges();
sel.collapse(newblock,0);[/code]
that would put the cursor at offset 0 inside newblock (which is just a dom element).
Hmmm. That doesn't seem to be working for me. I'm guessing if you've got:
[code]<ul>
<li><br>
<li>
</ul>
[code]
You would tack on a new block as a nextSibling to <ul> and then collapse to that block as in something like:
[code]
<ul>
<li><br>
</li>
<p> </p>[/code]
(I haven't gotten this to work yet). I'm guessing you would have to handle this particular case separately (i.e. an empty list should probably disappear when you hit enter on an empty node .. which is what the built-in handler does ...)
What I've got working here is detecting that I'm on an empty last <li> tag and just returning without calling stopEvent to let the browser handle it ... seems to work but it's a little unclean IMHO.
-----------------------------------------------------------------------------------------
Content Management with Business Intelligence [url]http://www.formvista.com[/url]
Offline
Yes thats what I would have thought, but the selection object for Gecko isn't documented, so it would probably be a matter of experimentation to get it working.
If letting it drop through to the browser works, whats wrong with that?
James Sleeman
Offline
Yes thats what I would have thought, but the selection object for Gecko isn't documented, so it would probably be a matter of experimentation to get it working.
If letting it drop through to the browser works, whats wrong with that?
Dunno. Seems to work but I'm still new to all of this client side DOM javascript stuff. It seems to me to be a domain of unanticipated consequences so I figured I'd ask.
I think I've pretty much figured EnterParagraphs out. It's taken quite a while. Have you looked at that code? If they have an obfuscated Javascript contest I think we should submit it.
It doesn't handle any of the terminal conditions correctly (beginning/end of document, <a> section, <li>, etc. Erroneously generates a false (in getNodeUnder() on _fenEmptySet()) on empty text nodes and causes the left (or right) side range to get duplicated which is why you get those empty <a ..> etc at the end of documents. The coding style is so terribly indirect it's hell trying to figure out what the original author was thinking.
I was on the verge of giving up on it when I made a few breakthroughs. If it continues to go well I should have something to show later this week which also implements the styled <p> tag solution we were discussing a while ago. Getting the same thing to work for MSIE however is going to be cheap trick (put off until later).
You won't like my style and trace messages (of course), but I figure it'll be pretty easy to rip out tracing and tweak it for whatever style you'd like. It should be an improvement over what's there ...
-----------------------------------------------------------------------------------------
Content Management with Business Intelligence [url]http://www.formvista.com[/url]
Offline