Customizing insert element

Oxygen general issues.
sriram_l
Posts: 10
Joined: Wed Jun 06, 2018 4:59 pm

Customizing insert element

Post by sriram_l »

Hi,
I'm new to Oxygen XML web Author and we are evaluating for our application.
I've been using the forum and documentation to achieve part of the goal. 1. The first step is inserting element - in this the user should be proivded a text box to enter text and the element is inserted along with this text.2 After successful insertion edit/delete/save should be possible.

The first step is achieved by providing a toolbar icon with action that triggers a dialog and the event of this dialog is captured to insert into editor. Since I couldn't find any documentation, the DOM is manipulated using JavaScript to insert the new element. The problem is in Edit/Delete/Save. The newly inserted element is not saved in the XML and delete/edit throws error message due to a server call. On closer look it looks like for every change to the XML a REST call is made to the backend service.

What I would like to know is - what is the right procedure to follow in this, either a REST call should be invoked after DOM manipulation or a better way to insert XML is there that will take care of syncing backend and frontend or if customization is not possible at all.
cristi_talau
Posts: 494
Joined: Thu Sep 04, 2014 4:22 pm

Re: Customizing insert element

Post by cristi_talau »

Hello,

If you want to change the XML document form JS code, you should invoke an AuthorOperation like in the code below:

Code: Select all

this.editor.getActionsManager().invokeOperation(
'ro.sync.ecss.extensions.commons.operations.InsertFragmentOperation', {
fragment: '<xref href="' + text + '"/>'
}, callback);
We also have a tutorial with more details: https://www.oxygenxml.com/maven/com/oxy ... ction.html .

Best,
Cristian
EmmeTi
Posts: 2
Joined: Fri Dec 28, 2018 3:47 pm

Re: Customizing insert element

Post by EmmeTi »

It was almost impossible, but with your help I did it. Helped tutorial from YouTube, thank you! :D
Post Reply