Page MenuHomePhabricator

VisualEditor should enforce TemplateData's 'type': 'line' for template parameters (no multiline input)
Open, MediumPublic

Description

Intention:
Add a link to a template using {{tl}} on English Wikipedia.

Steps to Reproduce:

  1. Add Template:Tl.
  2. Add any template name, and press return afterwards (so that the parameter field is name+return)
  3. Apply changes.

Expected Results: No newline is inserted.

Actual Results:
The template is broken because the parameter can't support the inclusion of a return.

Details

Reference
bz61049

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:07 AM
bzimport added a project: VisualEditor.
bzimport set Reference to bz61049.

If it's not desirable to always strip returns (or spaces) from the end of parameters, then perhaps we should be able to specify in TemplateData how they should be handled.

I wonder if this parameter should be marked with TemplateData type "line" and VE should enforce this in the input.

This is now being done for named parameters per T52439, which do not preserve whitespace. However, it must not be done for positional parameters (like in {{tl}}) per T53484, because these do actually preserve whitespace.

Like Krenair says, VE shouldn't use multiline text inputs for single-line parameters, like this one (I just fixed the templatedata on en.wp). Let's rephrase the bug.

matmarex renamed this task from VisualEditor: VisualEditor should strip returns from the end of template parameters to VisualEditor should enforce TemplateData's 'type': 'line' for template parameters (no multiline input).Feb 11 2015, 5:29 PM
matmarex updated the task description. (Show Details)
matmarex set Security to None.

modules/ve-mw/ui/pages/ve.ui.MWParameterPage.js actually has // TODO: Use spec.type :) (should be getParameterType(), rather).