Awesome! Man, if there is an award for creating fantastic software and personally delivering superb, near-instantaneous support, you get that prize. Thank you so much for your help.
Cheers! j Hussein Shafie wrote: >Jed Parsons wrote: > > >>Rollin' on to another question :) >> >>How do I refine this so that it works for an element called 'para', but >>leaves ENTER inserting a '\n' in paras that have xml:space 'preserve'? >> >>To state the desired behavior: >> >> ENTER bound to "addSameAfter" for certain nodes that do NOT have >>xml:space set to 'preserve' >> ENTER inserts a simple '\n' in all other cases >> >>I can't figure out how to select an element by attribute in a command. >> >> >> > >I've tested the bindings and the macros below with XHTML: > >--- > <command name="addSameAfter"> > <macro> > <sequence> > <command name="selectNode" > parameter="ancestorOrSelf[implicitElement] p pre li" /> > <command name="insertNode" parameter="sameElementAfter" /> > </sequence> > </macro> > </command> > > <!-- modifiers="mod" means Command on the Mac and > Control on all other platforms. --> > <binding> > <keyPressed code="F2" modifiers="mod" /> > <command name="addSameAfter" /> > </binding> > > <command name="insertNewlineOrAddSameAfter"> > <macro> > <choice> > <command name="insertControlChar" parameter="\n" /> > <command name="addSameAfter" /> > </choice> > </macro> > </command> > > <binding> > <keyPressed code="F2" /> > <command name="insertNewlineOrAddSameAfter" /> > </binding> >--- > >I used code="F2" instead on code="ENTER", because the stock >configuration for XHTML already defines bindings using code="ENTER". > >In your case, simply replace code="F2" by code="ENTER" and "p pre li" by >your own block level elements. > >The basic idea is to bind Ctrl-Enter to macro addSameAfter to allow for >duplicating elements, even for those having xml:space="preserve"[*]. > >But simply pressing on the Enter key is smarter. It first attempts to >insert a newline character (command insertControlChar -- see >http://www.xmlmind.com/xmleditor/_distrib/doc/commands/insertControlChar.html) >and if (the <choice> construct) this operation is rejected by the >element, it duplicates the element. > > > >--- >[*] And, also having in the CSS style sheet, property "white-space: >pre;" (*both* *conditions* *are* *mandatory*). > > > > -- Jed Parsons / Industrial Light + Magic : 415.746.2974 grep(do{for(ord){$o+=$_&7;grep(vec($j,+$o++,1)=1,5..($_>>3||print"$j\n"))}}, (split(//,"))*))2+29*2:.*4:1A1+9,1))2*:..)))2*:31.-1)4131)1))2*:\7Glug!"))); -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.xmlmind.com/pipermail/xmleditor-support/attachments/20060217/2cca32de/attachment.htm

