Background
As a part of making working with templates in Visual Editor easier, we will change the way in which parameters can be discovered, added and removed from a template invocation.
Requirements
- Implement behind a feature flag with:
For the sidebar:
- Sidebar is open on large screens and toggle-able on small screens, see T274554: Make sidebar responsive
- Allow for multi-part template content (more than one template or wikitext) to be displayed/stacked in the sidebar and main dialog, see T274544: Support multiple transclusions (i.e. templates) in the new template dialog sidebar
- The sidebar will display all parameters defined for the template (in TemplateData), not just those that have been added in the template dialog. See T274543: Create a new checkbox list view for the VisualEditor template dialog
- Include any undocumented parameters present in the wikitext, in the sidebar. See T274550: Handle undocumented template parameters for full description of behavior.
- The icon to the left of the parameter names is removed and replaced with an OOUI checkbox. These are used to add and remove parameters to the invocation of the template, i.e. shown or removed from the main input section on the right as follows:
- Required parameters should have a disabled, selected checkbox and cannot be removed from the template. See T274548: VisualEditor template "required" parameter handling
- Added parameters should have a selected checkbox
- Un-added parameters should have an un-selected checkbox
- Clickable area for the add/remove function is limited to the checkbox itself and does not include the name of the parameter. Clicking on the name of the parameters allows the user to jump to this parameter in the main input section on the right, and the cursor is inserted into that parameter's field (current behavior).
- Current behavior should not be broken: The two scrollable windows should stay in sync. If the parameter is clicked then it should jump on the right side, but if on the right a new field is in focus the sidebar should also scroll to match and highlight the current parameter. See T274552: Synchronize scroll and focus between content and outline panes
- When a parameter is not yet added, then clicking on the parameter name adds it. Clicking on the name again though does not remove it.
- When a parameter is removed, keep the parameter "in focus"/selected if it's a named parameter and will remain, otherwise select the next parameter after the removed one (do not jump to top).
- If template has TemplateData and no parameters, show 'No parameters' text instead of checkboxes. See T274549: Handle "no parameter" templates
- Truncate parameter names that are too long for the sidebar (maintain current behaviour). See T285044: Fix parameter sidebar overflowing text ellipsis
- If deprecated parameters already have a value, show in the sidebar. If they have no value, hide in sidebar so that they cannot be added. See T274551: "deprecated" parameter handling
For the main input area of the dialog:
[x] Remove the 'Add more information' dropdown at the bottom of the main input area, where parameters are currently added to templates. Not directly related and see T272487: New input for undocumented parameters
- Remove the trash icons, see T275761: Remove the trash icons which show next to the parameter name when it's "in focus"
Order: (See T274545: Wire template parameters into the checkbox list view)
- Order param list in sidebar and main input area based on:
- If existing, use TemplateData order (ParamOrder or order of parameters as listed in TemplateData)
- If TemplateData is missing, auto-order based on the order of parameters in the template definition/source code
- Add undocumented parameters to the end of the param list.
Mock and Specs
Related tickets
- Relevant prototyping tickets: T261504: VE on Test Instance: Change behavior for adding/removing params, T265025: Test instance: Use TemplateData order in sidebar and content pane, T265029: Removing a parameter should not cause the outline to scroll, T261503: Remove hide/show functionality from sidebar and adjust margins