Contents
Index
Search

13. Specific keyboard shortcuts

The binding element allows to specify a binding which is specific to a given document type. A binding element binds a user input, for example a sequence of key strokes, to a command.

Excerpts from rng_section_config/common.incl (same file for all variants):

<property name="$c blockList">
  {http://www.xmlmind.com/ns/sect}paragraph=paragraph
</property>

<binding>
  <keyPressed code="ENTER" />1
  <command name="insertNewlineOrSplitBlock" />
</binding>

...

<binding>
  <keyPressed code="DELETE" />
  <command name="deleteSelectionOrJoinBlockOrDeleteChar" />
</binding>

<binding>
  <keyPressed code="BACK_SPACE" />
  <command name="deleteSelectionOrJoinBlockOrDeleteChar" 
           parameter="backwards" />
</binding>

...

<binding>
  <keyPressed code="ENTER" modifiers="shift" />2
  <command name="sect.insertBreak" />
</binding>

1

When a user presses the ENTER, DELETE, or BACK_SPACE key while the caret is found inside a paragraph element, we want XXE to behave like any word-processor. This is precisely what do commands insertNewlineOrSplitBlock in XMLmind XML Editor - Commands and deleteSelectionOrJoinBlockOrDeleteChar in XMLmind XML Editor - Commands. However for these commands to work, the elements behaving like paragraphs (or list items) must have been specified. For the "Simple Section" configuration, this specification is simply:

<property name="$c blockList">
  {http://www.xmlmind.com/ns/sect}paragraph=paragraph
</property>

Notice "$c blockList", which is a shorthand for "configuration_name blockList".

2

When the user presses Shift+ENTER, we want XXE to add a break element at caret location. Moreover, if the newly inserted break element is not immediately followed by a text node, we want XXE to automatically add a text node and move the caret to this new empty text node.