Page 1 of 1

${caret}

Posted: Thu Oct 08, 2015 1:52 pm
by friedemann_bach
Dear Forum,

I am working on customizing the Author mode for working with text and an apparatus in TEI.

In a text fragment like this:

Code: Select all

Eine Folge der traurigen Wendung


I would like select the word "Folge", and then replace "Folge" by the following code with one action:

Code: Select all

Eine <app><lem>Folge</lem><rdg>Folge</rdg></app> der traurigen Wendung


So that the content of <lem> would be copied to <rdg>, just to make further editing a bit easier, because in many cases the difference is just one letter.

Furthermore, I would like the caret to appear within <rdg>, so that the editor can start typing right after inserting the lemma.

I tried a "SurroundWithFragmentOperation":

Code: Select all

<app xmlns="http://www.tei-c.org/ns/1.0"><lem/><rdg>${caret}${selection}</rdg></app>


The insertion works correctly, but the caret is not positioned. Can anyone help?

Re: ${caret}

Posted: Thu Oct 08, 2015 2:17 pm
by Radu
Hi,

The ro.sync.ecss.extensions.commons.operations.SurroundWithFragmentOperation operation will also try to select the originally selected text after the operation is done.
You should use the predefined ro.sync.ecss.extensions.commons.operations.InsertFragmentOperation operation instead. The ${selection} editor variable also works with it.

Regards,
Radu

Re: ${caret}

Posted: Thu Oct 08, 2015 3:06 pm
by friedemann_bach
Thank you very much! I didn't notice that difference.
Now it works perfectly. Nice!