Page 1 of 1
Copy markup in author mode
Posted: Mon Oct 03, 2016 10:39 pm
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?
Re: Copy markup in author mode
Posted: Tue Oct 04, 2016 8:39 am
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
Re: Copy markup in author mode
Posted: Fri Nov 20, 2020 1:37 pm
by Radu
Hi,
We released Oxygen 23 which added in the main menu "Document->Edit" a "Copy as XML" action.
Regards,
Radu