Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-19503

Wiki toolbar breaks the html macro when using displayEdit

    XMLWordPrintable

Details

    • Unknown

    Description

      There's no escaping for the wiki macros syntax injected in the wiki editor toolbar, so using this toolbar inside a wiki syntax page with an html macro leads to a break of this HTML macro.
      The problem is really visible when trying to display in edit mode an xclass field named "content" (only case when the toolbar is displayed) using the wiki editor, in a wiki page: it breaks the html macro.

      Quick reproduction steps:

      • Import the attached XAR
      • Display the page

      Obtained result:

      • The html macro is broken, it displays properly the editor, but the following content is displayed like this:
        {{/html}} Some code outside html {{html}}
        mydiv
        {{/html}} 
        

      Expected result:

      • It should display the editor and no code under it but only
        Some code outside html
        
        mydiv
        

      Long reproduction steps:

      • Create an xclass named "Main.TestContent" with a TextArea field named "content" and with Wiki editor
      • Create a page with following content:
        {{velocity}}
        
        #template('display_macros.vm')
        
        {{html clean="false"}}
        #set ($docMessageClass = $xwiki.getDocument('Main.TestContent'))
        #set ($messageClass = $docMessageClass.getxWikiClass())
        #set ($messageObj = $doc.newObject('Main.TestContent'))
        #set ($contentField = $messageClass.get('content'))
        #set ($editor = $doc.displayEdit($contentField, '', $messageObj))
        $!editor
        {{/html}}
        Some code outside html
        
        {{html}}
        <div>mydiv</div>
        {{/html}}
        
        {{/velocity}}
        
      • Check the result of that page

      Same expected and obtained result as above.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              surli Simon Urli
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: