surround with tag on cursor position

Questions about XML that are not covered by the other forums should go here.
shikhar_472
Posts: 99
Joined: Fri Jul 01, 2022 12:08 pm

surround with tag on cursor position

Post 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.
mihaela
Posts: 490
Joined: Wed May 20, 2009 2:40 pm

Re: surround with tag on cursor position

Post 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
Mihaela Calotescu
http://www.oxygenxml.com
shikhar_472
Posts: 99
Joined: Fri Jul 01, 2022 12:08 pm

Re: surround with tag on cursor position

Post 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.
cristi_talau
Posts: 496
Joined: Thu Sep 04, 2014 4:22 pm

Re: surround with tag on cursor position

Post 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
shikhar_472
Posts: 99
Joined: Fri Jul 01, 2022 12:08 pm

Re: surround with tag on cursor position

Post 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.
cristi_talau
Posts: 496
Joined: Thu Sep 04, 2014 4:22 pm

Re: surround with tag on cursor position

Post 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
Post Reply