Insert at carret position

Having trouble deploying Oxygen XML Web Author? Got a bug to report? Post it all here.
ArthurP
Posts: 22
Joined: Mon Dec 11, 2023 3:10 pm

Insert at carret position

Post by ArthurP »

Hi,

we are implementing a side view to reproduce Desktop "Reusable Component view". In this view, an user can choose to insert a reference (xref @conref/@keyref) in the content. We use the insert action "ro.sync.ecss.extensions.commons.operations.InsertFragmentOperation" to achieve this goal. It works successfully but we would like to insert at carret position. After looking at documentation (https://www.oxygenxml.com/doc/versions/ ... ments.html), it doesn't seem possible.

Do you have a suggestion or workaround to help us ?

Regards,
arthur
cosminef
Site Admin
Posts: 233
Joined: Wed Aug 30, 2023 2:33 pm

Re: Insert at carret position

Post by cosminef »

Hello,

To successfully insert the fragment at the caret position in the "ro.sync.ecss.extensions.commons.operations.InsertFragmentOperation" operation, you can omit the insertLocation and insertPosition arguments.

You can test this use case, for example, in the browser console with an open document, using the following code snippet:

Code: Select all

workspace.currentEditor.getEditingSupport().getActionsManager().invokeOperation(
    "ro.sync.ecss.extensions.commons.operations.InsertFragmentOperation",
    {
        fragment: "test"
    }
);
Best,
Cosmin
Cosmin Eftenie
www.oxygenxml.com
ArthurP
Posts: 22
Joined: Mon Dec 11, 2023 3:10 pm

Re: Insert at carret position

Post by ArthurP »

Hello Cosmin,

Thanks, it works ! Easy solution :)

Regards
Post Reply