Commit graph

806 commits

Author SHA1 Message Date
Adam Wight 2759752a0a Simplify interface to remove pages
Makes some things easier, some harder—not sure if this is a helpful
patch.

Change-Id: If56e9b2fbc1796cd637aaeececec779d31a7921f
2022-07-18 05:31:42 +00:00
WMDE-Fisch b75082009a Differ between setting and highlighting a parameter
Introducing a set method to have a different state for a set
parameter and a highlighted one in the selection.

Allows us to remove a lot of workarounds for missusing the
highlight state and fixes several issues with these workarounds.

Main implications:
- Keyboard navigation and mouse hover now sets the grey highlight
- If a parameter is set (blue highlight) keyboard navigation returns
  when focusing the SelectWidget
- If nothing is set keyboard navigation starts at the top after focus
- Unchecking a parameter using space will not influence the keyboard
  focus in the list
- Highlighting a parameter with the mouse lets keyboard navigation
  continue from there.

Bug: T312647
Bug: T311204
Bug: T312213
Depends-On: I385dca1d95033961d3844e888521750443e49c95
Change-Id: Iaf089f4b271fd853b17c1aa7f5938510ea8f5431
2022-07-12 10:18:56 +00:00
WMDE-Fisch bc4fcfa04a Remove selection when selected parameter is unchecked
Adjusting some methods to support the usecase.

Bug: T312085
Change-Id: I4b97ab912f9ac0046f72167c3b573ee8e14e58d9
2022-07-05 19:22:36 +02:00
Andrew Kostka 54f4b47794 Add initial tests for ve.ui.MWTwoPaneTransclusionDialogLayout
Bug: T311116
Change-Id: Ie4e1f9f203055f68add6fea0cf04b03215a32942
2022-06-26 17:15:11 +02:00
Thiemo Kreuz d5857c20f5 Remove invisible stuff from BookletLayout OutlineItems
Technically the old BookletLayout sidebar is still there. But it's
never visible, effectively dead, and meant to be removed. This patch
just empties the OutlineItems of all template dialog related pages
without actually disabling the old sidebar.

Note this partly reverts Ie57f462.

Bug: T310859
Bug: T310866
Change-Id: Ic0b7d703f369045ed342426563f8eeb3e47046db
2022-06-20 09:31:53 +00:00
Thiemo Kreuz 218ac78960 Remove obsolete "search for a parameter" page and widgets
… as well as messages, CSS, and icons that are now unused.

Bug: T310859
Change-Id: I1a2797728788cf1a86299414c1430ded0b362d4e
2022-06-17 10:23:00 +02:00
Adam Wight 1b4c81c27d Remove $wgVisualEditorTransclusionDialogInlineDescriptions feature flag
The feature is always enabled now.

Bug: T307188
Change-Id: Id8b39d44901dee9118837fc4670d7faa4ef19b43
2022-06-15 12:09:47 +02:00
jenkins-bot 6a7da15fe5 Merge "Support the upcoming mw:File typeof" 2022-06-14 15:25:11 +00:00
jenkins-bot 888f346909 Merge "Change TransclusionModel.nextUniquePartId() to return a string" 2022-06-14 08:30:09 +00:00
jenkins-bot 3162a007c6 Merge "Change template model to not merge conflicting aliased parameters" 2022-06-13 12:27:33 +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
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 23f0bdf822 Remove $wgVisualEditorTransclusionDialogSuggestedValues feature flag
Feature is always enabled now.

Bug: T307188
Change-Id: I6f8288d31fecc6827a7a9e5e9705239e15c86ae2
2022-06-10 16:40:06 +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
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 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 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
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
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 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
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
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
Ed Sanders 60c2239e06 eslint: Lint root files with server rules
Change-Id: I872ab9dd7844eb8885dc30b40a2429875f7591c7
2022-03-17 23:39:53 +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
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
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
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
jenkins-bot fe69e22761 Merge "tests: Mock wgVisualEditor instead of relying on SpecialPage value" 2022-02-21 13:32:51 +00:00
jenkins-bot 2a72f4e290 Merge "Remove not needed self = this indirections" 2022-02-21 12:57:41 +00:00
Thiemo Kreuz 3c042049bf Use .bind() syntax where it makes code more readable
This focuses on a few trivial cases where the syntax helps making
the code more readable. One level of indirection is gone with this.

Change-Id: Ibf25d7eaa06952e69b36bd5a78a48d04ac62890c
2022-02-21 10:34:03 +00:00
Thiemo Kreuz 58e27f56d6 Remove not needed self = this indirections
These are only needed when we need to access a specific `this` from
within another `function () {}` context. This is not the case in the
situations here.

This is split from Ibf25d7e to make it smaller and easier to argue
about.

Change-Id: Ide1476de91fc343aa992ad92a1321d3a38b06dd0
2022-02-21 10:52:24 +01:00
Timo Tijhof bdb7737a5a tests: Mock wgVisualEditor instead of relying on SpecialPage value
Found via Iaf989bc50363a (patch set 6):

> FAILED TESTS:
>   ve.init.mw.DesktopArticleTarget
>     ✖ init
>     Died on test #1
>     TypeError: Cannot set property 'pageLanguageCode' of null
>         at Object.<anonymous>

Bug: T89434
Change-Id: I8ad2cc4c115224eb276d1488091b9518fde739f9
2022-02-16 10:19:11 +00:00
Bartosz Dziewoński a2390efbf4 Re-apply "Re-duplicate deduplicated TemplateStyles"
Previous attempt in 005a8d24ef,
reverted in 3c1d167b33.

The deduplicateStyles() function lacked a check for fosterable
positions, which caused T299767. This is now fixed.

Also added tests.

Bug: T287675
Bug: T299251
Change-Id: I0d22be9b66d26d09373cee63dd6ce52c1659e62d
2022-01-28 02:08:09 +01:00
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