Customizing insert element

<oXygen/> general issues.
sriram_l
Posts: 3

Customizing insert element

Thu Jun 07, 2018 5:27 pm

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: 152

Re: Customizing insert element

Thu Jun 07, 2018 6:30 pm

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

Return to “Other Issues”

Who is online

Users browsing this forum: No registered users and 1 guest