Commit graph

9188 commits

Author SHA1 Message Date
jenkins-bot 1d8fb68669 Merge "Remove $wgVisualEditorTemplateSearchImprovements feature flag" 2022-06-14 12:41:09 +00:00
jenkins-bot 5b01b11724 Merge "Fixing positioning of more/less button on window resize" 2022-06-14 09:25:16 +00:00
Adam Wight e1ea921f76 Remove $wgVisualEditorTemplateSearchImprovements feature flag
The feature is always enabled now.

Bug: T307188
Change-Id: I34a3db44355d93413f611b99cd80b876d8737413
2022-06-14 10:48:19 +02:00
jenkins-bot 888f346909 Merge "Change TransclusionModel.nextUniquePartId() to return a string" 2022-06-14 08:30:09 +00:00
jenkins-bot cbeb7da3b9 Merge "Clean-up users storage after search message removal" 2022-06-14 07:17:08 +00:00
WMDE-Fisch 13f5637290 Clean-up users storage after search message removal
I'm more in favor of leaving no garbage behind. The TODO with a date
is a good way of making sure this gets removed eventually.

This could have been part of Ie6eea76. The new code is added to the
same spot where the code removed in Ie6eea76 originally was.

Bug: T296471
Depends-On: Ie6eea76dacdc614ecb910c48e7e1f519b8c69322
Change-Id: Idec63201ff4aa52a0c53c6d007577a93c94e0ec0
2022-06-14 06:59:46 +00:00
jenkins-bot d7140912c7 Merge "Fix tab messages being changed wrong by JavaScript" 2022-06-13 21:15:09 +00:00
Bartosz Dziewoński dc842277c7 Fix tab messages being changed wrong by JavaScript
Following the MediaWiki changes from T301203, we should use
the messages 'skin-view-edit' and 'skin-view-create' instead
of 'edit' and 'create'.

(Also remove redundant definitions in extension.json, we load
all messages listed in 'VisualEditorTabMessages'.)

Bug: T310529
Change-Id: If055fa2a4dc009be869425e6c2262c9b62056179
2022-06-13 20:21:32 +02:00
Svantje Lilienthal 311d26c9d4 Fixing positioning of more/less button on window resize
Bug: T309875
Change-Id: I0f35a191b39b1385a9e9f8ce77de3f033c420c55
2022-06-13 14:55:37 +02:00
jenkins-bot 3162a007c6 Merge "Change template model to not merge conflicting aliased parameters" 2022-06-13 12:27:33 +00:00
jenkins-bot f79cecc32e Merge "Remove/update template related comments that just repeat the code" 2022-06-13 12:26:01 +00:00
jenkins-bot b99ed46e1b Merge "Improve test coverage of template dialog outline" 2022-06-13 12:24:01 +00:00
jenkins-bot 24ec9b2783 Merge "Add prefixsearch fallback test for MWTemplateTitleInputWidget" 2022-06-13 12:12:09 +00:00
jenkins-bot fcf849ddb0 Merge "Remove $wgVisualEditorTransclusionDialogBackButton feature flag" 2022-06-13 08:12:40 +00:00
jenkins-bot 682b405cf6 Merge "Remove $wgVisualEditorTransclusionDialogSuggestedValues feature flag" 2022-06-13 08:00:50 +00:00
Arlo Breault 0533f49fd5 Support the upcoming mw:File typeof
The "mediaClass" property now only serves to capture the original class
found on the media so that it can be roundtripped without causing dirty
diffs.  In the 2.4.0 version of Parsoid's output, that will still be
the usual Image/Audio/Video.  As of 2.5.0, it will always be File and
the mediaClass property can be dropped.

Parsoid is currently forward compatible with serializing mw:File, so
edited or new media can use that type already.

The contextmenu item for media has been updated to make use of the
"mediaTag" instead of mediaClass to continue distinguishing media types.
That was the only place a grep of mediaClass turned up any use.

Bug: T273505
Change-Id: If5dc6b794dacd6973d3b2093e6b385591b91d539
2022-06-10 14:29:31 -04:00
Adam Wight 2e2e40e76e Remove $wgVisualEditorTransclusionDialogBackButton feature flag
Feature is always enabled now.

Bug: T307188
Change-Id: I70305ec3d2ed9cfb767ee9ea90e8ed6c93cfbdbb
2022-06-10 17:33:56 +02:00
Adam Wight 23f0bdf822 Remove $wgVisualEditorTransclusionDialogSuggestedValues feature flag
Feature is always enabled now.

Bug: T307188
Change-Id: I6f8288d31fecc6827a7a9e5e9705239e15c86ae2
2022-06-10 16:40:06 +02:00
Svantje Lilienthal 6072c46ffc Tighten spacing in VE template dialog
Bug: T308646
Change-Id: Ic785838d76dfbe2f8b776e67ccccf47fca717205
2022-06-10 14:08:56 +00:00
jenkins-bot 03a2523501 Merge "Show all elements when expanding a collapsible description" 2022-06-10 13:46:38 +00:00
Svantje Lilienthal 58fd0531d9 Remove updated feature message about search
Bug: T296471
Change-Id: Ie6eea76dacdc614ecb910c48e7e1f519b8c69322
2022-06-10 13:13:51 +00:00
Bartosz Dziewoński d6b5001580 Fire new 'wikipage.tableOfContents' hook to update TOC after save
Bug: T294950
Bug: T307480
Depends-On: I6cf76c870124c162dc1bcbc2f7e9ca0c5fdcd10e
Change-Id: Icaeda68ded94a04edef7a3629385eeb232048684
2022-06-09 11:31:50 -04:00
Andrew Kostka c8ad755112 Show all elements when expanding a collapsible description
Bug: T309875
Change-Id: If69b8bcf5574210fbc5c0b533a18977e05d7b5a4
2022-06-09 12:38:26 +02:00
Thiemo Kreuz 4c7167b571 Change template model to not merge conflicting aliased parameters
Before the (intentional) design decision was to not do anything special
when the same parameter is used multiple times (via aliases). Garbage
in, garbage out. Only the first usage of the parameter would work as
intended. The rest was ignored and subsequently removed from the
wikitext.

New design decision: Track and display duplicates as they appear in the
wikitext.

Notes:
* It's not possible to create such a situation in VE. Do this via
  wikitext.
* Labels will be made distinguishable via T309198.
* Possible warning messages will be added later.
* The behavior when unchecking a duplicate will be specified later.

Bug: T309198
Bug: T310248
Change-Id: I6011344638cdad8529d8f57513ef51b5237eb878
2022-06-09 09:26:41 +00:00
Ed Sanders 3448efc02c Update toolbar negative margin for new padding in vector-2022
Changed upstream in I5d807f09.

Bug: T309398
Change-Id: Iaf28104d2d1d7b69dd3b6144d3f6fc33711fd5ce
2022-06-09 00:29:56 +01:00
jenkins-bot 201066904f Merge "Get rid of figure-inline compatibility" 2022-06-08 19:47:22 +00:00
Arlo Breault d8bbed42ec Get rid of figure-inline compatibility
Parsoid stopped emitting figure-inline in content version 2.2.0 and VE
requests 2.4.0, which isn't satisfied by the earlier versions.

Change-Id: I5f47fbe85fdca7fe429952709b62f5d1cc548daf
2022-06-07 14:39:09 -04:00
Ed Sanders e4171b944b MobileArticleTarget: Update contentSub
Change-Id: I10db861531bd706e6b93aed3cbc501e5d717572f
2022-06-07 18:47:28 +01:00
Ed Sanders 6adeae03ed MobileArticleTarget: Update categories list if present
This only happens in AMC. Currently it is also not possible
to update categories in VE, but this may become possible if
we enable 2017WTE on mobile.

Change-Id: Ifeb6cc18910ce2fca634bc3e2245aac7e5c37e52
2022-06-07 18:45:56 +01:00
Bartosz Dziewoński 6869bc90fd ve.ui.MWLinkAnnotationInspector: Prevent long sitenames from messing up the layout
Bug: T309443
Change-Id: Ia9e9dacb7f293e2529e8d0766e1117a61e34b3e5
2022-06-01 23:34:19 +02:00
jenkins-bot 0053ed8e70 Merge "Make collapsible descriptions more responsive" 2022-05-30 10:25:57 +00:00
Andrew Kostka efa0e3ae9a Make collapsible descriptions more responsive
Bug: T307986
Change-Id: Ib28ec5a5c73fab8eb2b10ed6153a30028c3505cb
2022-05-27 16:10:00 +02:00
Thiemo Kreuz 64005eb41a Fix template dialog sometimes deleting unrelated params
The previous comment was true, but we forgot another edge-case. The
same parameter can appear multiple times. The old code tried to
delete it 2 times, which deleted something else.

Note that the behavior for duplicates is larely unspecified. We
will work on this soon. This is only a first quick step to fix this
specific bug.

Bug: T309203
Change-Id: If0afb2c19626c3d9db0d109d6559ae74698ed378
2022-05-25 16:01:44 +02:00
jenkins-bot df6b5fab51 Merge "Bump requested Parsoid HTML version to 2.4.0" 2022-05-25 00:01:18 +00:00
jenkins-bot bb7f777ffe Merge "Zero-configuration VisualEditor for mainline" 2022-05-25 00:01:15 +00:00
jenkins-bot 7276bf57cf Merge "GalleryImageNode: Handle broken images" 2022-05-24 01:40:01 +00:00
jenkins-bot 767d1e403b Merge "GalleryDialog: Use correct src attribute when rebuilding DOM" 2022-05-24 01:39:59 +00:00
jenkins-bot 5ac61e20ed Merge "ve.dm.MWGalleryImageNode: Add width/height attributes back to images" 2022-05-24 01:39:56 +00:00
Ed Sanders 5d060c34cc GalleryImageNode: Handle broken images
Most of this logic copied from MWBlockImageNode.

Change-Id: I92c860c53741c5ee48c8bce216987d97a92bc05f
2022-05-23 15:29:42 +01:00
Ed Sanders da8de2e509 GalleryDialog: Use correct src attribute when rebuilding DOM
This avoids a meaningless attirbute change with the image
is unmodified (as thumbUrl can be a different size).

Change-Id: Ib79a4703382552e38022a3f345ca5cd762c52303
2022-05-23 14:55:12 +01:00
Ed Sanders 0aa4ee1356 ve.dm.MWGalleryImageNode: Add width/height attributes back to images
These aren't used by Parsoid but help with rendering.

Change-Id: Ifff3be45ab2046ee32f0665285581c1013102dfe
2022-05-23 14:55:06 +01:00
jenkins-bot b6e398fd85 Merge "Improve collapsible descriptions for smaller screens" 2022-05-23 10:27:27 +00:00
jenkins-bot ee0f823f25 Merge "Fix non-collapsible parameter descriptions on smaller screens" 2022-05-23 10:27:24 +00:00
Bartosz Dziewoński 1cfef4232d MobileArticleTarget: Avoid jittering while scrolling
Needed after Ia18f31a299338f94e69f1882e6e477f3a22ae905 in VE core.

