Edit online

FAQ for Customizations

This topic contains some frequently asked questions about Web Author customizations.

How can I prevent consecutive spaces from being inserted in documents?

  1. Create a plugin that implements the AuthorDocumentFilter class. It filters consecutive spaces from being inserted in the document. The filter should override all methods from AuthorDocumentFilter that intercept content changes.
  2. Install the custom filter on all documents by implementing a WebappEditingSessionLifecycleListener that can be installed via a WorkspaceAccessPluginExtension (WorkspaceAccess extension in the plugin.xml file):
    public class CustomFilterInstaller implements WorkspaceAccessPluginExtension {
      @Override
      public void applicationStarted(StandalonePluginWorkspace pluginWorkspaceAccess) {
        WebappPluginWorkspace pluginWorkspace = (WebappPluginWorkspace)PluginWorkspaceProvider.getPluginWorkspace();
          pluginWorkspace.addEditingSessionLifecycleListener(new WebappEditingSessionLifecycleListener() {
            @Override
            public void editingSessionStarted(String sessionId, AuthorDocumentModel documentModel) {
              documentModel.getAuthorDocumentController().setDocumentFilter(new CustomAuthorDocumentFilter(documentModel));
            }
          });
Note: When instantiating the AuthorDocumentFilter, the AuthorDocumentModel object is passed because the filter needs it to check for duplicate spaces.

How can I customize the inserted table fragment for a DITA framework extension?

See the dita-extension-replace-insert-table-action sample project that uses a Framework Extension Script (EXF) to extend the built-in DITA framework to replace the default Insert Table action with another action that uses an InsertFragmentOperation to insert a CALS table element that has @frame, @colsep, and @rowsep attributes already set.

How can I target a specific font size in CSS, using a custom framework?

Suppose you want to modify a custom framework so that when a user selects a specific font size (small, medium, large) in Preferences, the font size selected is applied to the document.

To achieve this, it is recommended to use em units (instead of px, for example). This causes the font size to be adjusted according to the option chosen by the user in Preferences.