DnD DTD aware

Post here questions and problems related to oXygen frameworks/document types.
Posts: 4

DnD DTD aware

Fri Jul 06, 2018 5:37 pm

Hi all,
I'm trying to make a Drag And Drop component.
I have a special view with drag and dropable elements, inserting xml fragment, an AuthorDndListener working fine and DTD.
But I don't found how check if my fragment is authorizzed in my DnD in the AuthorDndListener.authorDragOver method.
Could you help me again, please ?

Posts: 6054

Re: DnD DTD aware

Mon Jul 09, 2018 7:52 am

Hi Nhenel,

You can use an API like this:

Code: Select all

authorAccess.getDocumentController().getAuthorSchemaManager().canInsertDocumentFragment(fragment, offset, validationMode)
https://www.oxygenxml.com/InstData/Edit ... nager.html

The alternative would be to allow the drag over for any offset but when actually inserting the dropped XML fragment to insert it schema aware:

Code: Select all

ro.sync.ecss.extensions.api.AuthorDocumentController.insertFragmentSchemaAware(int, AuthorDocumentFragment)
meaning that the fragment may not be inserted exactly at the caret position, but in a position where it is allowed.

You can create an AuthorDocumentFragment from an XML string using this API:

Code: Select all

ro.sync.ecss.extensions.api.AuthorDocumentController.createNewDocumentFragmentInContext(String, int)
Radu Coravu
<oXygen/> XML Editor

Return to “SDK-API, Frameworks - Document Types”

Who is online

Users browsing this forum: No registered users and 0 guests