Bug: T307849
Depends-On: Ia18f31a299338f94e69f1882e6e477f3a22ae905
Change-Id: I87f3ac0974702ecaf7f5459604371de06f4a5756
2022-05-21 13:43:20 +00:00
Bartosz Dziewoński e84718d2b1 ve.init.mw.MobileArticleTarget: Remove hiding keyboard shortcut hints
Now done in VE core since Ie86217ba5651df8c427464e460ed836903834a3c.

Bug: T308200
Depends-On: Ie86217ba5651df8c427464e460ed836903834a3c
Change-Id: I3f65b0bc100895f7bd2262c3cbb5231fb055758b
2022-05-21 13:24:09 +00:00
Ed Sanders c64f5a78cf MWImageNode: Skip empty change descriptions
As in parent method.

Change-Id: I320d5d7a8b2f5f7c7e2715c95cbc943533c8b335
2022-05-21 04:09:41 +02:00
Ed Sanders fb1ed9e700 MWGalleryImageNode: Avoid converting altText from null to ''
Bug: T308747
Change-Id: Icd811a6baaa2213d8615bdcb3690d26aa35ab302
2022-05-21 04:09:41 +02:00
Ed Sanders f4a7dfa059 Improve visual diff of gallery when image replaced
* Implement ve.dm.MWGalleryImageNode.static.isDiffComparable to
  match ve.dm.MWImageNode, in that images with different resources
  are not compared.
* Diff galleries as documents so remove/inserts are rendered.

Bug: T308747
Change-Id: Ide6f4110e65cad7f6bb6d13766815413602fd991
2022-05-21 04:09:41 +02:00
C. Scott Ananian ede9ffbd43 Bump requested Parsoid HTML version to 2.4.0
Visual Editor currently requests MediaWiki DOM version 2.0.0
when talking to Parsoid.  Since Parsoid treats that as a request
for 2.4.0, its current version, and Parsoid doesn't have a
2.4.0->2.0.0 downgrade path, passing the latest Parsoid version
(2.4.0) should make no difference in practice -- but would better
match current reality.

Change-Id: Ia2bc0c1981db6f573a69fb1910cef4304c80ae00
2022-05-20 15:01:09 -04:00
C. Scott Ananian 57dc7aa630 Zero-configuration VisualEditor for mainline
Now that Parsoid's ServiceWorkers have been merged to core, this adds
support for "zero configuration Visual Editor" to the master branch.
Like earlier zero-conf work, this does not use RESTBase for stashing
or for reliable selective serialization.  Future integration work
with ParserCache will reintroduce this functionality.  Nevertheless,
this implementation should have feature parity with the "loopback interface"
zero conf VE we've been shipping since 1.35.

Bug: T305108
Change-Id: I7b5b4a6d16b07914f947cbaf498ad1d3cf2447a5
2022-05-20 15:01:09 -04:00
Andrew Kostka 46846d1b01 Improve collapsible descriptions for smaller screens
Bug: T307986
Change-Id: Iac6205fc90a884965c2e37cf6ed4b403874256d8
2022-05-19 12:39:20 +02:00
Andrew Kostka 0c176752eb Fix non-collapsible parameter descriptions on smaller screens
This patch fixes a bug which causes long parameter descriptions to
be to non-collapsible when adding them from the sidebar-only view on
smaller screens.

Change-Id: If373587a9b2c3841ad6814f74bfcbf0c0f013488
2022-05-19 12:26:30 +02:00
David Lynch b59625158d Update schema logging of bucket for new DiscussionTools A/B test
Bug: T304030
Depends-On: I5e57bb9b7958576f3a04373748331a86f4626fb5
Change-Id: I2ef4c64a55eebc0d2eeca7a57b84b8ba0ded1499
2022-05-19 01:20:33 -05:00
jenkins-bot 37a5099471 Merge "Implement replacePageContent in MobileArticleTarget" 2022-05-17 21:22:50 +00:00
jenkins-bot fc8b909fb7 Merge "ArticleTarget: Always reload the page after save on non-view page" 2022-05-17 21:22:33 +00:00
Thiemo Kreuz aa989c00dd Extract MWExpandableContentElement.onButtonClick method
This is done in preparation for Iac6205f to make it easier to review.
This patch here is meant to be a no-op that doesn't change anything,
just moves existing code around.

Bug: T307986
Change-Id: Ie6ccd9528e5799ba340fed344e1f47a443c2c51f
2022-05-16 12:43:10 +02:00
Ed Sanders c877dc47fc Implement replacePageContent in MobileArticleTarget
Change-Id: I5b31bb9406bea15c5473363ba8fcda4c14f90994
Depends-On: Ifeb7c71e053501bc2c9448459c68895cb11368bd
Bug: T219420
2022-05-13 22:53:02 +01:00
Ed Sanders 37b81b5ba4 ArticleTarget: Always reload the page after save on non-view page
This is currently only handled in DesktopArticleTarget in teardown,
which happens after we've wasted time trying to update the page.

Also ensure we always reload on non-view pages on MobileArticleTarget
for other types of teardown (e.g. quitting the editor).

Change-Id: I7fb352fcacc8727bb113115e98af38a3940a8f9c
2022-05-13 22:53:02 +01:00
Ed Sanders ae58439c41 Upstream teardown of saveDialog from DesktopArticleTarget to ArticleTarget
Change-Id: I2e28f604d7e34fed15d9b74b6723347e3a17ce9e
2022-05-13 22:52:40 +01:00
Ed Sanders be2fc6c814 Upstream isViewPage from DesktopArticleTarget to ArticleTarget
Change-Id: Ic3839d9d70d6d4127fe2cd9bc01da799027fed3c
2022-05-13 22:47:06 +01:00
Andrew Kostka dda7d8e9c1 Hide the floating help button on small screens
Bug: T307981
Change-Id: I7c1776f95f22e9c81b559f25ad97616d2f1a8dc2
2022-05-12 06:32:16 +02:00
Ed Sanders 6e647b4858 Follow-up I420bfcac8: Fix typo in loop
Bug: T298147
Change-Id: Ia725709e221994737f393791de914994dbf415dd
2022-05-12 00:20:54 +01:00
jenkins-bot 1ed40a266e Merge "Filter <script> tags during parse, instead of save" 2022-05-11 21:52:47 +00:00
Ed Sanders 4dd590432e Filter <script> tags during parse, instead of save
This is a test to identify the soruce of stray <script> tags.

