Page 1 of 1

Customizing insert element

Posted: Thu Jun 07, 2018 5:27 pm
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.

Re: Customizing insert element

Posted: Thu Jun 07, 2018 6:30 pm
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

Re: Customizing insert element

Posted: Fri Dec 28, 2018 4:14 pm
by EmmeTi
It was almost impossible, but with your help I did it. Helped tutorial from YouTube, thank you! :D