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

Saving a page with WYSIWYG deletes macros that are inside the content of other macros.

    XMLWordPrintable

Details

    • Unknown

    Description

      This issue can be reproduced using the following lines.

      {{info}}
      (% class="someclass" %)Some text {{mention reference="XWiki.Admin" style="FULL_NAME" anchor="XWiki-Admin-yoWKy"/}}
      {{/info}}

      1. Edit a page in wiki mode and paste the previous lines in the content

      2. Save the page

      3. Edit the page inplace or in wysiwyg mode and save page or view the source of the document.

      If the source is viewed, the mention macro is missing which leads to the deletion of the macro if the page is saved.

      When clicking the source button, the following data is sent to the server

      <!--startmacro:info|-||-|(% class="someclass" %)Some text {{mention reference="XWiki.Admin" style="FULL_NAME" anchor="XWiki-Admin-yoWKy"/}}-->
      <div data-xwiki-non-generated-content="java.util.List&lt;org.xwiki.rendering.block.Block&gt;"
          class="xwiki-metadata-container">
          <p>
              <span class="someclass">
                  Some text
                  <!--startmacro:mention|-|reference="XWiki.Admin" style="FULL_NAME" anchor="XWiki-Admin-yoWKy"--><!--stopmacro--></span>
          </p>
      </div><!--stopmacro-->
      

      Which doesn't seem to be faulty in any way. This indicates that the issue might be with the the component that is responsible with the conversion from html to xwiki syntax.

      Another observation is that the issue does not reproduce if the content of the macro is wrapped in a group/div rather than a span.

      This ticket might be hiding two issues:

      1. in rendering when converting xhtml to xwiki syntax, the nested macro is lost

      .runTransformations
      .#-----------------------------------------------------
      .input|xhtml/1.0
      .#-----------------------------------------------------
      <!--startmacro:info|-||-|(% class="someclass" %)aaaa \{\{info}}bbb\{\{/info}}--><div class="box infomessage"><div data-xwiki-non-generated-content="java.util.List&lt;org.xwiki.rendering.block.Block&gt;" class="xwiki-metadata-container"><p><span class="someclass">aaaa <!--startmacro:info|-||-|bbb--><span class="box infomessage"><span data-xwiki-non-generated-content="java.util.List&lt;org.xwiki.rendering.block.Block&gt;" class="xwiki-metadata-container">bbb</span></span><!--stopmacro--></span></p></div></div><!--stopmacro-->
      .#-----------------------------------------------------
      .expect|xwiki/2.1
      .#-----------------------------------------------------
      {{info}}
      (% class="someclass" %)aaaa {{info}}bbb{{/info}}
      {{/info}}
      

      2. in ckeditor, when calling the annotated html to xwiki endpoint, the nested macro is already missing from the annotated html

      Attachments

        Issue Links

          Activity

            People

              MichaelHamann Michael Hamann
              tcaras Teodor Caras
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: