Commit graph

764 commits

Author SHA1 Message Date
Bartosz Dziewoński 8c12259900 Update VE core submodule to f5c7f0f204
New changes:
e5963f084 DiffElement: Remove doc-child-change wrappers
90a359f79 Follow-up Ia593dad8: Use modifyData when sanitizing
f5c7f0f20 Localisation updates from https://translatewiki.net.

Local changes:
* Update tests for the removal of doc-child-change wrappers

Change-Id: Ib29f23625de9151d50e0f3b7796b15ca9ed89133
2022-01-24 20:13:21 +00:00
jenkins-bot d355ee1c88 Merge "Minor code cleanup in MWTransclusionOutlineTemplateWidget" 2022-01-24 08:11:43 +00:00
Thiemo Kreuz be5a752c8e Minor code cleanup in MWTransclusionOutlineTemplateWidget
Change-Id: I98904756e8ab9069634f644dc4d8631d1c0ee8fb
2022-01-23 17:09:46 +00:00
jenkins-bot 8e5de75d12 Merge "MWImage: Fix handling of error-image dimensions" 2022-01-22 01:07:39 +00:00
WMDE-Fisch 6cb0e7477e Hide parameter search when there are only 3 params
The search field is of not much use when there is not really anything
to search. It wastes more space than the actual list of parameters.

Approved by UX, see T298259#7626538.

Bug: T298259
Change-Id: I01784a1c463d8b0b504897b20179719f91597d19
2022-01-21 11:23:49 +01:00
Thiemo Kreuz 66f56f6c88 Defer creating template parameter search when it's not needed
From the user's perspective this is the same as before: When a
template doesn't have any parameters, there is no search field. The
moment the first (undocumented) parameter is added the search field
appears.

This is just delayed now. The widgets are only created the moment
they are actually needed.

This saves loading time and memory, especially in a multi-part
transclusion with many zero-parameter templates.

This also makes it a lot easier to change the minimal number of
parameters from 1 to e.g. 4.

Includes reverting the flexible header composition done in
Ib050e30a50ef965c1524e977d3a600c3ff836774

Bug: T298259
Change-Id: Ied7541d8d5c0b478a439dd31ce072e634287f181
2022-01-19 11:23:34 +01:00
Ed Sanders 63603e0cba MWImage: Fix handling of error-image dimensions
Change-Id: Ic808930bbd49bab779bd2ed174e6ec2408d51554
2022-01-19 00:51:39 +00:00
jenkins-bot 83d1211ef6 Merge "Give getUniquePartId method a better name" 2022-01-11 13:31:10 +00:00
Ed Sanders 9e4915d7c3 Tests: Fix unbalanced HTML
Change-Id: I997c68ce33263004b8ae9b686aae7295eec12ea7
2022-01-04 02:01:38 +00:00
Thiemo Kreuz 454dc53126 Give getUniquePartId method a better name
It's not a getter, but a generator. I found the name confusing.
Getters typically don't return something different every time you
call them.

Change-Id: I6eeab8b6a8644e430003f6e1ad77ab4b28e0d8c9
2021-12-22 13:03:01 +01:00
jenkins-bot 717b5cf534 Merge "Use no-jquery/no-html to warn against writing HTML strings to the DOM" 2021-12-17 16:42:53 +00:00
jenkins-bot c92ea76af8 Merge "eslint: Enable no-jquery/no-append-html" 2021-12-17 16:42:42 +00:00
jenkins-bot 6dc75d8283 Merge "Remove obsolete performance bottleneck from TransclusionModel" 2021-12-17 13:24:19 +00:00
Ed Sanders 2098292318 Use no-jquery/no-html to warn against writing HTML strings to the DOM
This forces us to comment when we are doing this deliberately.

Change-Id: Ide1bcb64f6c6076b48e88f1f27045bd93392f8a0
2021-12-16 01:28:42 +00:00
Ed Sanders 4d13a4f4ed eslint: Enable no-jquery/no-append-html
Prevents accidentally treating plain text or user input
as HTML, which could be an XSS vulnerability.

Change-Id: Id4af48447a0907962a57340cb60aca08df9cc505
2021-12-16 02:04:11 +01:00
Thiemo Kreuz 7cf10ea474 Delay initialization of all invisible "add parameter" components
The "Add parameter" page always starts collapsed. Even if a template
doesn't contain anything but this. But most of the content isn't
visible, unless the user presses the button. It's not only a lot of
content, it's also rather expensive, including .parseDom(),
LinkCache.styleElement(), and ve.targetLinksToNewWindow(). This adds
up in large multi-part transclusions. In an example with 200 parts
the total blocking time goes down from 2.9s to 2.4s. Which means this
is not a major bottleneck, but still worth it.

Bug: T296335
Change-Id: Ieab9fd35d145142b04d2267d8e5a2e10a4c02784
2021-12-15 08:28:16 +00:00
Ed Sanders 5c0344aeda Use new select[First|Last]SelectableContentOffset methods
* Make ve.ce.MWBlockImageNode autofocus=false, remove
  unused transition property
