Commit graph

8019 commits

Author SHA1 Message Date
jenkins-bot 28256b3ca4 Merge "Support watchlist expiry" 2021-06-08 20:31:30 +00:00
Ed Sanders 857014fae9 Support watchlist expiry
Bug: T251348
Change-Id: I017a54784c758c5e97fb640721bd456adc0fbab5
2021-06-08 20:14:45 +00:00
jenkins-bot eca1ef82f2 Merge "Rewrite MWParameterPlaceholderPage.onParameterChoose() for readability" 2021-06-08 19:35:17 +00:00
jenkins-bot 2b0da3e338 Merge "Update template dialog title when multiple transclusions present" 2021-06-08 08:14:11 +00:00
jenkins-bot 69e17ef432 Merge "ve.dm.MWLanguageVariantNode: Fix "undefined" appearing for some nodes" 2021-06-08 07:15:48 +00:00
Thiemo Kreuz b81c18a017 Fix and update documentation in template dialog related code
Some of this was copy-pasted but forgotten.

Change-Id: I08c48e8e0a4cf17ec0888e4ce85427f4da825776
2021-06-07 23:47:23 +00:00
Thiemo Kreuz 7fdc560fb8 Rename "sequence" to "ordered parameter names"
There are 2 methods with the same name, but they are very
different. This makes it much easier to understand the
difference, I hope.

Change-Id: Ie1f049b2b14e1fe23f078e281ee797da29dfe3db
2021-06-07 23:24:17 +00:00
Thiemo Kreuz 6f72b7a391 Move initialization of optional elements into if block
This does have a few advantages:
* Less code is executed and less memory consumed when these
  elements are not needed.
* Code that belongs together is together.
* No local class properties are created when they are not
  needed in the code below.

This patch is kind of a proof of concept. It touches only a few
classes we currently actively work with. If this change is fine
we can change some of the other classes the same way.

Change-Id: I9f548765034f1f69799fff41aeb6c147ff28b82d
2021-06-07 20:53:34 +00:00
Bartosz Dziewoński 90e76e7c52 ve.dm.MWLanguageVariantNode: Fix "undefined" appearing for some nodes
The variable `html` had the value of undefined and was treated as a string.
This would then be displayed on the editing surface.

Change-Id: I4682ea121aa37f06cac41dde618af847586ae01e
2021-06-07 21:34:55 +02:00
Bartosz Dziewoński 9c2c4b82c7 Make .ve-init-mw-target-surface styles not apply to nested non-target surfaces
The class .ve-init-mw-target-surface is used on the same element
as .ve-ui-surface. This element contains surface overlays
.ve-ui-overlay, which can contain other .ve-ui-surface elements
(inside inspectors), which would then erroneously have the target
surface styles applied.

Bug: T284312
Change-Id: I8d20a830dc48f6a098b0f9e9a7c7c1656de0fe56
2021-06-04 20:48:18 +00:00
Bartosz Dziewoński 32ecfe4caf Fix adding 've-init-mw-target-surface' class only to main surface
Bug: T284312
Change-Id: Ic5320f6747907542285674d386c7a59c9e857f0a
2021-06-04 20:48:08 +00:00
Andrew Kostka 67e48a26ef Update template dialog title when multiple transclusions present
Bug: T276568
Change-Id: I530a6cd8aea4f9fcafe7a03fc5050883f1f4b37c
2021-06-04 16:48:05 +02:00
WMDE-Fisch 9ab43ee145 Fix typos
Missed these and found another one.

Change-Id: Ibc5ad8998e84d2bdffb0b89f8664271665b3b79c
2021-06-04 14:43:23 +02:00
jenkins-bot 69676950b3 Merge "Much longer descriptions of template dialog related classes" 2021-06-04 12:00:46 +00:00
Thiemo Kreuz e13b0dae48 Much longer descriptions of template dialog related classes
The idea is to possibly rename some of these classes, based on
these descriptions. But this should be done in later, separate
patches.

Change-Id: I7f9e5b2382711b434d6dd618489fa3ed8b7a46b4
2021-06-04 13:17:59 +02:00
jenkins-bot df5238cd11 Merge "Fix duplication bug in MWTemplateTitleInputWidget" 2021-06-04 10:50:39 +00:00
Thiemo Kreuz cdafea5663 Rewrite MWParameterPlaceholderPage.onParameterChoose() for readability
The main motivation for this patch is actually the comment. The
so called "spec" contains all parameters that are present in a
template, no matter if they are present in the TemplateData
documentation or not. This is critical here.

Change-Id: I5e1c79e3859a27562a9dea1d450cec196aa572ed
2021-06-04 12:49:53 +02:00
jenkins-bot bc0f405317 Merge "NWE: Always paste rich text as plain, and show context item to convert" 2021-06-03 18:15:59 +00:00
Adam Wight d4eee82701 Update template dialog titles: Insert/Edit
Toggle depending on whether the transclusion existed or is new.

Bug: T276568
Change-Id: Ib9b76cac7cd57245e8db2ef10879069a86a6269e
2021-06-02 12:36:38 +02:00
jenkins-bot 7fe5b6a433 Merge "Template dialog button title toggles between Insert/Edit" 2021-06-02 10:34:53 +00:00
Adam Wight c49478de60 Template dialog button title toggles between Insert/Edit
Depends on whether this is a new or existing template transclusion.

Split from Ib9b76cac7cd57245e8db2ef10879069a86a6269e

Bug: T276568
Change-Id: I4d22e32fef067b640e9a9389deffaace736c3405
2021-06-02 12:00:15 +02:00
jenkins-bot fa94c27a8d Merge "Change header titles in the template dialog" 2021-06-02 09:05:04 +00:00
WMDE-Fisch 58cf1b0344 Change header titles in the template dialog
Bug: T276568
Change-Id: I5da40032c5b83d04ae92e86372c445d7a28d0444
2021-06-02 08:48:07 +00:00
Thiemo Kreuz e97e325ac6 Guarantee exact match when searching for a template
When the existing search results don't contain an exact match
(see previous patch), perform an additional search for the
title. This uses OpenSearch. This is recommended in multiple
places and also used in the quick search field at the top of
MediaWiki.

Again, I came to the conclusion that an isolated unit test
would be complicated and not test much anyway. Better test
on-wiki.

Bug: T274903
Change-Id: Ib575248e089ff66814400202d224deff6369c772
2021-05-31 08:31:49 +00:00
Thiemo Kreuz 1a37edc53f Move exact matches to the top in template search
This code detects a few edge-cases:

1. When some search results are exact matches, make sure they
are always at the very top.

2. When the prefixsearch API is used, e.g. as a fallback,
redirects show up as a separate metadata structure outside of
the pages array. Consider these and stop if there is already
an exact match.

3. CirrusSearch returns redirects as part of the pages array.
When there is an exact match, make these redirects separate
options and add them to the top.

All of this is case-insensitive, on purpose. In case two
templates with different capitalization exist, we rely on
the backend to return both. The code introduced here is fine
with this.

Notes:
* This doesn't guarantee an exact match is always there. This
  requires an additional HTTP request and is done in the next
  patch.
* I tried to write unit tests for this, but gave up. The setup
  is complicated. An isolated unit test would not test much
  anyway. Better test this on-wiki.

Bug: T274903
Change-Id: I64e1b5633e7b878a4d0d23d66229ca87e69d0045
2021-05-31 09:54:39 +02:00
Thiemo Kreuz 621bca1df4 Show redirects as part of description in template search
These are the most minimal (and therefor most stable,
hopefully) hacks I could come up with so far.

Bug: T274903
Change-Id: I28ba414dd34aad756e29400eb656f0942291a923
2021-05-27 12:40:51 +02:00
WMDE-Fisch 98b6cc8bc2 Don't update backButton visibility if not set
Bug: T283511
Change-Id: Idb9668e45c6820cbb631d7a8aac34e03cf788802
2021-05-26 08:47:52 +02:00
jenkins-bot 30bf60cb87 Merge "ArticleTarget: Always set fromEditedState when preloaded is true" 2021-05-25 20:24:29 +00:00
jenkins-bot d06554c81e Merge "Ensure correct classes are added to surfaces" 2021-05-25 19:33:17 +00:00
jenkins-bot f40bf5e3df Merge "Don't apply min-height hacks to TargetWidget surfaces" 2021-05-24 21:11:55 +00:00
jenkins-bot 539dc5ddba Merge "Remove unused 'inTargetWidget' config" 2021-05-24 21:11:53 +00:00
jenkins-bot 028658a4e1 Merge "Remove/fix a few small pieces of unused code" 2021-05-24 13:23:53 +00:00
Ed Sanders a71dd4f797 Ensure correct classes are added to surfaces
* Create getSurfaceClasses method.
* Pass surfaceClasses to target widgets.

This ensures that the 'content' class is passed to mobile
target widgets, and the 'mw-body-content' class is added
in a less hacky way.

Change-Id: Ibce6d1a1d0fda63cca354761f1b91f808858e95b
2021-05-23 20:04:28 +01:00
jenkins-bot 915a39064e Merge "Add star to template search term only when it's possible" 2021-05-21 14:31:23 +00:00
Thiemo Kreuz 8f045a7155 Remove/fix a few small pieces of unused code
I found these thanks to PHPStorm.

