Copy markup in author mode

Having trouble installing Oxygen? Got a bug to report? Post it all here.
steve.cuzner
Posts: 72
Joined: Thu Mar 26, 2015 4:57 pm

Copy markup in author mode

Post by steve.cuzner »

If I select a tag, e.g., <foo>text</foo>, and copy using ctrl+c or the menu items, then paste to another application, all that is pasted is "text" Is there setting or a special copy mode that includes markup into the paste buffer?
Radu
Posts: 9470
Joined: Fri Jul 09, 2004 5:18 pm

Re: Copy markup in author mode

Post by Radu »

Hi Steve,

Indeed the copy operation in the Author visual editing mode sets in the clipboard only the text content, with line breaks separating paragraphs.
We have an issue registered to add a special copy operation and I will add your feedback on it.
So right now you can either copy the content in the Text editing mode or maybe create a custom Author action.
For example the Javascript code to copy the XML content of the selection in the Author using a JSOperation should look something like:

Code: Select all

    if(authorAccess.getEditorAccess().hasSelection()){
frag = authorAccess.getDocumentController().createDocumentFragment(authorAccess.getEditorAccess().getSelectionStart(), authorAccess.getEditorAccess().getSelectionEnd() - 1);
xmlContent = authorAccess.getDocumentController().serializeFragmentToXML(frag);
Packages.java.awt.Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new Packages.java.awt.datatransfer.StringSelection(xmlContent), null);
}
Based on discussions with users who use JSOperations I created a GitHub repository which contains sample operations for doing various things, I updated the repository to contain also a sample for copy XML to clipboard:

https://github.com/oxygenxml/javascript ... operations

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Radu
Posts: 9470
Joined: Fri Jul 09, 2004 5:18 pm

Re: Copy markup in author mode

Post by Radu »

Hi,

We released Oxygen 23 which added in the main menu "Document->Edit" a "Copy as XML" action.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply