Skip to main content
1-Visitor
July 31, 2013
Question

copy, cut, and paste callback question: what callbacks capture drag-ctrl-drop to copy?

  • July 31, 2013
  • 2 replies
  • 699 views
Hiya,

I have copy, cut, and paste callbacks defined. I am successfully capturing
all of the use-cases me and my testers have been able to think of except
one.

I can't capture the "paste" called when dragging, pressing Control, and
dropping content. My copy callback fires. My paste callback does not.

(There is some chance I am wrong about paste not firing ... maybe it's
copy. Using response() to debug program flow appears to affect buffers in
some situations ... but I *think* it's the paste callback that isn't
behaving.)

Anyhow, has anyone worked through this sort of malarky before? Got any tips?

--
Paul Nagai

    2 replies

    1-Visitor
    August 2, 2013

    Paul,



    We have had extensive cut/copy/paste, callback based, adjustments to the editor in place for years.Our paste callback does indeed fire for the Ctrl drag and drop scenario that I believe you were asking about.



    As an attempt to address your question, I'll share the following:



    Our callback definitions for copy & paste are the following which are probably the same approach as you have in place:




    • doc_add_callback(current_doc() , "copy","xisCutCopyPaste::xisCopyCallBack");

    • doc_add_callback(current_doc() , "paste","xisCutCopyPaste::xisPasteCallBack");


    At the front of our callbacks, we have the following evals that we uncomment when we want to monitor the activity of the callback:



    • eval "xisCopyCallBack:doc=" . $doc .", buffername=" . $buffername .", op=" . $op .", doc_kind=" . doc_kind($doc) output=>*;

    • eval "xisCutCopyPaste::xisPasteCallBack:doc=" . $doc .", buffername=" . $buffername .", op=" . $op .", doc_kind=" . doc_kind($doc) output=>*;


    Those evals just shoot their message into an editor eval window which is less disruptive to the excution flow of the editor than using a response command.So, perhaps it is your use of the respone command that might be masking notification of the paste callback being invoked.



    Testing over the years has shown that even the above evals outputing to a window can be too disruptive to allow you to see accurately what the sequence of activity is. For cases like that, we resort to an approach like that shown here below to output messages into a file which can be reviewed after the test scenario os over:






    Hopefullly, you'll find this helpful.



    Bob Beetcher

    naglists1-VisitorAuthor
    1-Visitor
    August 2, 2013
    Thanks, Bob. I use eval sometimes, too. I'm not sure why, but I don't like
    to. Probably just an old, bad habit. Anyhow, thanks for confirming, at
    least, that I should expect that paste callback to fire