Change-Id: Ieb30a95debb58d3a454ac3c6f0546e5dbbe77ed4
2021-05-21 11:43:45 +00:00
Thiemo Kreuz b15455ec3d Fix duplication bug in MWTemplateTitleInputWidget
Template names sometimes show up twice when searching for a
template in the "Add a template" dialog.

This is a bit hard to test. The code responsible for this
is not in a single place. The feature is in the upstream
TitleWidget class. It's not broken. It makes sense to
provide e.g. "foo" and "Foo" as two separate options when
the user typed "foo", but the page is named "Foo". Both are
valid, and the feature allows the user to pick either.

But the VE widget does it's own normalization. Both entries
are normalized to "Foo". Both do the same. The additional
one is pointless.

You can try this on the actual enwiki: Open VE, insert a
template, search for "Template:nHLE".

Change-Id: I65e706c4d131a2f8c605d7979a02ea56f831bf03
2021-05-21 11:43:31 +00:00
Andrew Kostka 2fe6094099 Update the delete button's feature flag in the tranclusion context menu
Bug: T274263
Change-Id: If805ce9dfc44be34e07ec79179837f12898e626e
2021-05-21 09:24:14 +00:00
jenkins-bot 13f8d7db67 Merge "Remove obsolete vendor prefixed properties" 2021-05-18 01:25:08 +00:00
jdlrobson 2a40996cb7 Add mw-body-content to surface element
VisualEditor recreates the mw-body-content element. The element
with mw-parser-output already exists as a child. All skins now
consistently follow this pattern.

To limit the impact to the editor, we use ArticleTarget and add the class
to the surface, which corresponds to the mw-body-content element of a skin.
This avoids unrelated regressions in experiences such as DiscussionTools.

Bug: T283014
Change-Id: I4833d1ca9fda4fc0bd433760e47fe7010f00db05
2021-05-17 19:06:54 +00:00
jenkins-bot a01b56bcf1 Merge "Invert template search result highlighting" 2021-05-17 12:30:49 +00:00
Adam Wight 9cac71676e Invert template search result highlighting
Bug: T275048
Change-Id: I50fc7407b4357e2cea9d5421d0de46a81d39c69d
2021-05-17 14:12:02 +02:00
Andrew Kostka b2aa35a90a Show a warning before resetting the transclusion dialog
Bug: T272355
Change-Id: Id97190a149ed7642eda82300eeee623e0debf528
2021-05-17 13:27:37 +02:00
Adam Wight f444610fbc Support isEmpty on transclusion dialog elements
Returns true if there is no meaningful user input yet.

Will be used in the next patch.

Bug: T272355
Change-Id: I4f88ce31662bbc46755f78d574c46b907581d438
2021-05-17 13:26:11 +02:00
Andrew Kostka b2c9b225bd Add back button to the transclusion dialog
Bug: T272354
Change-Id: I08c4a7db6239b485439bf547e3e8b4d6f7aeede8
2021-05-17 13:18:14 +02:00
Andrew Kostka e0bbf0b979 Show a delete button only in the transclusion context menu
Bug: T274263
Change-Id: Ifd81994c212cd03c1318c5fd762251ce828d9195
2021-05-17 12:26:37 +02:00
jenkins-bot 71a4ad4f8e Merge "Template dialog bigger size uses "larger" preset" 2021-05-14 11:27:44 +00:00
Ed Sanders ea9ea1d17f NWE: Always paste rich text as plain, and show context item to convert
Bug: T282789
Change-Id: I1bc32c9e16140190baef9bcb08d49b4b21896883
2021-05-13 15:56:19 +01:00
Adam Wight 9607cb3ed0 Template dialog bigger size uses "larger" preset
Rather than invent our own size, we'll reuse the "larger" format and
tweak the dialog height to 90%.

Bug: T273971
Change-Id: Ibef85c1912267b14d83396b089b81934751a8328
2021-05-12 11:31:40 +02:00
Thiemo Kreuz 333cadd5d4 Add star to template search term only when it's possible
Discussed in T274903#7077957. Note this might not be the
"perfect" solution. We are still experimenting, and this is
all hidden behind a feature flag. This is the change with the
most minimal impact. Actively trimming the input is another
solution, but with a bigger impact we might want to discuss
first.

Bug: T274903
Change-Id: I2ed06c04bb96c7b61bd7e87ad001e639ea6d06a2
2021-05-11 16:31:42 +00:00
WMDE-Fisch 42b557ff80 Use add template when adding a new transclusion part
We have two cases now that we want to cover here:
- Either we're inserting a new template and start a "fresh"
  transclusion, then we want to use "search" in the headlines
- Or we're adding a new template to an exsisting
  transclusion, then we want to use "add" in the headlines

Bug: T277028
Change-Id: I9fa294cf732598d58f848c75b353d2e1742eb4e8
2021-05-11 13:13:44 +02:00