Commit graph

17814 commits

Author SHA1 Message Date
Thiemo Kreuz 095c891040 Remove unused code from ve.ui.MWTransclusionOutlinePartWidget
* getPartId() is unused.
* Use this.data instead of a custom this.partId.
* No need to store this.header as a property.
* Rename the event to "headerClick". That's enough when the
  event comes from a widget that does have the word "part" in
  it's name.

Bug: T274544
Bug: T288827
Change-Id: I8c70425403c6cd6a19e3a1cacb2b085e5c8b2e46
2021-08-19 11:03:44 +00:00
Thiemo Kreuz 7503b323b1 Stop re-creating template parameter pages over and over again
This is what actually happens:
* We call `addParameter()`.
* This triggers an `add` event.
* This calls an `MWTemplateDialog.onAddParameter` event handler.
* This code doesn't check if a parameter already exists (because
  it shouldn't). It detroys the page in the content pane on the
  right and recreates it from scratch.

The only reason we do this is to focus the input field on the
right. This patch introduces a dedicated event to do this.

Bug: T288827
Change-Id: I47effe05427cfabfcf534920edee79521eaa033f
2021-08-17 13:34:41 +02:00
Translation updater bot 8ca81204e9 Localisation updates from https://translatewiki.net.
Change-Id: Ie94f81beac0844834160f7eb2340883fd09e0480
2021-08-17 08:19:53 +02:00
Thiemo Kreuz 88ebae9b0f Remove unused properties from template part widget classes
It doesn't look like we are going to need these.

Bug: T288827
Change-Id: I0bcc1aea85ce589db814a1bed12226d47728d7e9
2021-08-16 14:52:54 +02:00
jenkins-bot 5c9bfe6a33 Merge "Make checkbox element in the sidebar an actual widget" 2021-08-16 12:36:40 +00:00
jenkins-bot c3ff9df19e Merge "Basic keyboard navigation in the new template dialog sidebar" 2021-08-16 12:36:37 +00:00
jenkins-bot ddfde5f3b6 Merge "Remove duplicate class property from checkbox layout" 2021-08-16 11:56:16 +00:00
jenkins-bot 4d6d700e8f Merge "Add isDocumented() feature to ve.dm.MWTemplateSpecModel" 2021-08-16 11:29:26 +00:00
jenkins-bot eb0e2cd507 Merge "Change filterParameter(s) event to work with a list" 2021-08-16 11:10:09 +00:00
jenkins-bot 41c286c68c Merge "Rename ambiguous "add button" click handlers" 2021-08-16 11:01:36 +00:00
jenkins-bot 0e6c56160e Merge "Show sidebar controls only when multi-part content is present" 2021-08-16 10:54:41 +00:00
Translation updater bot 258178a04c Localisation updates from https://translatewiki.net.
Change-Id: I475fa9297b8668b343da1d2a268d3c81a703762c
2021-08-16 08:17:02 +02:00
jwbth 6d7a062dbb Fix history.replaceState call on diff pages
The history.replaceState call in onReviewModeButtonSelectSelect() (1)
ignores any changes to the document URL made by external tools such as
RevisionSlider, (2) replaces with an empty string the history entry
state object if it was set by external tools such as, again,
RevisionSlider. Both 1 and 2 result in a wrong URL ending up in the
address bar at some point. This patch addresses these problems, (1)
creating a new mw.Uri() object every time
onReviewModeButtonSelectSelect() is called, (2) keeping the current
history.state object.

The original variable storing the URI object is renamed to avoid
shadowing (optionally can be replaced with its value as it's used only
once).

