Page 1 of 1

oxygen 11.1 author mode, enter button

Posted: Wed Feb 24, 2010 7:26 pm
In oxygen editor, Author mode,

when we are entering a text and press enter, oxygen asks us a dialog "what would be next tag to put on?".

is there a way to disable this feather and by default enter the same tag as they are working on.


Re: oxygen 11.1 author mode, enter button

Posted: Thu Feb 25, 2010 10:42 am
by Radu
Hi Guna,

You can create a new Author action and assign "ENTER" as its keyboard shortcut. That action can then call a custom operation implemented by you. In this way you will have full control on what happens when you hit ENTER.


Re: oxygen 11.1 author mode, enter button

Posted: Tue Mar 23, 2010 4:46 pm
i have more question in the same context.

say i have list item like below

<list-item> Ebsco Publishing <b><i><u> The Best company to work with X (1)</u></i><b> all around the world</list-item>

if user keeps the mouse between with X and press enter, is there an api in oxygen to close all pending tags in the context and start a new open tags for corresponding end tags.

Re: oxygen 11.1 author mode, enter button

Posted: Tue Mar 23, 2010 5:12 pm
by Radu

There are a lot of pending tags in the context, even the root tag is pending. I will assume you want to split all tags until the list-item.
Something like:

Code: Select all

* @see ro.sync.ecss.extensions.api.AuthorOperation#doOperation(ro.sync.ecss.extensions.api.AuthorAccess, ro.sync.ecss.extensions.api.ArgumentsMap)
public void doOperation(AuthorAccess authorAccess, ArgumentsMap args)
throws IllegalArgumentException, AuthorOperationException {
AuthorDocumentController docController = authorAccess.getDocumentController();
try {
AuthorNode toSplit = null;
AuthorNode nodeAtOffset = docController.getNodeAtOffset(authorAccess.getEditorAccess().getCaretOffset());
while(nodeAtOffset != null && !nodeAtOffset.getName().equals("list-item")) {
toSplit = nodeAtOffset;
nodeAtOffset = nodeAtOffset.getParent();
//In your case, toSplit should be <b>
if(toSplit != null) {
//The created fragment will be auto-equilibrated with the start tags.
AuthorDocumentFragment newFragment = docController.createDocumentFragment(authorAccess.getEditorAccess().getCaretOffset(), toSplit.getEndOffset() + 1);
//Delete content after the caret position.
docController.delete(authorAccess.getEditorAccess().getCaretOffset(), toSplit.getEndOffset() + 1);
//Insert the fragment after the <b>
docController.insertFragment(toSplit.getEndOffset() + 1, newFragment);
} catch (BadLocationException e) {
} finally {

Re: oxygen 11.1 author mode, enter button

Posted: Thu May 02, 2019 7:27 pm
by chrispitude
Waking up an old thread!

FrameMaker has two tag insertion behaviors that I would love to get in Oxygen:
  • When the cursor is at a position where only a single element is valid to be inserted, pressing ENTER inserts that element.
  • When the cursor is inside a block element that contains text and it's valid for the current element to be followed by another element of the same kind, pressing ENTER inserts another element after the current one.
    • If the cursor is at the end of the current element, the new element is empty.
    • If the cursor is in the middle of the current element, that element is bisected into two elements.
    If the cursor context does not match these two rules, then the New Element dialog pops up.

    How can I implement these behaviors in Oxygen? I looked at the code in the previous message, but I haven't the slightest clue how to understand or modify it.

Re: oxygen 11.1 author mode, enter button

Posted: Fri May 03, 2019 1:49 am
by Radu
Hi Chris,

In the Oxygen Preferences->"Editor / Edit Modes / Author / Schema-Aware" page there is a checkbox called "Press Enter to show available content completion proposals". Unchecking it should mostly do what you want, automatically insert the best possible match. But the content completion window will not be shown anymore. You will still be able to show it on demand using the "Ctrl-Space" keyboard shortcut.
In my opinion you might still at some point get accustomed with the way Oxygen does this by default. For example there are lots of possible inline elements in a paragraph. Pressing ENTER and choosing the element to insert is quite easy to do. Also pressing Enter twice will always get you the behavior of splitting the paragraph.
As you see in this older thread if you want indeed you can take control of what happens when ENTER is pressed but it would take some development effort and working with our Java SDK plus you might need to re-implement our list of elements chooser using our API. So this is not something trivial.