Auto-insertion of p in entry when new table is inserted - WEB AUTHOR

mu258770
Posts: 105

Auto-insertion of p in entry when new table is inserted - WEB AUTHOR

Fri Jan 12, 2018 6:25 pm

Hi team,

This is also regarding oXygen 19.1 Web Author customization.

When I insert a CALS table using toolbar icon, I should be able to get <entry> element with <p> inside. ie I want to add content inside <p> only, not directly in <entry>. Currently I will get table with <entry> elements only. I have configured cc_config.xml to get <p> element when we insert a new <entry> using content completion. But this will work only if I insert a new <entry> using content completion.

In the eclipse client, we made it work by using dita.framework. Same change does not work here.

Could you please let me know how we can make it work in the oXygen Web Author 19.1.

Regards,
Shabeer
mihaela
Posts: 183

Re: Auto-insertion of p in entry when new table is inserted - WEB AUTHOR

Mon Jan 15, 2018 6:22 pm

Hi Shabeer,

What you can do is to create a custom insert table operation[1] that inserts the entry elements with paragraph inside.
A second possibility is to create a plugin [2] for Web Author where you can set an ro.sync.ecss.extensions.api.AuthorDocumentFilter [3] to modify all the empty entry elements inserted in the document, to include a paragraph.

[1] Creating and Embedding a Custom Action in the Web Author Interface
[2] Customizing Web Author with Plugins
[3] AuthorDocumentFilter documentation

Best Regards,
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com
cristi_talau
Posts: 141

Re: Auto-insertion of p in entry when new table is inserted - WEB AUTHOR

Thu Feb 01, 2018 11:04 am

Hello,

Another alternative is to extend the DITA framework [1], and create a new version of InsertTableOperation[2] that also inserts a paragraph inside each cell. The code sample can be found below

Code: Select all

import ro.sync.ecss.extensions.api.ArgumentsMap;
import ro.sync.ecss.extensions.api.AuthorAccess;
import ro.sync.ecss.extensions.api.AuthorOperationException;
import ro.sync.ecss.extensions.api.WebappCompatible;
import ro.sync.ecss.extensions.api.webapp.WebappRestSafe;

@WebappCompatible(false)
@WebappRestSafe
public class MyInsertTableOperation extends InsertTableOperation {
  @Override
  public void doOperation(AuthorAccess authorAccess, ArgumentsMap args)
      throws AuthorOperationException {
   
    ArgumentsMap args2 = new ArgumentsMap() {
     
      @Override
      public Object getArgumentValue(String argumentName) {
        if (argumentName.equals(CELL_FRAGMENT_ARGUMENT_NAME)) {
          return "<p/>";
        }
        return args.getArgumentValue(argumentName);
      }
    };
    super.doOperation(authorAccess, args2);
  }
}


Then, in the "web/framework.js" file of the DITA framework you can replace "ro.sync.ecss.extensions.dita.topic.table.InsertTableOperation" with the fully qualified name of your operation.

Best,
Cristian

[1] https://www.oxygenxml.com/doc/versions/ ... aring.html
[2] https://www.oxygenxml.com/doc/versions/ ... a-api.html

Return to “DITA (Editing and Publishing DITA Content)”

Who is online

Users browsing this forum: No registered users and 2 guests