Page MenuHomePhabricator

VisualEditor does not respect the TemplateData defined format of a template when subsequent adding content before or after it.
Open, MediumPublic

Description

Hello,

When trying on visual editor to insert text after a template with the TemplateData custom format {{_|_=_}}\n, the newline indication is not respected, and the new content is added on the same line.

The frwiki template {{Voir homonymes}} contains the following TemplateData format: {{_|_=_}}\n

Step 1: The following template is present on the page (diff 1):

{{Voir homonymes|Test}}

Step 2: In the visual editor, the following text is added after the template (diff 2):

Content...

The incorrect wikicode generated is then the following:

{{Voir homonymes|Test}}Content...

This was expected:

{{Voir homonymes|Test}}
Content...

or

{{Voir homonymes|Test}}

Content...

Same problem when try inserting a template {{Confusion}} (with the following format: {{_|_=_}}\n) (diff 3):

{{Voir homonymes|Test}}{{Confusion|Test}}

It is possible that this bug appeared with Parsoid/PHP, because I do not remember having seen it before. But I could be wrong...

(the different banners and infobox templates (likely to be inserted on the first line of a page) on frwiki use {{_|_=_}}\n format, without \n at the beginning to workaround the bug T199849#5008119.)

Edit: I opened this separate ticket because T199849 concerns the problems of handling new lines when adding the template. While there concerns a problem when adding subsequent content, after or before the template.

(sorry for my bad English)