Dylan McR. wrote:
>
> One question that our test users have been having that out of the box,
> the editor does not seem to respond to the enter key in a way that many
> XML editor users are accustomed to. I am wondering if there is perhaps a
> setting or method for getting the editor to respond in a
> context-sensitive way to the user typing enter. This would go a long way
> towards improving the user experience.
>
> For example, if the user is typing in a <p> element and hits enter, they
> might very much like to create a new <p> element at that spot. Likewise,
> if the user is creating an unordered or ordered list and hits enter,
> create a new <li> tag would be much faster than having to mouse the
> right place, right click, select "Insert" and select <li> from the list
> of available tags.
>
> Again, is there some feature that we have not yet found?

XMLmind XML Editor is very extensible and most extension does not 
require you to program in Java. (In fact, for many extensions, it's a 
bad idea to try to program them in Java.)

You can configure XMLmind XML Editor to behave exactly like you want in 
quite easily. For that, suffice to bind the Enter keystroke to the 
proper macro-command.

What follows are excerpts from 
XXE_v5.2.1_install_dir/addon/config/xhtml/xhtml_support_base.incl.

This shows you something quite similar: Pressing Ctrl-ENTER in a 
paragraph or a list item (of any kind) creates a new paragraph or a new 
list item (of the same kind).

---
<!-- Easy way to add p, li, dt+dd
      (mod is ctrl or meta depending on
      the platform.)-->

<binding>
   <keyPressed code="ENTER" modifiers="mod" />
   <command name="xhtml.appendSame" />
</binding>

<command name="xhtml.appendSame">
   <macro>
     <choice>
       <sequence>
         <command name="selectNode"
                  parameter="ancestorOrSelf[implicitElement]
                             {http://www.w3.org/1999/xhtml}p"; />
         <command name="insertNode" parameter="sameElementAfter" />
       </sequence>

       <command name="xhtml.appendListItem" />
     </choice>
   </macro>
</command>

<command name="xhtml.appendListItem">
   <macro undoable="true">
     <sequence>
       <command name="selectNode"
                parameter="ancestorOrSelf[implicitElement]
                           {http://www.w3.org/1999/xhtml}li
                           {http://www.w3.org/1999/xhtml}dd
                           {http://www.w3.org/1999/xhtml}dt"; />

       <choice>
         <sequence>
           <match context="$selected" pattern="html:li" />
           <command name="insertNode" parameter="sameElementAfter" />
         </sequence>

         <sequence>
           <!-- Match dd|dt -->

           <!-- Assumes that a dt is followed by a dd. -->
           <choice>
             <match context="$selected" pattern="html:dd" />
             <command name="selectNode"
               parameter="nextSibling {http://www.w3.org/1999/xhtml}dd"/>
           </choice>

           <command name="paste"
             parameter="after &lt;?xml version='1.0'?&gt;
&lt;cb:clipboard
xmlns:cb='http://www.xmlmind.com/xmleditor/namespace/clipboard'
xmlns:html='http://www.w3.org/1999/xhtml'&gt;&lt;html:dt&gt;&lt;/html:dt&gt;&lt;html:dd&gt;&lt;/html:dd&gt;&lt;/cb:clipboard&gt;"
 
/>
         </sequence>
       </choice>
     </sequence>
   </macro>
</command>
---

Please carefully read the above macro and try to guess how it works to 
get quickly acquainted with the concepts involved.

References:

* XMLmind XML Editor - Configuration and Deployment
http://www.xmlmind.com/xmleditor/_distrib/doc/configure/index.html

* Configuration elements - binding
http://www.xmlmind.com/xmleditor/_distrib/doc/configure/binding.html

* Writing macro-commands
http://www.xmlmind.com/xmleditor/_distrib/doc/commands/writing_macros.html

* Command selectNode
http://www.xmlmind.com/xmleditor/_distrib/doc/commands/selectNode.html

* Command insertNode
http://www.xmlmind.com/xmleditor/_distrib/doc/commands/insertNode.html




> If not, it would be a great enhancement request.


 
--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support

Reply via email to