Bug: T298147
Change-Id: I420bfcac89528f3a11742214dd51fadd6281fd91
2022-05-10 17:31:22 +01:00
Thiemo Kreuz 53b169ab43 Update CSS to force word wrap in unused parameters button
Follow-up for what was done in I37505af. I don't fully understand why
these two extras are sometimes needed and sometimes not. But this exact
combination of 3 properties is used in multiple places already, so
let's just do the same here.

Bug: T300008
Change-Id: I1eba5fc378475d365111add58a141c3114dc0118
2022-05-10 10:20:44 +02:00
jenkins-bot d411579917 Merge "ArticleTarget: Ensure dataPromise rejects when switching fails" 2022-05-09 23:31:42 +00:00
Ed Sanders ab3b068671 build: Update stylelint-config-wikimedia to 0.13.0
Change-Id: I94a18ebc57ea04fe6246b63f6c9b5d5d8718dd4d
2022-05-04 22:54:48 +01:00
Ed Sanders bc57422841 Remove unused CSS vendor prefixes
Change-Id: Id544adce0d88123157f3f52540f7f767027ff6ab
2022-05-04 16:55:43 +01:00
Thiemo Kreuz 9297428eca Improve test coverage of template dialog outline
This focuses on some scenarios that are
a) complex enough to be worth a test,
b) but simple enough so I don't need to spend hours on comming up
   with a test setup. ;-)

This patch also simplifies the ARIA related code in
MWTransclusionOutlinePartWidget a bit.
* Check 1 of the 3 ARIA configs only. Only having one is already
  helpful and should not be skipped.
* No need for the large conditional. setAriaDescribedBy() works fine
  with undefined.

Bug: T291157
Change-Id: I142782ec9b96147de64497f4f6a373eae05b9c8e
2022-05-04 12:01:58 +02:00
Thiemo Kreuz 2cd08e42d7 Add prefixsearch fallback test for MWTemplateTitleInputWidget
The idea of the code under test is that it combines the results from
2 different API requests in a specific way. This is a first basic test
where both search results are small.

Bug: T291158
Change-Id: Ic4de57fb6b85afb952ea604769fddd06d44814c0
2022-05-04 07:11:15 +00:00
jenkins-bot 0e77a51898 Merge "Stop hide unused label from overflowing" 2022-04-29 08:45:20 +00:00
WMDE-Fisch 4377893297 Stop hide unused label from overflowing
Will implicitly set a max width for the button due to the margin.
Long words will break in the middle of the word.

Also includes a shorter label.

Bug: T300008
Change-Id: I37505af8383d8c0c2bd4af3987ec5e2a3049688a
2022-04-29 10:26:20 +02:00
WMDE-Fisch d996288169 Move message about missing parameters to sidebar
Will be removed when parameters are added. Needs different margins
depending on beeing shown in the single transclusion mode without
header or on multiple transclusions.

Bug: T300710
Change-Id: Ieb95d7276aa4d4b0fcbb74f87ab734e4a393dc21
2022-04-29 10:03:23 +02:00
Ed Sanders b428b296e5 ArticleTarget: Ensure dataPromise rejects when switching fails
Requires switchToFallbackWikitextEditor to return a promise.

We can now pass dataPromise to the progress bar shown when
switching editors, so it hides if the switch fails.

Also fix logic for when a failed load is not retried.

Bug: T306763
Change-Id: I752ca505e7957b392202d44455b1e21b6e50fa63
2022-04-26 16:32:52 +01:00
Bartosz Dziewoński d33d88a186 More tests for pasting external links
Change-Id: I2281be66b901d0c969c75869faa4fa632d33118b
2022-04-22 04:43:51 +02:00
rvogel f69438fae6 Check for external url protocols during conversion
If links get pasted into VE and they lack a "//" in the `href`, they
are automatically considered to be "internal", thus being converted into
`[[...]]` wikitext links.

In case of pseudo protocols like `mailto:` this should not be the case.

This patch uses MediaWiki core settings to check if a `href` value is an
external protocol known to the application.

Bug: T297575
Depends-On: I2e584f6d5adc6b2d735e79cea64f2beeb5f2c36d
Change-Id: I2b383106450e02cc6bcc1b99d547ff2ed7832b4c
2022-04-22 01:36:41 +02:00
Thiemo Kreuz 8831887e3c Update template search fallback to max out at 10
Before, the fallback algorithm was somewhat adaptive, trying harder and
harder the fewer CirrusSearch results have been found. This updated
algorithm guarantees that 10 results are shown.

Warning: You might see only 9 results. The reason is a bogus, unrelated
behavior in the mw.widgets.TitleWidget in core that's used as a base
class here. There is a "showMissing" option that's apparently enabled
by default, and prepends a non-existing title from the main namespace,
ignoring the "namespace" option. This extra result from the wrong
namespace is later dropped by the very same widget.

This code here sees 10 results before the bogus one is dropped.
Disabling "showMissing" causes other issues. We would need a series (?)
of custom hacks to work around all this, but this seems inappropriate.
Let's live with 9 for the moment.

Bug: T303524
Change-Id: I2c577c9ef2752b6c6cd360f4023e151e9272fcd5
2022-04-21 09:25:00 +00:00
Thiemo Kreuz 50497ee7f3 Drop assumption that all template search index start at 1
The main advantage of this change is that it drops the assumption
that the index starts with 1. This is not necessarily the case when
we prepend extra search results. Dropping this assumption here allows
to simplify such code.

* The incoming list of pages is guaranteed to be an array.
* There is no point (any more) that could cause the array to become
  sparse.
* Note we still make a copy of the `origPages` array at some point,
  e.g. on `.filter()`.

Bug: T303524
Change-Id: Ifbd92bb052155c613d2ca21ab6d54a0b3ef28c0c
2022-04-21 11:23:48 +02:00
jenkins-bot 20e26000e2 Merge "Update VE core submodule to master (86de64d69)" 2022-04-20 23:58:32 +00:00
Ed Sanders 184106418e Update VE core submodule to master (86de64d69)
New changes:
72bd71dbc Localisation updates from https://translatewiki.net.
b7f38d993 Re-apply "Fix for showing "invisible icon" when root node is hidden""

Local changes:
* Ensure templates are attached to DOM before rendering invisible
  icon in converter hack.

Bug: T305110
Change-Id: I0e4c02619b2a06b9932f214ae482093fdb0cb22c
2022-04-20 23:45:31 +01:00
Thiemo Kreuz 89e5c2fb92 Disable useless "showMissing" option in TemplateTitleInputWidget
This option is not only buggy (it just doesn't work when the namespace
option is set the same time), it is not useful in this context even
if it would work. It doesn't make much sense to suggest non-existing
templates in the context of the template dialog. If adding a
non-existing template really is what the user wants, they can still do
this by simply typing the name of the template and submitting the form.
We never need this to show up in the suggester below the input field.

The main advantage of this change is that is saves 1 useless API
request that's potentially done every time a key is pressed.

Bug: T303524
Change-Id: I903340a06d6e6490bb58f628f41903aa044ccb21
2022-04-20 14:43:29 +00:00
Thiemo Kreuz d3d3e1cf75 Move "index from redirect" logic up in template search widget
This separates the two steps:
1. See if items in the list of `origPages` miss their `.index`
   property, and add it if possible.
2. Later code doesn't need to care about redirects any more.

Note that `origPages` is not used for anything else. And even if,
it's not wrong to have the index for each search result on both the
redirect and the redirect target.

Change-Id: I12135f0430c944b4e33c49ece7779d7c3bb6c211
2022-04-20 14:50:36 +02:00
Thiemo Kreuz e24c8ecd2d Fix misleading variable name in TemplateTitleInputWidget
This is not a pageid, but a simple numeric index in an array. Luckily
it doesn't make a practical difference for this particluar way of
iterating something.

Change-Id: I7ec9ace00d4fba7adde17670058a0365b30f5617
2022-04-19 14:40:00 +00:00
Thiemo Kreuz c72d8abdc3 Remove/update template related comments that just repeat the code
Such comments don't add any new information. The method signature
alone already tells the full story.

We did this already to a lot of the template related code we touched.
This is just a bit of cleanup to make it consistent.

Change-Id: I932b620910924a16dc0d31d6c8a3ab11818316fe
2022-04-19 13:58:32 +02:00
Thiemo Kreuz d59a4366db Change TransclusionModel.nextUniquePartId() to return a string
The numeric part of these ids is never used on it's own. There is no
need to expose it.

Note we renamed the method not long ago in I6eeab8b to reflect better
what it does. This is the next step. We just forgot it back then.

Change-Id: I5da82855e99ea3a42a5d91379c6974ae9c154518
2022-04-19 13:48:30 +02:00
Thiemo Kreuz af2779fc06 Fix API response default in TemplateTitleInputWidget
The result is guaranteed to be in formatversion=2, where the list of
pages is an array, not an object.

Change-Id: Ic73a68c3e249a70108a6a19a89f4ff6c475794ed
2022-04-19 13:35:27 +02:00
jenkins-bot d1e777afcd Merge "Simplify ve-mw/init/styles LESS files" 2022-04-08 22:37:10 +00:00
jenkins-bot 616fa37de4 Merge "Fill template search results with prefix matches when Cirrus fails" 2022-04-08 11:57:23 +00:00
jenkins-bot 82051a35d3 Merge "DesktopArticleTarget.init: Wait for deactivating to finish before activating" 2022-04-08 08:49:55 +00:00
Bartosz Dziewoński c8b0f17ce6 Store copyright message in auto-save data
Bug: T305225
Change-Id: Ie70587393715a461509dac6192d033a05c894f96
2022-04-07 23:03:37 +00:00
Bartosz Dziewoński 37bb0075db Add tests for the expected properties in API result and auto-save
The goal is to have some tests fail if a new property is added to the
API result, but it's not stored in auto-save data.

Bug: T305225
Change-Id: I9ac328c71c616a8f33e1cfb39431cd9a665adafc
2022-04-08 01:02:53 +02:00
Bartosz Dziewoński bda0f44666 DesktopArticleTarget.init: Wait for deactivating to finish before activating
Bug: T305449
Change-Id: Ic2170450c851a10d01ef88c0b1de11d1d573acea
2022-04-07 23:26:58 +02:00
jenkins-bot be8625576a Merge "Remove "delete" button from link node desktop context" 2022-04-01 15:44:23 +00:00
jenkins-bot d03f54bc56 Merge "Use new config option signature when building sequences" 2022-04-01 15:44:20 +00:00
jenkins-bot 9ae30574e1 Merge "Follow-up I0eaeb987: Sync temp wikitext editor before activating target" 2022-04-01 15:44:12 +00:00
jenkins-bot 5fef22001d Merge "Full fallback to prefixsearch when Cirrus returns nothing" 2022-04-01 13:24:51 +00:00
jenkins-bot 2daec32db2 Merge "Use boolean RegExp.test() instead of .match() where possible" 2022-03-31 21:20:44 +00:00
Ed Sanders 5fa2373f15 Follow-up I0eaeb987: Sync temp wikitext editor before activating target
The refactor in I0eaeb987 broke this feature by moving
the call that modifies the response object to after it
is passed to the target.

Change-Id: Id98c1ccabde478540af34ed3356f319ae336590a
2022-03-31 22:01:19 +01:00
Bartosz Dziewoński 130f3e80fc Update VE core submodule to master (38b8213b5)
New changes:
91a762803 ve.dm.ModelRegistry: Disallow unknown types on tag and tag+func matches
8575e8ad8 PreviewElement: Document event
d24f96874 Allow unknown types for ve.dm.AlienMetaItem
106354b38 Follow-up I534ce003d: Fix height restriction calculation of desktop context

Local changes:
* Allow unknown types for ve.dm.MWExternalLinkAnnotation, it is meant
  to match all <a> tags and handles unknown types in toDataElement()

Depends-On: I785be75f389136769084a8e14832a09e3a519fc1
Bug: T303298
Bug: T304847
Change-Id: I75d1e82a43f5f96a9093cd334c524527918efaa5
2022-03-31 13:01:51 +02:00
Ed Sanders 6068cec0e8 Remove "delete" button from link node desktop context
This was added to make the context a bit more consistent
with the regular link inspector, however with I2fec865570
we making these delete buttons strictly mobile only.

Change-Id: I52936919e332aee851ccd11a862367c97eb41b39
2022-03-30 17:43:02 +01:00
Thiemo Kreuz 912bc34f62 Fill template search results with prefix matches when Cirrus fails
This code is optimized for the 2 most relevant use cases:

1. When Cirrus finds 10 results, we still want to search for the top 1
prefix match. This is critical for templates like !!. This will appear
at the top. unshiftPages() makes sure the limit of 10 is enforced.

2. When Cirrus fails to find anything, we search for 10 prefix matches
and use these instead.

The code can also handle everything in between. For example, when
Cirrus finds 5 results, we search for 5 more prefix matches and add
them when Cirrus missed them. The total number in the end might be 5 to
10 depending on the number of duplicates. This is intentional. Why?
Let's say we always search for 10 prefix matches and add them to the
top when Cirrus missed them. This might remove _all_ Cirrus results.
This shouldn't happen. This extra code is only to fill in glaring gaps,
not to replace Cirrus. 5 results are fine.

Bug: T303524
Change-Id: Ib0471795124c0c7001b6901edaf8e7b380e426b1
2022-03-29 13:18:12 +02:00
Thiemo Kreuz 6bbf7d1907 Full fallback to prefixsearch when Cirrus returns nothing
There is already some kind of "fallback" to prefixsearch. We always
check if the top-1 prefixsearch result is part of the result set.
Because of this the current worst-case scenario is that only this
1 result is shown.

This patch implements a full fallback to prefixsearch. But only when
there are 0 CirrusSearch results. Further tuning might be done in
later patches.

Bug: T304925
Change-Id: I1927eedad60c9b9ac2021481a85376c08ccf6fdb
2022-03-29 13:17:05 +02:00
jenkins-bot 2913158b35 Merge "Remove delete button from template context" 2022-03-26 17:22:40 +00:00
Thiemo Kreuz c8af207681 Use boolean RegExp.test() instead of .match() where possible
.test() is the dedicated syntax for a boolean "does match? yes/no?"
check. .match() returns an array of matches, or null. This is just not
needed in these situations.

Change-Id: Ibb996ab843d1a6c7d7af98d6a112990665d543b2
2022-03-24 11:04:43 +01:00
Ed Sanders be2a1ccf62 Respect useeditwarning user option when tearing down target
Also invert logic and rename variables to make tests in tryTeardown
and switchToWikitextSection identical.

Bug: T294463
Change-Id: Icb86a676c3f315e4a3d229f46eb383dcd7959973
2022-03-23 14:55:13 +00:00
Thiemo Kreuz a6f784c095 Fix hiding unused template parameters sometimes not working
We ended mixing two concepts in a single method:

* We need a method that allows us to create the parameter list widget
when it's needed, even if it's empty. This is relevant when a template
is entirely empty, and the first parameter is added. This wasn't
working. Instead the parameter list was created with all parameters.

* On initialization we either want all parameters to be shown, or only
used ones. But this code is only needed once, on initialization. I
ended inlining this code in this patch.

Bug: T300640
Bug: T304046
Change-Id: I6620a870e4420dcb8fecf522b3274458eeec891d
2022-03-22 15:41:55 +01:00
jenkins-bot 47ac0d243b Merge "Set desktop context / inspector padding to -10px in vector-2022" 2022-03-22 01:14:31 +00:00
jenkins-bot ce9809d113 Merge "Fix resize of MWAceEditorWidget when setting up" 2022-03-22 01:03:48 +00:00
Arlo Breault dfa1c315bb Preserve classes on broken media elements
A class, mw-broken-media, was added in
I92359048b42d32fe8a0f2cb79cd348cf5f2c56cc

Bug: T304010
Bug: T270150
Change-Id: I542d7d879868c9030ce00b2686cdfd0077e49491
2022-03-21 17:42:39 -04:00
jenkins-bot 43a06844f9 Merge "Fix review button shown when review panel is already active" 2022-03-21 17:12:37 +00:00
Thiemo Kreuz 6eaf0ef55b Fix review button shown when review panel is already active
These two lines forcefully enabled the review/preview buttons, even
when the review/preview panel is already active.

Bug: T300448
Change-Id: I6dbe6ee88728a65233a455b768f17bff668fe3a8
2022-03-21 11:37:58 +01:00
Adam Wight b079440068 Fix template dialog parameter padding on mobile
In the mobile view, parameters don't have left padding so some styles
should only be applied to the desktop stylesheet.

Bug: T304167
Change-Id: I1846512c21aae36f212fe142b7d96ac91e46854b
2022-03-21 09:53:22 +01:00
Ed Sanders 58f6f0195a Remove delete button from template context
Currently in VE desktop, items which can be deleted with
delete/backspace do not have this button. If that situation is
considered a problem it sould be solved consitently for all
focusable nodes as part of a wider fix.

Adding a delete button to template contexts makes them inconsistent
with other focusable nodes.

Bug: T274263
Change-Id: I2f7508a605852274ba8f40b2afd1dfd56600aa36
2022-03-20 18:09:31 +00:00
Ed Sanders 8c36a630db Set desktop context / inspector padding to -10px in vector-2022
Bug: T258501
Depends-On: Ifaaa0dad4ecda3ff25d5fac54ccd2c95087d6f50
Change-Id: Id1f0a6d74740cf979de2b4a7f2a9f2e197615a13
2022-03-19 13:47:39 +00:00
Ed Sanders f6ea2e3457 Fix resize of MWAceEditorWidget when setting up
Bug: T303964
Change-Id: Ic8efbd7df74213fddaec987aff60e733f9550db2
2022-03-18 22:30:54 +00:00
Adam Wight bf7f022686 Fix right padding on inline descriptions without the new sidebar
This fixes a styling issue with inline descriptions, for the scenario
when the inline description feature is enabled but the new sidebar is
disabled.

Bug: T304167
Change-Id: Ida4da4605da5143de2a27725d87d5876aea7065c
2022-03-18 17:16:48 +01:00
Ed Sanders 60c2239e06 eslint: Lint root files with server rules
Change-Id: I872ab9dd7844eb8885dc30b40a2429875f7591c7
2022-03-17 23:39:53 +00:00
jenkins-bot 401da7ee13 Merge "Remove MWDismissibleMessageWidget and use MessageWidget's showClose option instead" 2022-03-17 11:43:33 +00:00
jenkins-bot 32d9150762 Merge "Rename ve-mw/init/styles to LESS" 2022-03-15 23:16:32 +00:00
Ed Sanders 38dfa608f8 Simplify ve-mw/init/styles LESS files
Change-Id: I49e05c9680e1fe7db8e01df627a6d5fa2836aac8
2022-03-15 23:10:34 +00:00
Ed Sanders 627bbc4aaf Rename ve-mw/init/styles to LESS
Change-Id: I50969b8798637368942b2d9315e7290f2c579f77
2022-03-15 22:16:59 +00:00
jenkins-bot cada5a3ab8 Merge "Extract template scrollToTop method" 2022-03-15 12:17:50 +00:00
Ed Sanders 1fdda82b58 Remove Apex skin files
The Apex skin (not to be confused with the Apex OOUI theme)
is abandonware. Keeping files around that pretend to support it
is just maintenance debt.

Change-Id: I176e4e25307ab8ca4166a6e9b55e3bec4f058d05
2022-03-12 14:23:23 +00:00
Ed Sanders 5b92c66e97 Use new config option signature when building sequences
Change-Id: Id93327e9afdad8d761a079b17b47e7bbe32bd5e2
Depends-On: I1011602514f0f21c5764b14563d8213ecc19f49a
2022-03-11 17:12:54 +00:00
WMDE-Fisch 96dc96da8d Extract template scrollToTop method
Also putting the findFirstSelected to where it belongs.

Bug: T302965
Change-Id: Ibc56abfdf84a0b5eade5b6a44903d769f424206d
2022-03-11 12:30:51 +01:00
WMDE-Fisch 824648b32a Streamline hide unused handling
Extracted the state change so we do not need the `internal` var.

Change-Id: I0ce1afab35abf3e0e656ad1a3601513d55406537
2022-03-11 12:02:32 +01:00
jenkins-bot 4a8ca84ecc Merge "Scroll template outline into view when hiding unused" 2022-03-11 10:22:37 +00:00
jenkins-bot 174c7a39f6 Merge "tests: Use ve.test.utils.newMwEnvironment()" 2022-03-10 22:51:26 +00:00
jenkins-bot ecbfa2c19e Merge "Follow-up I560d8080: Fix getTargetDataFromHref to work with different wiki configs" 2022-03-10 22:50:22 +00:00
Arlo Breault 79120fc16c Preserve classes on media wrapper links
Parsoid added a class and, without it, we get selser complaining
about wrappers being modified, similar to T214649.

The "image" class is removed since Parsoid never added it (although it
now has "mw-file-description" for a similar purpose) and the legacy
parser doesn't apply it indiscriminately.

It doesn't seem like VE supports editing the |link= media option; it
just tries to roundtrip what's there and drops it on edit.  The patch
here works with that limitation.

Galleries are found to drop href's, breaking selser, and should be fixed
in a follow up.

Bug: T292657
Bug: T303469
Change-Id: I92359048b42d32fe8a0f2cb79cd348cf5f2c56cc
2022-03-10 10:41:14 -05:00
Ed Sanders bc0e96f78a tests: Use ve.test.utils.newMwEnvironment()
This calls "parent" methods automatically, and allow us to
pass a config parameter for MW config.

Change-Id: I571d4599d7fca55727070bcac6083d1232b1f61c
2022-03-10 01:44:11 +00:00
Ed Sanders 77719b873c Follow-up I560d8080: Fix getTargetDataFromHref to work with different wiki configs
Change-Id: I8324a72418080beb3944314decc6792850392812
2022-03-10 01:10:45 +00:00
WMDE-Fisch 037e7ad0b2 Scroll template outline into view when hiding unused
Due to the stickyness we need to scroll the header and the first
visible item from the parameter list to have the best result in all
cases.

