surroundFragmentOperation with schemaaware flag set to true is not working as expected.

Having trouble deploying Oxygen XML Web Author? Got a bug to report? Post it all here.
shikhar_472
Posts: 5
Joined: Fri Jul 01, 2022 12:08 pm

surroundFragmentOperation with schemaaware flag set to true is not working as expected.

Post by shikhar_472 »

Hi Oxygen Team,

We found the issue with surroundFragmentOperation with schemaaware flag set to true, below is the scenario-
Valid xml as per the xsd would look like

<document>
<title>
<format>
<bold></bold>
<italic></italic>
<underline></underline>
</format>
</title>
</document>
in our example xml looks like below-
<document>
<title>
<bold></bold>
<italic></italic>
<underline></underline>
</title>
</document>

Here our user selects content/xml-elements inside <title> and invokes format operation and we are using surroundFragmentOperation to wrap selected content within the format tag.
But when users selects entire <title> tag including the tag boundaries and invokes format operation we observed the <title> tag itself being wrapped inside <format> tag,
which is not valid as per schema.
surroundFragmentOperation should be able to identify that this is not a valid operation and throw error.
Can you please help us on this scenario.

We are calling surroundFragmentOperation within a plugin like below.


this.editor.getActionsManager().invokeOperation(
'ro.sync.ecss.extensions.commons.operations.SurroundWithFragmentOperation', {
fragment: '<format xmlns="http://www.example.com/article"></format>',
schemaAware: 'true'
});

Thanks,
Shikhar.
mihaela
Posts: 314
Joined: Wed May 20, 2009 2:40 pm

Re: surroundFragmentOperation with schemaaware flag set to true is not working as expected.

Post by mihaela »

Hi,

The schemaAware argument of the SurroundWithFragmentOperation applies only when there is no selection in the document (in this case the fragment is inserted at caret position).
If there is a selection in the document, the schemaAware argument is not taken into account:
https://www.oxygenxml.com/InstData/Edit ... ation.html

Best Regards,
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com
Post Reply