Content Completion Assistant Shows Different Results Between Desktop and Web

<oXygen/> general issues.
john_m
Posts: 32

Content Completion Assistant Shows Different Results Between Desktop and Web

Wed May 10, 2017 12:22 am

Hello!

My teammate and I are using Oxygen XML Editor to frame-out an environment we are deploying to the web using Oxygen XML Web Author.

We have had great success using the content completion assistant to insert tags in the Oxygen XML Editor environment on our desktops. However, when we deploy our files to the web for testing and troubleshooting we get vastly different results.

Can you please tell me how to customize the content completion assistant options for the web? If that is not an option, is there a way to disable the feature?

Thank you so much!
John
cristi_talau
Posts: 168

Re: Content Completion Assistant Shows Different Results Between Desktop and Web

Wed May 10, 2017 9:09 am

Hello,

There are several ways to customize the content-completion assistant:

Customizing using the preferences dialog

You can go to the Options > Preferences dialog, choose Document Type Associations, edit the framework for your document type (you should not edit the builtin framework, but extend it [1]). Go to the Author tab and Content Completion sub-tab.

In this dialog you can either specify
- elements to remove from the content completion assistant
- actions to be added to the content completion menu

Customizing using the cc_config.xml file

You can find more details in our user-guide [2].

Changing the shortcut for the content completion assistant

You can disable the content completion assistant when the "Enter" key is pressed, and change it to "Ctrl+Space". This customization can be done by using the JS API loaded from a plugin or framework [3]:

Code: Select all

// If 'splitOnEnter' url parameter is set to 'true', the split is executed automatically when pressing 'Enter'.
 // In this case the content completion window can be accessed when pressing 'CTRL + Enter'.   
(function() {
  var splitOnEnter =  decodeURIComponent(sync.util.getURLParameter("splitOnEnter"));
  if (splitOnEnter === 'true') {
    goog.events.listen(workspace, sync.api.Workspace.EventType.EDITOR_LOADED, function(e) {
      var actionsManager = e.editor.getActionsManager();
   
      // Change the shortcut of "Enter" action to ctrl enter
      actionsManager.setActionShortcut('Author/Enter', 'ctrl enter');
   
      // Create "Split Element" action
      var splitElementAction = new sync.actions.SplitElementAtCaretAction('enter', e.editor.readOnlyStatus, e.editor.controller);
      // Create compound action that splits the element at cursor when there is no selection, and surrounds the selection
      // with the element chosen by the user otherwise
      var newEnterAction = new sync.actions.CompoundAction('enter',
        splitElementAction, actionsManager.getActionById('Author/SurroundWithElement'));
      // Register the new action to be executed on enter
      actionsManager.registerAction('Author/SplitOnEnter', newEnterAction);
    });

    /**
     * Action that splits the element at caret.
     *
     * @param {sync.model.ReadOnlyStatus} readOnlyStatus The read-only status of the document.
     * @param {string} keystrokeStr The string representation of the shortcut of the action.
     * @param {sync.ctrl.Controller} controller The document controller.
     * @constructor
     */
    sync.actions.SplitElementAtCaretAction = function(keystroke, readOnlyStatus, controller) {
      sync.actions.AbstractAction.call(this, keystroke);
      this.readOnlyStatus = readOnlyStatus;
      this.controller = controller;
    };
    goog.inherits(sync.actions.SplitElementAtCaretAction, sync.actions.AbstractAction);

    /**
     * The actual action execution.
     *
     * @param {function} callback The method to call after the action has completed.
     */
    sync.actions.SplitElementAtCaretAction.prototype.actionPerformed = function(opt_callback) {
      var params = { docId: this.controller.docId };
      sync.select.getSelection().extend(params);
      var controller = this.controller;
      RESTContentCompletionManager.splitElement(sync.util.extend(params, {
        $callback: function (httpCode, xmlHttpRequest, newDocumentUpdate) {
          try {
            controller.applyUpdate_(newDocumentUpdate);
          } finally {
            if (typeof opt_callback === 'function') {
              opt_callback();
            }
          }
        }
      }));
    };

    /** @override */
    sync.actions.SplitElementAtCaretAction.prototype.isEnabled = function() {
      return !this.readOnlyStatus.isReadOnly();
    };
  }
})();


If you are trying one of these options some additional information would help:
1. What Web Author version are you using? Some of the features are available only in 19.0.
2. What distribution are you using and how are you deploying the framework? The safest way is to use the Admin Page to deploy the framework.

I also wanted to point out that during development it may help you to use the Web Author Test Server [4].

Best,
Cristian

[1] https://www.oxygenxml.com/doc/versions/ ... aring.html
[2] https://www.oxygenxml.com/doc/versions/ ... ually.html
[3] https://www.oxygenxml.com/doc/versions/ ... works.html
[4] https://www.oxygenxml.com/oxygen_webapp_add_on.html
john_m
Posts: 32

Re: Content Completion Assistant Shows Different Results Between Desktop and Web

Thu May 11, 2017 11:40 pm

Thanks Christian! This is exactly what we needed!

Return to “Other Issues”

Who is online

Users browsing this forum: No registered users and 1 guest