We also only want to scroll when the user triggered hiding the
fields. Not when the template outline view is initialized.

Bug: T302965
Change-Id: I84d293888a7dbf13ec655c293c0fc3a79edca698
2022-03-09 19:45:07 +01:00
jenkins-bot b26d62072e Merge "Fix missing padding on inline descriptions" 2022-03-09 13:13:24 +00:00
WMDE-Fisch e5277dd838 Fix missing padding on inline descriptions
Bug: T303386
Change-Id: Id0567102d9c8d7f0f3740085027713a2574141ef
2022-03-09 13:08:52 +01:00
Bartosz Dziewoński 94633fd165 Use $.parseHTML() in tests where appropriate
It removes some indirection.

* Find:          \$\( '<.+?' \)\.toArray\(\)
* Replace with:  $.parseHTML( \1 )

(also replaced a few by hand that weren't caught by that regexp)

Change-Id: I2639cc4a26bc960046a189504dd8058344e14d60
2022-03-09 01:07:57 +01:00
Ed Sanders 24973a2928 Update VE core submodule to master (15c1efdc2)
New changes:
cf7b2a9c4 Restore margin between wrapper paragraphs and document edge
629109b6b ve.ce.Surface tests: Sometimes assert originalDomElements in paste tests
3a5bd323c Use wrapper paragraphs in fixUpInsertion

Local changes:
* Update tests to ignore some internal properties

Bug: T299815
Bug: T299817
Change-Id: Ie52348f62320eb135c2f950ac78a77d9c665fef2
2022-03-09 01:05:15 +01:00
David Lynch d09c241549 MWEntityNode: Remove now-unnecessary allowedRdfaTypes
This was added back in 2020 so mw:DisplaySpace would work while the
RESTBase cache still contained old data. It's been two years, it should
be good now.

Follow-up to ed3579245e

Change-Id: I65665231b78198633682d52c48068c89807df55e
2022-03-08 11:27:29 -06:00
Ed Sanders fae8aece16 mw.libs.ve.getTargetDataFromHref: Don't check for internal links twice
Once we determined a link is internal from the first regex, we don't to
check if it matches the wgScript path as well. This would cause
"/index.php/Article" style paths to be detected as external as they failed
this second check.

Change-Id: I560d8080c513c523c68f2750be332e9fd91de192
2022-03-04 13:44:14 +00:00
Ed Sanders 3b2dc7bbfb DesktopArticleTarget tests: Mock config using QUnit.newMwEnvironment
Also mock some additional config to prevent the page from trying
to reload on teardown.

Change-Id: Ib20c1f5277c5d5a99f5117c82b7cbdeab75d3279
2022-03-04 13:36:22 +00:00
jenkins-bot 96c32dcfb7 Merge "Allow auto-save recovery notifications to be suppressed" 2022-03-03 23:25:41 +00:00
Ed Sanders 4f578c269c Allow auto-save recovery notifications to be suppressed
Bug: T302327
Change-Id: If94e603458a385ba6eb15c4e29144f72e3ad12ca
2022-03-03 23:09:25 +00:00
jenkins-bot abff70ff2d Merge "Fix missing return value and related docs in MWTransclusionNode" 2022-03-03 21:49:54 +00:00
Ed Sanders 29b9c9c34a Remove logic for disabling VE when certain extensions are running
This logic has been moved to the relevant extensions which can
now disable VE using a hook.

Depends-On: I47880be15b6ce1a93f389a32aff304cc3b798bcb
Depends-On: If188e8fcceb248738fc625ddd5afec351c01c484
Bug: T174180
Change-Id: I245295373af3caffb1d4cbc288e8d2bd008520b7
2022-03-02 21:20:55 +00:00
Thiemo Kreuz eb25116734 Block Ctrl+Del/Backspace when Remove button is inaccessible
* I can't guarantee this fixes T301914. But I suspect the bug can not
be triggered any more with this plus If9b6050 in place.

* I wasn't able to reproduce the issue locally. But I learned that
  1. it's related to the hotkey, and
  2. it's because the dialog looses focus, and the focus ends on the
     VE surface in te background. Pressing Esc there closes VE. That's
     intended behavior.

* I tried to use .trigger( 'click' ), but it doesn't make much of a
difference. The only magic check is if the button is disabled. But no
visibility checks are done.

Bug: T301914
Change-Id: I2f66fc2411144c60cd08baae58452d336b4e9802
2022-03-02 11:56:29 +00:00
Thiemo Kreuz 836d36bc16 Skip initial creation of unused parameter widget
In a test case with 200 templates where all but a few parameters are
unused the loading time is cut in half.

Bug: T300974
Change-Id: Ice850cb9e5e95b9e3a19ff511b3a4f32117c7199
2022-03-02 10:19:46 +00:00
Ed Sanders 1b5550f485 Move var declarations inline
Mostly ve-mw/ui and a few left overs.

Change-Id: Idea0c94d974e661c49af8ad4545cd8fd98179ca8
2022-03-01 17:50:24 +00:00
jenkins-bot 976272fa41 Merge "Fix spacing between sticky find bar and field list" 2022-03-01 14:42:32 +00:00
jenkins-bot 46cfbc74bd Merge "Added check for hotkey action on input or textareas" 2022-03-01 12:00:20 +00:00
Svantje Lilienthal fb95572429 Added check for hotkey action on input or textareas
Bug: T301913
Change-Id: If9b6050c378836157fa1df5b9782ba4632890f1a
2022-03-01 10:14:52 +00:00