Create a single javascript action and collect the element that called it programmatically
Having trouble deploying Oxygen XML Web Author? Got a bug to report? Post it all here.
-
- Posts: 43
- Joined: Thu Feb 16, 2023 11:00 pm
Create a single javascript action and collect the element that called it programmatically
Good morning guys!
We are creating some Actions via Javascript that collect information from a WebService and insert a fragment into the XML that is being edited.
We created the Action in framework and linked it to the Content Completion Item configuration.
We realized that we are creating several Actions that are almost identical because we are linking each element to a specific action.
Is there a way to retrieve which element called the Action via Javascript?
With this we can create an action factory and create specific classes per element.
Another question... Is there any way to send a parameter via URL and collect this parameter via Javascript or Java?
Example:
//localhost:8008/oxygenxml-web-author/app/oxygen.html?url=webdav-http%3A%2F%2Fwebdav-dev-host.pub.com.br%2FName%2520Procedure%2520Data%2520Module.xml&project=OUR_PROJECT
We want to collect this project information.
We are creating some Actions via Javascript that collect information from a WebService and insert a fragment into the XML that is being edited.
We created the Action in framework and linked it to the Content Completion Item configuration.
We realized that we are creating several Actions that are almost identical because we are linking each element to a specific action.
Is there a way to retrieve which element called the Action via Javascript?
With this we can create an action factory and create specific classes per element.
image.png
image.png
Our idea is to create an "Insert CIR REF" action and connect each element to this single action and the action collects the element that called it and calls its respective action.Another question... Is there any way to send a parameter via URL and collect this parameter via Javascript or Java?
Example:
//localhost:8008/oxygenxml-web-author/app/oxygen.html?url=webdav-http%3A%2F%2Fwebdav-dev-host.pub.com.br%2FName%2520Procedure%2520Data%2520Module.xml&project=OUR_PROJECT
We want to collect this project information.
You do not have the required permissions to view the files attached to this post.
-
- Site Admin
- Posts: 233
- Joined: Wed Aug 30, 2023 2:33 pm
Re: Create a single javascript action and collect the element that called it programmatically
Hello,
Regarding the first question, you can use the getNodeAtCaret method [1]. In the future, if needed, you can refer to the Oxygen XML Web Author API Documentation [2].
Regarding the second question, you can obtain the URL using the documentation provided here [3] and then use URLSearchParams [4]
[1] https://www.oxygenxml.com/maven/com/oxy ... et__anchor
[2] https://www.oxygenxml.com/maven/com/oxy ... c0__anchor
[3] https://developer.mozilla.org/en-US/doc ... w/location
[4] https://developer.mozilla.org/en-US/doc ... archParams
Best Regards,
Cosmin
Regarding the first question, you can use the getNodeAtCaret method [1]. In the future, if needed, you can refer to the Oxygen XML Web Author API Documentation [2].
Regarding the second question, you can obtain the URL using the documentation provided here [3] and then use URLSearchParams [4]
[1] https://www.oxygenxml.com/maven/com/oxy ... et__anchor
[2] https://www.oxygenxml.com/maven/com/oxy ... c0__anchor
[3] https://developer.mozilla.org/en-US/doc ... w/location
[4] https://developer.mozilla.org/en-US/doc ... archParams
Best Regards,
Cosmin
Cosmin Eftenie
www.oxygenxml.com
www.oxygenxml.com
-
- Posts: 43
- Joined: Thu Feb 16, 2023 11:00 pm
Re: Create a single javascript action and collect the element that called it programmatically
Good afternoon cosminef!
The getNodeAtCaret() function is returning exactly the element where the cursor is, which is expected.
I would like to know if it is possible to identify which element was clicked on in Content Completion via a javascript action.
In this case I would like to identify the "accessPointRef" element within the javascript action that is registered and not the element that the cursor is on.
Thanks for the response about the URL, we are already testing what you indicated!
The getNodeAtCaret() function is returning exactly the element where the cursor is, which is expected.
I would like to know if it is possible to identify which element was clicked on in Content Completion via a javascript action.
image.png
image.png
In this case I would like to identify the "accessPointRef" element within the javascript action that is registered and not the element that the cursor is on.
Thanks for the response about the URL, we are already testing what you indicated!
You do not have the required permissions to view the files attached to this post.
-
- Posts: 515
- Joined: Wed May 20, 2009 2:40 pm
Re: Create a single javascript action and collect the element that called it programmatically
Hello,
From what I saw you created an action that replaces the element from content completion. This means that you execute some JAVA operation when the accessPointRef element is chosen from the content completion menu. Why do you want to know the element on the javascript side? It is not sufficient to know the element in the JAVA code (from the operation)?
Best Regards,
Mihaela
From what I saw you created an action that replaces the element from content completion. This means that you execute some JAVA operation when the accessPointRef element is chosen from the content completion menu. Why do you want to know the element on the javascript side? It is not sufficient to know the element in the JAVA code (from the operation)?
Best Regards,
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com
http://www.oxygenxml.com
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