* Remove ignoreChildren from ve.dm.MWBlockImageNode
  based on new definition
* Remove tests which assert that deleting in a list next
  to a block image always de-indents. If this is desired
  behaviour it should be fixed without reference to
  ignoreChildren.

Bug: T295905
Depends-On: Idc0cccbe73d1b49d07b60c14a192a40f47d64608
Change-Id: Ib79a070f5d36dbe7742fa0760f8cdf55fe3046ed
2021-12-08 15:53:35 +00:00
Thiemo Kreuz fd669a4d16 Remove obsolete performance bottleneck from TransclusionModel
This sorting algorithm was introduced via Ic6bc348 (T274544). Note
there is no index parameter in the .onReplacePart() handler at this
point. When a part was moved, it was removed and simply appended
to the end. The additional sorting was needed to move it back to the
correct position.

This changed a few days later via Iafe29f1. There is now an index
parameter. The .onReplacePart() handler does the same as before, but
puts the part at the correct position right away. The additional
sorting is pointless since then.

The removed code alone is responsible for 1/3 of the total blocking
time when the template dialog opens.

Bug: T296335
Change-Id: I6c3fa70b532d34cd29d59c3b48ab81ebf608d548
2021-12-06 17:36:53 +00:00
Ed Sanders 33840e88ee build: Update eslint-config-wikimedia to 0.21.0
Change-Id: I19465a5ab3bf71cd97967fd1fac41c645f05a419
2021-11-10 14:52:56 -05:00
Ed Sanders 36eacb1095 assert.ok -> assert.true
Change-Id: I9987ae0cbe275bf492dcdef405454537119765ea
2021-11-09 00:30:20 +00:00
WMDE-Fisch dab5b5daae Add ARIA descriptions to sidebar widgets
When changing the source in the described-by attributes the screen
reader will read the text of the new source when the status changes.

Just changing the text within the elements holding the descriptions
does not work.

Bug: T291284
Change-Id: I31cc3061cf6c1f699babe41e99e0711f0eb03646
2021-10-29 12:07:53 +02:00
jenkins-bot c9222cf111 Merge "Fix strange dialog title when using subst:" 2021-10-25 09:12:13 +00:00
Ed Sanders e1fb20d8be Replace IIFE with block scope in ES6 code
Change-Id: I635f72a62ae44943a7705d28e92c9a0d265800b6
2021-10-14 15:11:45 +01:00
Thiemo Kreuz 74e3dd3f4b Fix strange dialog title when using subst:
When I type e.g. "subst:example" as the template name, we made this
work as the user would expect: the template named "Example" is found
and it's TemplateData documentation used. But the dialog title shows
"Subst:example". Note the uppercase "S". It means this string is
parsed as a title, including the "subst:". This is confusing. Just
show the template name.

Change-Id: I9817786991a8379cf48b0a664aef1413abddee2d
2021-10-08 16:00:29 +02:00
jenkins-bot 8e025e4af0 Merge "Skip flaky test for now" 2021-10-07 17:57:14 +00:00
Adam Wight 1142ca3ce0 Skip flaky test for now
Bug: T292318
Change-Id: I03437d33f26c48208b84a578ff185bff6f9034a7
2021-10-07 15:00:14 +02:00
Andrew Kostka 7e9d50ff05 Use .localeCompare() when sorting undocumented parameters
Bug: T292643
Change-Id: I5d89d64bcce656fa0881f69b5d0d0fef65871c0c
2021-10-07 11:57:18 +02:00
Thiemo Kreuz 1731f3cc14 Better name for .selectPartByPageName() method
This method does not only select a "part", i.e. a top-level item like
a template. It also selects sub-items like template parameters. The
new name reflects this better.

Change-Id: I51a8ddbd05b283248afba5a623cc52da7b2434f5
2021-10-01 07:00:40 +00:00
jenkins-bot abd115c054 Merge "First QUnit test for dialog classes" 2021-09-29 11:57:30 +00:00
Adam Wight d70941593d First QUnit test for dialog classes
Wrote a first test, that checks the parameter checkboxes showing up.

Bug: T291155
Change-Id: Ie79272442a0d0532607fe93e9ea538635812e671
2021-09-29 10:00:34 +02:00
jenkins-bot 8b539794a7 Merge "Cover suggestedvalues feature in MWParameterPage class" 2021-09-28 16:29:08 +00:00
Thiemo Kreuz 66d5f13dfb Remove obsolete …OutlineWikitextWidget test
The feature set is (almost) fully covered by other tests, notably
the tests for the …OutlinePartWidget base class and the other two
subclasses.

The only bit that's not covered any more is the
"visualeditor-dialog-transclusion-wikitext" message. But that's
super minor and not worth a separate QUnit test.

Bug: T291157
Change-Id: I574f9cff0baf3dff885094769c124a9e05a1d1c8
2021-09-28 08:37:47 +00:00
Thiemo Kreuz 33b4d0dfc6 Cover suggestedvalues feature in MWParameterPage class
… as well as improve the coverage of MWAddParameterPage a bit.