Bug: T288636
Change-Id: Ieb97b561a6c076aa28aae231fe286ac4d1051bbd
2021-08-14 10:51:24 +00:00
Thiemo Kreuz b264a9c381 Add isDocumented() feature to ve.dm.MWTemplateSpecModel
Bug: T272487
Change-Id: I39c612358cc0238c515c8eb28aa1b40418a10cef
2021-08-13 12:47:28 +02:00
Translation updater bot 4c969911d3 Localisation updates from https://translatewiki.net.
Change-Id: Ib53caf734409a957a7bc3027c6036cc6b7ec8003
2021-08-13 08:19:23 +02:00
jenkins-bot 3999f5bac3 Merge "Fixing minor jsdoc typo" 2021-08-12 09:30:17 +00:00
jenkins-bot 991e34c166 Merge "ApiVisualEditorEdit: inject services" 2021-08-11 20:08:42 +00:00
Roman Stolar 0519e98725 Replace Content::preSaveTransform call to ContentTransformer::preSaveTransform
Bug: T287156
Change-Id: Ieaf645dab42c0e6def9fc36ecc619843710656f4
2021-08-11 18:44:35 +03:00
jenkins-bot ea0f1c2610 Merge "Minimize template dialog CSS a bit" 2021-08-11 13:19:20 +00:00
Andrew Kostka a2135d524d Show sidebar controls only when multi-part content is present
Bug: T272482
Change-Id: I092438bc9c7d5569f758786ca6952beffdf37507
2021-08-11 15:00:59 +02:00
jenkins-bot 1f91b2e185 Merge "Rename and document definition of "empty" in ve.ui.MWParameterPage" 2021-08-11 07:44:33 +00:00
Thiemo Kreuz 97486b2b3d Rename and document definition of "empty" in ve.ui.MWParameterPage
I found this while working on T274551, which is all about the
definition of "empty".

In the old sidebar a parameter's name is dimmed (gray) as long as
the parameter's value is empty. This stops working entirely when
there is a default value.

My first impulse was "this is a bug". When there is a default
value, both the empty string and the default value (when the user
enters it exactly) typically trigger the same behavior: The
template uses the default value, just as if the user entered it.

But this code is correct because of the way it is used. Only
parameters that are "truly" empty should be visually marked as
such. The moment there is a default value it is either impossible
to change this back to an empty string – meaning the parameter
can never be truly empty – or the empty string is meaningful user
input.

Bug: T274551
Change-Id: I90657bfe83e56afd3942428c0dd8a47b444e39c9
2021-08-11 07:24:41 +00:00
Thiemo Kreuz d1f87646df Make checkbox element in the sidebar an actual widget
This should not have any effect on how the thing looks and
behaves.
* All elements in the sidebar should be reachable with the tab
  key, including disabled elements.
* Enter jumps to the corresponding paremeter in the content
  area on the right. But enter doesn't change the checkbox
  state.
* Space canges the checkbox.

The class will be renamed in the next patch.

Bug: T285323
Change-Id: Idc5e04828ece0ba77a65e4c839cd3ffccc3b6733
2021-08-11 09:12:00 +02:00
Translation updater bot 01d0dd0682 Localisation updates from https://translatewiki.net.
Change-Id: Id7f6653898a023ff041975ab27b8d0880553f7f5
2021-08-11 08:19:45 +02:00
Thiemo Kreuz 993c64f9a2 Minimize template dialog CSS a bit
Bug: T272481
Change-Id: I156c8f2ea4a70d2e86a7bc4282738c51bebc3f2a
2021-08-11 08:09:40 +02:00
Thiemo Kreuz 0bbcb436c1 Change filterParameter(s) event to work with a list
As discussed in Ia44da16. This change avoids possibly hundreds
of events (when a template does have hundreds of parameters),
and replaces them with a single one.

Bug: T288202
Change-Id: Ic819e8c93e872b653c238f396f1f327b6a8759d2
2021-08-11 08:06:22 +02:00
Alexander Vorwerk 2fbd7f5c11 ApiVisualEditorEdit: inject services
This patch adds dependency injection for the ApiVisualEditorEdit api
module.

Change-Id: I4f75fc32ff422ca0e0f163add1346963eedcc635
2021-08-10 18:16:46 +00:00
WMDE-Fisch 8f39c56ded Fixing minor jsdoc typo
Change-Id: Id543c939836d1c15f5cfdcfc7450efc574e85cb6
2021-08-10 16:15:30 +02:00
Bartosz Dziewoński 055c87240a Update VE core submodule to master (c61e33a59)
New changes:
c61e33a59 Style tweaks for empty toolbars

Bug: T284402
Change-Id: Ic31d2d076e17313636ede24ef08598d6a8677acc
2021-08-10 12:21:23 +02:00
Translation updater bot 4ea1823944 Localisation updates from https://translatewiki.net.
Change-Id: I4ea04acc730f77f6a884cba9ff96c5b968b8386c
2021-08-10 08:07:11 +02:00
jenkins-bot 84799aa36c Merge "Don't show toolbar in MWLanguageVariantInspector text targets" 2021-08-10 01:17:08 +00:00
David Chan b8e2bfe051 Don't show toolbar in MWLanguageVariantInspector text targets
Bug: T284402
Depends-On: Idc8d2ffdae3f1168813fcb89ce5ca20bd835f9ab
Change-Id: I9316d77218b81ed47f99293ed70fe02c32edb96e
2021-08-09 23:34:48 +00:00
jenkins-bot 7032300cc4 Merge "ApiVisualEditor: inject services" 2021-08-09 21:44:52 +00:00
Bartosz Dziewoński c211b8f197 Update VE core submodule to master (84148fbe4)
New changes:
d0de8230f build: Updating npm dependencies
3681a121f Localisation updates from https://translatewiki.net.
0dd5f6e3b Localisation updates from https://translatewiki.net.
8c631c24b Localisation updates from https://translatewiki.net.
3ce31ddd1 build: Upgrade qunit from 2.15 to 2.16
15929e8c7 Localisation updates from https://translatewiki.net.
84148fbe4 Localisation updates from https://translatewiki.net.

Change-Id: Ife6967d470087705e39b4dc73503ccafe35d9387
2021-08-09 19:13:57 +02:00
Thiemo Kreuz f32a062e3f Basic keyboard navigation in the new template dialog sidebar
There is still a lot to do, but this implements some basic
behavior that was missing before.

* You can now use the tab key to navigate all checkboxes,
  including disabled ones (required parameters).
* Enter key now works on both the checkbox as well as when
  the entire line is highlighted. Enter forces the checkbox
  to be checked and moves the focus to the content area.
* Mouse clicks now work on the entire line. Before, only the
  text label was clickable.

Open issues (not to be resolved in this patch):
* Clicking the text label and the empty space after the text
  label does different things. Probably shouldn't.
* Should a click on the label check the checkbox?
* Space key should probably not move the focus to the content
  area.
* Focus rectangle is different on disabled rows. Is this ok?
* Background color when a line is focussed is missing.

Change-Id: I22ccd1bea92e4f098d4b25a9e38cddde5c103423
2021-08-09 18:38:28 +02:00
Thiemo Kreuz 984a3a1ebf Remove duplicate class property from checkbox layout
The checkbox is the first parameter in the parent constructor.
The parent is the FieldLayout class. The checkbox becomes the
this.fieldWidget in the parent class. Just use this instead of
storing a duplicate reference.

Bug: T274543
Change-Id: I4ae7d467334f88f2be93a62660145a025089401f
2021-08-09 18:31:30 +02:00
jenkins-bot 622a85a2eb Merge "Split long ve.ui.MWTransclusionOutlineTemplateWidget methods" 2021-08-09 12:50:43 +00:00
Alexander Vorwerk 72693ca46b ApiVisualEditor: inject services
This patch add dependency injection for the ApiVisualEditor api
module.

Change-Id: I46a249fc1a8cf96102ee9fd64bf046d3a3d33361
2021-08-09 11:14:34 +00:00
Thiemo Kreuz 2ce7bb0213 Split long ve.ui.MWTransclusionOutlineTemplateWidget methods
This direct follow-up is meant to resolve the change request
from I1b0480a.

Bug: T274551
Change-Id: Iee4bab0b9807e6d36435d31bf8ec879d13d9ad3b
2021-08-09 10:40:53 +00:00
Thiemo Kreuz 9e74e2f352 Ignore default values as not being valuable as well
This check makes sure the user doesn't loose work when clicking
the back button. I would like to argue that neither of these
values is valuable enough to block the user with a confirmation
dialog:
* Literally nothing is lost when the input is empty.
* The auto-value is only temporarily lost, but will
  automatically be restored when the user decides to add the
  template back. The input field is pre-filled with this value.
