Commit graph

8008 commits

Author SHA1 Message Date
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
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
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
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