Bug: T291156
Change-Id: Ibacb602298e5200b00a23092e5b9b211c43d6719
2021-09-27 18:22:10 +02:00
jenkins-bot 37c5e5978e Merge "Move data model tests to correct directory" 2021-09-24 11:52:36 +00:00
Thiemo Kreuz 63d9969861 Rename outline "container" widget
I can't really tell what insight we get from the word "container".
Every widget is a "container" in some sense, isn't it?

This widget is just _the_ outline, I would argue.

Other suggestions?

Change-Id: I1fb27ee58c1a3dd790022504e978198dadf7ea02
2021-09-24 12:32:29 +02:00
Thiemo Kreuz 8125644ac2 Move data model tests to correct directory
Bug: T291062
Change-Id: I7425f047d07eceeae29b54106f7f7806fc929aa2
2021-09-22 14:09:33 +02:00
Thiemo Kreuz e037f99930 Merge custom "focusin" with "set" event handler
This code was introduced in I8fafee6. I can't tell any more what
the "bug" mentioned in the commit message was. Let's get rid of the
duplicate code path, see if we run into regressions and deal with
them one by one. That's much easier to handle than keeping this
confusing code path around.

Note this "focusin" event handler was actually re-implementing
parts of the upstream BookletLayout, namely
OO.ui.BookletLayout.onStackLayoutFocus().

Bug: T289043
Bug: T291381
Change-Id: Ib386ae6efec08465122f0e8ee81cd6dc9a2d337a
2021-09-21 10:14:57 +00:00
jenkins-bot e88c445920 Merge "Add tests for MWTemplateSpecModel.getTitle()" 2021-09-20 14:41:30 +00:00
Thiemo Kreuz 696d066829 Add tests for MWTemplateSpecModel.getTitle()
I was (again) wondering why the try-catch is there. But it's actually
needed. Now covered by a test.

Bug: T290140
Bug: T291062
Change-Id: Iccc7274ed9e7b81b8491dbca7d3d771706b0ed09
2021-09-20 16:04:22 +02:00
Andrew Kostka 65e3ce0787 Drop substitution prefixes before querying for TemplateData
Bug: T290140
Change-Id: I57924df9b6d4d6e24c54b85f044072e216478e68
2021-09-20 10:17:39 +02:00
jenkins-bot fe6c46bbdc Merge "Merge "templateParameterClick" and "choose" events" 2021-09-15 10:11:12 +00:00
Thiemo Kreuz 5351217cc4 Add test for MWTemplateModel.getOriginalParameterName()
Bug: T285869
Change-Id: I4318af044037b5c7b3d661c5da54754ca883967b
2021-09-13 18:22:16 +00:00
Andrew Kostka a38338259d Improve input validation for the add parameter page
This patch improves the error handling for when a user tries to add
a parameter which is either an alias of a existing parameter, the
primary name of a existing aliased parameter, or a name/alias of an
existing parameter which is shown with an override label.

The error message was modified to always refer to the conflicting
parameter using the same name that is has in the sidebar.

Example: A parameter named "Parameter B" is already present in the
sidebar under its alias "B". When a user tries to add "Parameter B",
the new error message will inform the user that the parameter they
are trying to add already exists as "B".

Bug: T285869
Change-Id: I762b72b6cf14eb8ff5fcef63b4dcb70e297050de
2021-09-13 16:58:11 +02:00
jenkins-bot 1666db730b Merge "Avoid expensive/unnecessary .getItems() call in a test" 2021-09-13 13:41:58 +00:00
jenkins-bot 26b3f5abf0 Merge "Consistent use of .forEach() in QUnit tests" 2021-09-13 13:41:28 +00:00
jenkins-bot ad27a6d7bc Merge "More assertions for ve.ui.MWTransclusionOutlineParameterWidget" 2021-09-13 12:24:33 +00:00
jenkins-bot 0cfd298d18 Merge "Fix and test page name splitting code in template dialog" 2021-09-13 12:23:17 +00:00
jenkins-bot bb22a6e4bb Merge "Add tests for ve.ui.MWParameterPage class" 2021-09-13 11:45:00 +00:00
Gergő Tisza 986e5ab4d2
MWInternalLinkAnnotation: Make test work with both fragment modes
Avoid breaking the test if $wgFragmentMode has html5 first.

Bug: T186267
Bug: T290464
Change-Id: I0c846173c06698eb039ed289ad202fd3539e61a9
2021-09-11 17:41:22 -07:00
Thiemo Kreuz 338a800837 Merge "templateParameterClick" and "choose" events
We don't need to distinguish between these any more. Both are
"active", i.e. both focus the widget on the right side of the
dialog. Sometimes the "choose" event is fired to actually add
or remove a parameter. Sometimes it's fired, but the state of
the parameter doesn't change (for whatever reason, i.e.
because the parameter name was clicked instead of the
checkbox). There is nothing to do in this case, except for the
focus change.

Change-Id: I3c7c0c81a075ccff76eda0a4fb2aa1ac7be3cec5
2021-09-11 17:47:08 +00:00