cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

drag and drop of xinclude interception

ptc-5681790
1-Visitor

drag and drop of xinclude interception

When users select an xinclude fragment in one document and then perform a drag and drop to a second document, Arbortext creates an xinclude in the second document, but the file path in this new xinclude is absolute. I need all xincludes to be relative paths. How do I intercept the drop and manipulate the xinclude filename?

4 REPLIES 4

Hi Steve--

Drag and drop is really just a special kind of "paste" operation, so the "paste" callback for doc_add_callback() is what you will want to use.

The documentation includes info on how to determine if the paste is the result of a drag and drop operation, by checking the name of the paste buffer. Once you determine that you can check whether it's an xinclude, and if so do any href fixup you need.

--Clay

Thanks, Clay.


The drag and drop was a red herring anyway. It's any cut/copy/past of an xinclude. I tried the paste buffer, but the contents are the underlying xml markup pointed to by the xinclude, so i can't manipulate the file string. If I look at $main::selection, it is the raw xinclude markup.


Any thoughts?

Hi Steve--

In that case, I'd try something along these lines:


1) On paste, select the buffer content and check $main::selection. If it's xinclude markup, then

a. copy $main::selection to a variable and fixup the href value

b. goto the paste target and insert the fixed up markup string

c. cancel the paste operation

--Clay

I forgot the flag to include the start tag, which when 1 gives the xinclude markup. Seems odd behavior, but I'll take it.

Announcements

Top Tags