DnD DTD aware

Post here questions and problems related to oXygen frameworks/document types.
nhenel_sog
Posts: 13
Joined: Thu May 31, 2018 4:34 pm

DnD DTD aware

Post by nhenel_sog » 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 ?

Sincerely,
Nhenel

Radu
Posts: 7099
Joined: Fri Jul 09, 2004 5:18 pm

Re: DnD DTD aware

Post by Radu » 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)
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Post Reply