There is 1 update, 1 comment.
 
 
XWiki Rendering / cid:jira-generated-image-avatar-7affe87c-cd70-4371-ad47-53f94c4b01e3 XRENDERING-750 Open

The empty lines before an inline editable macro are removed

 
View issue   ยท   Add comment
 

1 update

 
cid:jira-generated-image-avatar-a8c70cd0-9da6-4a48-aa7a-d8f208fcf3e5 Changes by Marius Dumitru Florea on 09/Jul/24 14:02
 
Description: Follow these steps to reproduce with the WYSIWYG editor :

*
edit Set the same content of a wiki page in two browser tabs, in realtime to:
{noformat}
before





{{info}}test{{/info}}
{noformat}
* in Edit the first tab, type something on page with the first line WYSIWYG editor.
*
then press Enter Notice that the empty lines are present.
* Edit the parameters of the info macro and modify some parameter (e.g. set
a couple CSS class, doesn't matter)
* The empty lines disappear after the content is re-rendered due to the macro parameter change

With the network tab I can see that the HTML converter is called with something like:

{noformat}
<p>before</p><div class="wikimodel-emptyline"></div><div class="wikimodel-emptyline"></div><div class="wikimodel-emptyline"></div><div class="wikimodel-emptyline"></div><!--startmacro:info|-|--><div data-xwiki-non-generated-content="java.util.List&lt;org.xwiki.rendering.block.Block&gt;" class="xwiki-metadata-container"><p>test</p></div><!--stopmacro-->
{noformat}

and the result
of times parsing to create some XDOM and rendering back to XWiki 2.1 syntax is:

{noformat}
<p>before</p><!--startmacro:info|-||-|test--><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>test</p></div></div><!--stopmacro-->
{noformat}

As you can see the
empty lines are missing.

Note that the problem doesn't reproduce when the macro is initially inserted, where the HTML converter is called with:

{noformat}
<p>before</p><div class="wikimodel-emptyline"></div><div class="wikimodel-emptyline"></div><div class="wikimodel-emptyline"></div><div class="wikimodel-emptyline"></div><p><!--startmacro:info|-||-|test--><!--stopmacro--></p>
{noformat}

and correctly produces:

{noformat}
<p>before</p><div class="wikimodel-emptyline"></div><div class="wikimodel-emptyline"></div><div class="wikimodel-emptyline"></div><div class="wikimodel-emptyline"></div><!--startmacro:info|-||-|test--><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>test</p></div></div><!--stopmacro-->
{noformat}

This suggests that the problem is in the code that handles the "data-xwiki-non-generated-content", i.e. the content of macros editable inline.

Note that this issue is
* very annoying* when editing in realtime because realtime editing makes it reproduce more easily:

* Alice inserts some empty lines and
then insert inserts an information info box on
* While Alice is typing inside
the last line info box:
*
switch * the changes are propagated to Bob and since there's a new macro, the second browser tab

The
content is re-rendered for Bob, but due to the realtime sync the "data-xwiki-non-generated-content" DIV is present, and thus the empty lines are removed *when switching for Bob, which produces a change that gets propagated to the second tab Alice
* * Alice sees the empty lines ( not before! she just entered ) disappear and blames it on Bob
 
 

1 comment

 
cid:jira-generated-image-avatar-a8c70cd0-9da6-4a48-aa7a-d8f208fcf3e5 Marius Dumitru Florea on 09/Jul/24 14:04
 

I reproduced on 16.5.0, 16.4.1 and 15.10.11. I reproduced also on 14.10.21, so this looks like an old issue with inline editable macros.