Jeremy Quinn wrote:
> 
> I am trying to make a button to insert <br/> into my XML. I am using
> <br/> for the same meaning as in XHTML.
> 
> My css is thus:
> 
> br:before {
>    content: "\A";
>    color: olive;
> }
> 
> My button:
> 
> <button toolTip="Insert line break" icon="../icons/br.gif">
>    <command name="insert"
>         parameter="into {http://www.xmlmind.com/xmleditor/schema/iniva}br"; />
> </button>
> 
> The button works .... but leaves you in a state where you cannot
> continue typing, or move the insertion point to the new line.
> 
> I found the only way to make it work, was be in the middle of some
> #text when you clicked the button.
> 
> So, for instance, if you are at the end of a line, you press 'space',
> 'back-arrow', then click the line-break button, you are fine.
> 
> Is it possible to make a command that inserts the <br/> and
> automatically moves the insertion point to the new line?

I think this will work in the middle of a #text as well as at the ``end
of a line'' (because it creates a #text after the newly inserted <br> --
the new line -- if needed to).

I have tested this with XHTML, please adapt it to your XML-Schema:

  <button toolTip="Insert Line Break" icon="../icons/br.gif">
    <command name="insertLineBreak" />
  </button>

  <command name="insertLineBreak">
    <macro>
      <sequence>
        <command name="insert" parameter="into br" />
        <command name="insert" parameter="after #text" />
      </sequence>
    </macro>
  </command>

PS: Note that even without your button, hitting the key Insert of the
keypad adds a #text after the implicitly or explicitly selected element
so you can continue typing. See
http://www.xmlmind.com/xmleditor/_distrib/docs/user/userguide4.html#id.s4

Reply via email to