${caret}

friedemann_bach
Posts: 46

${caret}

Thu Oct 08, 2015 1:52 pm

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?
Radu
Posts: 5088

Re: ${caret}

Thu Oct 08, 2015 2:17 pm

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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
friedemann_bach
Posts: 46

Re: ${caret}

Thu Oct 08, 2015 3:06 pm

Thank you very much! I didn't notice that difference.
Now it works perfectly. Nice!

Return to “TEI”

Who is online

Users browsing this forum: No registered users and 0 guests