Uploaded image for project: '{RETIRED} CKEditor Integration'
  1. {RETIRED} CKEditor Integration
  2. CKEDITOR-404

CKEditor Velocity macros are not namespaced and thus can overwrite standard macros

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 1.55
    • 1.54
    • None
    • None
    • Unknown

    Description

      The problem can be reproduced with this code:

      {{template name="display_macros.vm" /}}
      
      {{velocity}}
      {{html clean="false"}}
      #initRequiredSkinExtensions()
      $services.edit.syntaxContent.wysiwyg(
        'one **two** three',
        $services.rendering.resolveSyntax('xwiki/2.1'),
        {
          'id': 'description',
          'name': 'description',
          'rows': 25,
          'cols': 80
        }
      )
      #getRequiredSkinExtensions($requiredSkinExtensions)
      #set ($discard = $response.setHeader('X-XWIKI-HTML-HEAD', $requiredSkinExtensions))
      {{/html}}
      {{/velocity}}
      

      If you check the response headers you'll see that the custom X-XWIKI-HTML-HEAD header is not set because the getRequiredSkinExtensions Velocity macro is overwritten by CKEditor.VelocityMacros, changing its behavior.

      Ideally the edit module should isolate the Velocity namespace so that any macros defined by the rendered editor don't leak outside (are not accessible after the editor is rendered), but this is not easy to implement due to the way Velocity namespaces are implemented (only two levels, root and named, without support for inheritance). ATM a Velocity namespace is created and associated to each XWiki document. In our case we want to keep the current document but use a new namespace rather than the one already associated/created.

      Attachments

        Issue Links

          Activity

            People

              mflorea Marius Dumitru Florea
              mflorea Marius Dumitru Florea
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: