How we can add schemaAware as true while unwrapping element
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 93
- Joined: Mon Aug 08, 2022 2:32 pm
How we can add schemaAware as true while unwrapping element
Post by SmitaPatil »
Hi Team.
I am using below function for unwrapping selected element or tag.
this.editor.getActionsManager().invokeOperation('ro.sync.ecss.extensions.commons.operations.UnwrapTagsOperation',{})
But, even if it document will be invalid after unwrapping in such case also its unwrapping.
Can you please tell how to add validation while calling this method?
Thanks & Regards,
Smita
I am using below function for unwrapping selected element or tag.
this.editor.getActionsManager().invokeOperation('ro.sync.ecss.extensions.commons.operations.UnwrapTagsOperation',{})
But, even if it document will be invalid after unwrapping in such case also its unwrapping.
Can you please tell how to add validation while calling this method?
Thanks & Regards,
Smita
-
- Site Admin
- Posts: 172
- Joined: Tue Mar 20, 2018 5:28 pm
Re: How we can add schemaAware as true while unwrapping element
Post by Bogdan Dumitru »
Hello Smita,
Define your own AuthorOperation and use the AuthorSchemaManager API to check if the element can be unwrapped.
To define a custom AuthorOperation simply extend the interface from a plugin. See the user-name-insert-operation-plugin sample plugin that does that.
To check if the element can be unwrapped, create a fragment over the wrapped content and then use the AuthorSchemaManager.canInsertDocumentFragment method to check if the fragment is allowed at the position of the element that wraps it (parent element's start offset).
Also, there seems to be a related topic. Was the solution from that topic proven wrong or did you have difficulties applying it?
Define your own AuthorOperation and use the AuthorSchemaManager API to check if the element can be unwrapped.
To define a custom AuthorOperation simply extend the interface from a plugin. See the user-name-insert-operation-plugin sample plugin that does that.
To check if the element can be unwrapped, create a fragment over the wrapped content and then use the AuthorSchemaManager.canInsertDocumentFragment method to check if the fragment is allowed at the position of the element that wraps it (parent element's start offset).
Also, there seems to be a related topic. Was the solution from that topic proven wrong or did you have difficulties applying it?
Bogdan Dumitru
http://www.oxygenxml.com
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service