Page 1 of 1

surround with tag on cursor position

Posted: Tue Feb 28, 2023 9:06 am
by shikhar_472
Hi Team,

I want to perform the surround with tag on cursor position if cursor is on start of the word or end of the word or in between the word on action of bold i want to surround that word on selection of word its working fine but I want to surround the word on cursor position without selecting the word in XML web author view.

Thanks,
Shikhar.

Re: surround with tag on cursor position

Posted: Tue Feb 28, 2023 11:03 am
by mihaela
Hello,

Unfortunately, I do not understand what you are trying to obtain.
Can you please offer some context about your use case?
If you need our guidance in using the API you can specify some code that you already have (if it could be helpful), what did not work, and what exactly you need to obtain.

Best Regards,
Mihaela

Re: surround with tag on cursor position

Posted: Tue Feb 28, 2023 12:30 pm
by shikhar_472
Hi Team,

So i am using surroundwithfragment operation to make the text bold so i am able to make it when i am selecting the word and surrounding it with <bold></bold> tag.
Now i am have a scenario suppose word is Test and my cursor is start of the Test or end of the Test or in between the Test the moment i click on bold action Test should automatically wrap inside bold like <bold>Test</bold>. this is not working.

Thanks,
Shikhar.

Re: surround with tag on cursor position

Posted: Tue Feb 28, 2023 2:36 pm
by cristi_talau
Hello,

The surroundInFragment method is a low-level method that does not detect words to make bold.

If you want a more refined behavior you should use the following operation in your action ro.sync.ecss.extensions.commons.operations.ToggleSurroundWithElementOperation . If you sign up for the SDK access, you can also get the source code for this operation: https://www.oxygenxml.com/oxygen_sdk/do ... ource-code .

Best,
Cristian

Re: surround with tag on cursor position

Posted: Mon Mar 06, 2023 3:47 pm
by shikhar_472
Hi Cristian,

I want t use surroundInFragment feature along with toggle operation is that possible,
because if i am doing bold again using togglewithsurround operation it is unwrapping the element.

Thanks,
Shikhar.

Re: surround with tag on cursor position

Posted: Mon Mar 06, 2023 4:08 pm
by cristi_talau
Hello,
This means that you cannot use the ToggleSurroundWithElementOperation directly. However, you can still look at the source code and draw some inspiration from there to implement your own operation.
Best,
Cristian