* The default value doesn't need to be manually entered. It will
  show up anyway when the parameter is missing.

There is a rare edge-case, but it is not really relevant in this
situation. Some templates allow to override a default value with
the empty string. This will be considered irrelevant by this
code. However, this was already happening before and doesn't
change with this patch.

The only edge-case where this patch makes a difference is if a
parameter is marked as required or suggested, is documented to
have a default value, _and_ the template allows to override it
with an empty string. But this combination is rather crazy, if
not bogus, and not worth considering here, I believe.

Bug: T274551
Change-Id: Ib176a82844335c3d4dd5b720d335ec28245e1637
2021-08-09 10:28:09 +00:00
jenkins-bot aa868059ee Merge "Better name for ambiguous "empty" concept in the model" 2021-08-09 09:40:40 +00:00
Translation updater bot 5b5cb414fe Localisation updates from https://translatewiki.net.
Change-Id: I9c10f33b2607a160a0fa816fde91aa83e86189a5
2021-08-09 08:25:33 +02:00
jenkins-bot d5b40aaab7 Merge "Fix off-by-1 error when deprecated parameters are hidden" 2021-08-06 13:28:45 +00:00
Thiemo Kreuz 35080a8646 Better name for ambiguous "empty" concept in the model
This is really only about the methods name, but doesn't change
any behavior.

I realized we work with several different definitions of what
"empty" means. There are at least two significant definitions:

1. When a parameter's value is the empty string or identical
to the default value, the behavior of the template is the same.
It will use the default value just as if the user entered it.

The auto-value is a meaningful value in this scenario and can't
be considered equal to the empty string.

2. The context here is when the user presses the back button.
This will destroy all user input. But an auto-value is not user
input. It will appear again when the user realizes they made a
mistake. Nothing is lost.

Personally, I would not use the word "empty" to describe this
concept. Things like "containsUserProvidedValue",
"isCustomValue", "isMeaningfulValue", … come to mind. These are
all still a big vague. A "user provided" value can be identical
to the default or auto-value. "Custom" how? I went for
"containsValuableData" for now.

Bug: T274551
Change-Id: I2912a35556795c867a6b2396cbad291e947f0ed6
2021-08-06 15:11:44 +02:00
jenkins-bot 004d37dc1d Merge "Hide old sidebar when the new one is enabled" 2021-08-06 13:10:04 +00:00
Thiemo Kreuz 6446cf950f Fix off-by-1 error when deprecated parameters are hidden
This is a direct follow-up to I6ebd020.

Steps to reproduce the bug:
* Make sure you have a template with a deprecated parameter.
  The position doesn't matter.
* Add the template. The deprecated parameter is hidden.
* Add an undocumented parameter, e.g. "b". This is added to the
  end, as it should.
* Add an undocumented parameter "a". This should appear before
  "b", but doesn't. The reason is because the invisible
  deprecated parameter is in the list that is used to calculate
  the index, shifting it by 1 (or more when there are more
  hidden parameters).

This patch includes a few closely related changes:
* We can loop the list of checkboxes directly instead of
  indirectly via the list of parameter names.
* I made it so that an active filter only resets if it would
  hide the new parameter. The original problem we had to solve
  was that the new parameter would always be visible, even if
  it doesn't match the filter. This awkward mismatch is still
  guaranteed to not happen.

Bug: T274551
Change-Id: I1b0480ae836cc19b77b159d3fb30ff32e8c59df4
2021-08-06 12:24:49 +00:00
jenkins-bot 1cb4a5a471 Merge "Remove redundant ve.dm.MWTemplatePlaceholderModel.isEmpty" 2021-08-06 10:56:00 +00:00
jenkins-bot 4e2f3befe9 Merge "Make the sidebar in the transclusion dialog responsive" 2021-08-06 10:40:44 +00:00
jenkins-bot 5dabf57f94 Merge "Filter right content side of the template dialog as well" 2021-08-06 10:26:55 +00:00
jenkins-bot c8e36f9e6e Merge "Cleanup feature flags in ve.ui.MWTransclusionDialog" 2021-08-06 09:07:28 +00:00