Keystroke shortcuts in Author View

Are you missing a feature? Request it's implementation here.
stephen.perkins
Posts: 6
Joined: Wed Aug 06, 2014 7:46 pm
Contact:

Keystroke shortcuts in Author View

Post by stephen.perkins » Mon Sep 08, 2014 11:17 pm

Pardon if I was unable to locate this in searching the documentation: Are there keyboard shortcuts for moving to the beginning or end of an element in Author View as there are in Text View? (ctrl+[ / ctrl+]) These and perhaps others would be handy.

Related question: Is my assumption it is possible to create a custom operation to move the cursor to specified point correct? E.g. move to opening tag for parent::note[1].
Cheers,
Stephen

Stephen Perkins
Infoset Digital Publishing
stephen@infoset.io
http://www.infoset.io

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

Re: Keystroke shortcuts in Author View

Post by Radu » Tue Sep 09, 2014 9:49 am

Hi Stephen,
Are there keyboard shortcuts for moving to the beginning or end of an element in Author View as there are in Text View? (ctrl+[ / ctrl+]) These and perhaps others would be handy.
The somewhat equivalent actions in the Author view for moving to the beginning of an element would be TAB and SHIFT-TAB.
Related question: Is my assumption it is possible to create a custom operation to move the cursor to specified point correct? E.g. move to opening tag for parent::note[1].
Yes, you have lots of API available so you could also implement this as custom Author operations.
Some sample code:

Code: Select all

 /**
* @see ro.sync.ecss.extensions.api.AuthorOperation#doOperation(ro.sync.ecss.extensions.api.AuthorAccess, ro.sync.ecss.extensions.api.ArgumentsMap)
*/
@Override
public void doOperation(AuthorAccess authorAccess, ArgumentsMap args)
throws IllegalArgumentException, AuthorOperationException {
try {
AuthorNode nodeAtOffset = authorAccess.getDocumentController().getNodeAtOffset(authorAccess.getEditorAccess().getCaretOffset());
//Move after the node.
authorAccess.getEditorAccess().setCaretPosition(nodeAtOffset.getEndOffset() + 1);
//Or move before it
authorAccess.getEditorAccess().setCaretPosition(nodeAtOffset.getStartOffset());
//Or get the parent node
AuthorNode parentNode = nodeAtOffset.getParent();
//and move at the beginning of the parent node
authorAccess.getEditorAccess().setCaretPosition(parentNode.getStartOffset() + 1);
} catch (BadLocationException e) {
e.printStackTrace();
}
}
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Post Reply