Cursor position after xinclude insertion
Are you missing a feature? Request its implementation here.
-
- Posts: 398
- Joined: Mon May 09, 2016 9:37 am
Re: Cursor position after xinclude insertion
Post by sorin_carbunaru »
Hi Kim,
How do you insert the "xi:include"? From the toolbar action?
And why do you want the cursor to be at the end? Is it to be able to insert one "xi:include" after the other?
One reason for having the cursor inside the element is to easily insert an "xi:fallback", which provides a mechanism for recovering from missing resources.
Best wishes,
Sorin Carbunaru
oXygen xML
How do you insert the "xi:include"? From the toolbar action?
And why do you want the cursor to be at the end? Is it to be able to insert one "xi:include" after the other?
One reason for having the cursor inside the element is to easily insert an "xi:fallback", which provides a mechanism for recovering from missing resources.
Best wishes,
Sorin Carbunaru
oXygen xML
Re: Cursor position after xinclude insertion
Hi, Sorin.
Apologies for the long delay in my response!
We have a customized menu option to insert xincludes (which inserts the fallback, too). No, it is not able to insert one after another until you move the cursor outside the closing xinclude tag.
We'd like the cursor to be at the end so that we could either insert multiple xincludes in a row or keep tying without having to manually click to place the cursor outside the closing tag.
I do appreciate the 'adding a fallback' use case, but perhaps, since we include a fallback when we insert the xinclude, this is something that we could configure?
Best,
Kim
Apologies for the long delay in my response!
We have a customized menu option to insert xincludes (which inserts the fallback, too). No, it is not able to insert one after another until you move the cursor outside the closing xinclude tag.
We'd like the cursor to be at the end so that we could either insert multiple xincludes in a row or keep tying without having to manually click to place the cursor outside the closing tag.
I do appreciate the 'adding a fallback' use case, but perhaps, since we include a fallback when we insert the xinclude, this is something that we could configure?
Best,
Kim
-
- Posts: 398
- Joined: Mon May 09, 2016 9:37 am
Re: Cursor position after xinclude insertion
Post by sorin_carbunaru »
Hello Kim,
What you can do is to create a new Author action in your framework over ExecuteMultipleActionsOperation (see https://www.oxygenxml.com/doc/versions/ ... ialog.html and https://www.oxygenxml.com/InstData/Edit ... ation.html), action which first calls your custom xi:include-inserting action and then invokes another Author action that moves the caret after the inserted xi:include element. For the second framework action, you could use for example JSOperation (see https://www.oxygenxml.com/InstData/Edit ... ation.html). The script would be something like this:
Best wishes,
Sorin C.
What you can do is to create a new Author action in your framework over ExecuteMultipleActionsOperation (see https://www.oxygenxml.com/doc/versions/ ... ialog.html and https://www.oxygenxml.com/InstData/Edit ... ation.html), action which first calls your custom xi:include-inserting action and then invokes another Author action that moves the caret after the inserted xi:include element. For the second framework action, you could use for example JSOperation (see https://www.oxygenxml.com/InstData/Edit ... ation.html). The script would be something like this:
Code: Select all
function doOperation() {
var caretOffset = authorAccess.getEditorAccess().getCaretOffset();
var currentNode = authorAccess.getDocumentController().getNodeAtOffset(caretOffset);
// Find the xi:include element, starting from the cursor position, by going up in the ancestors hierarchy
var xiincludeNode = null;
while (currentNode != null) {
if ("xi:include".equals(currentNode.getName()) && "http://www.w3.org/2001/XInclude".equals(currentNode.getNamespace())) {
xiincludeNode = currentNode;
break;
}
currentNode = currentNode.getParent();
}
if (xiincludeNode != null) {
// Move after the xi:include element
authorAccess.getEditorAccess().setCaretPosition(xiincludeNode.getEndOffset() + 1);
}
}
Sorin C.
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service