Commit graph

7996 commits

Author SHA1 Message Date
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
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
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
Svantje Lilienthal 2665734b10 Renaming temporary config variable and splitting it from cirrus search lookup
This allows using the config variable independendly from the cirrus search extension.
This way it can be used for all subtickets of T271802.

Bug: T277028
Change-Id: I1b3bdda5fa6fbfe5c531c3b51c2c8e2a28ed1faf
2021-05-10 14:47:31 +02:00
Adam Wight f89301bedf Optional verbose template search
Renames "Add a template" to "Template Search" in most cases and
provides inline help for the workflow.

Bug: T277028
Change-Id: I3fee87cb89b5044e785596e71ef3f1a18f2694ce
2021-05-10 12:45:12 +00:00
Andrew Kostka c1d36072ea Add collapsible descriptions to the transclusion dialog
Bug: T273426
Change-Id: I793a66f5c5877451b70058e9388dd86b3fcaadd7
2021-05-10 11:18:17 +00:00
jenkins-bot 68f8f26fd7 Merge "ArticleTargetLoader/Saver: Move vars inline" 2021-05-06 16:14:13 +00:00
Ed Sanders 2cf163fa23 Move vars inline in preinit code
Change-Id: Ice86931a48b4563a881af16d2fe8e344d49bc73f
2021-05-05 18:06:37 +01:00
Ed Sanders db90e1e610 ArticleTargetLoader/Saver: Move vars inline
Change-Id: I4afe5d0c68cb6284fe5178674e8942afb2b9d5bd
2021-05-05 16:56:49 +01:00
jenkins-bot 396876fe43 Merge "Check if actionTools.notices is set before using" 2021-05-05 15:16:44 +00:00
Kosta Harlan 298cb41ed3 Check if actionTools.notices is set before using
Ib957eac2d checked to see if actionTools.notices existed before
destroying it, but assumed it always existed if editNotices was
set. This patch adds a check before attempting to show editNotices.

The error occurs because Ibc7fa48df unregisters the 'notices' tool
(along with many others) for AddLinkArticleTarget.js in
GrowthExperiments. I92a3162ef in GrowthExperiments will empty out
any notices to work around this problem.

Bug: T281960
Change-Id: Idacd365efa82ecd5c0074ead035eda0cb9444b1f
2021-05-05 08:27:55 +00:00
Adam Wight d5b5300fc1 Container as a local field
We're about to replace this jQuery element by a OOUI container, and
can take an initial step by reducing its lexical scope.

Change-Id: I4123c8d22c01040fc2f61180304254498b21f5fd
2021-05-04 16:25:45 +02:00
Adam Wight cd60daf072 Internally rename container for parameter docs
The name "description" conflicts with the TemplateData field name,
which is only one of several documentation fields.

Change-Id: I0942701204fe8499e8890740585b9a02c1d14c63
2021-05-04 16:24:07 +02:00
Adam Wight abdbb7d7ff Internally rename container for adding an undocumented paramter
The internal name "more" conflicts with new collapsible buttons.

TODO: looks like TemplatePage has an analogous field?

Change-Id: I10b24758316a6cc3fbd236c77daffa014fcdafc6
2021-05-04 16:23:53 +02:00
jenkins-bot b20ad7c730 Merge "Optional feature makes the transclusion dialog bigger" 2021-05-04 10:49:44 +00:00
jenkins-bot 172684b543 Merge "Make convert to wikitext on paste feature configurable (temporarily)" 2021-05-03 22:19:53 +00:00
Ed Sanders fab7ad9d92 Make convert to wikitext on paste feature configurable (temporarily)
Bug: T280745
Change-Id: Icc716563e5536b4ef33a48ba10a72f3a39bdec35
2021-05-03 21:16:54 +00:00
Volker E c468f529fc Remove obsolete vendor prefixed properties
With updated basic support, let's remove obsolete vendor prefixed
properties.

Bug: T278670
Change-Id: I13ceec520559745c877588200024ebce16944da1
2021-05-03 08:09:01 -07:00
Adam Wight ded8c40915 Optional feature makes the transclusion dialog bigger
When $wgVisualEditorTransclusionDialogInlineDescriptions is set to
true, the template dialog will use a larger format.

Bug: T273971
Change-Id: Iad3c3f4d65125c83e35414ce15f793f6a1b192ef
2021-05-03 16:53:27 +02:00
Ed Sanders 1f50769cff ArticleTarget: Always set fromEditedState when preloaded is true
This means we don't need to check this.preloaded again anywhere else.

Bug: T279448
Change-Id: Ic8abdd87074d404a47ab8a82abf36e5443f3d163
2021-05-03 14:34:25 +01:00
jenkins-bot a4d1863a80 Merge "Use standard search API when searching for templates" 2021-05-03 08:12:35 +00:00
Thiemo Kreuz 6e08a27fc7 Use standard search API when searching for templates
Bug: T274903
Change-Id: I7de8f6cc55ab678ed741ae5ebbaad608b9a9b0db
2021-04-30 12:52:45 +00:00
Thiemo Kreuz 346216c050 Update more test code to use ES6 syntax
This patch is mostly about the arrow syntax.

Some places can not be updated because the arrow syntax also
changes the meaning of `this.…`, but some code relies on that.

Change-Id: Ida3ab0e0950a428fbd1a85f281013778ee879df4
2021-04-30 10:08:45 +00:00
Thiemo Kreuz 2611f907a9 Update all tests in the ve-mw module to use ES6 syntax
Change-Id: I75f8864c66c9b2a78c683d425d54a94515b74f24
2021-04-30 08:07:54 +00:00
Ed Sanders eff7d05ca2 Don't apply min-height hacks to TargetWidget surfaces
Change-Id: Ic8547f4408f667d8e3808b7d1e29737448b7cb8d
2021-04-29 16:00:36 +01:00
Ed Sanders bc846108d1 Remove unused 'inTargetWidget' config
Change-Id: I7708acbe1592460973e4017b594299b6d31dc328
2021-04-29 15:48:17 +01:00