Commit graph

8893 commits

Author SHA1 Message Date
jenkins-bot 8e5de75d12 Merge "MWImage: Fix handling of error-image dimensions" 2022-01-22 01:07:39 +00:00
jenkins-bot 7fe6ce8701 Merge "Broken image: Fix DM HTML for preview to include redlink text" 2022-01-22 01:07:36 +00:00
jenkins-bot 06a9074c44 Merge "MWImage: Cache dataElement.attributes" 2022-01-22 01:07:34 +00:00
jenkins-bot 43b2b3de95 Merge "Revert "Re-duplicate deduplicated TemplateStyles"" 2022-01-21 21:29:41 +00:00
Bartosz Dziewoński 3c1d167b33 Revert "Re-duplicate deduplicated TemplateStyles"
This reverts commit 005a8d24ef.

Reason for revert: Causes page corruption

Bug: T287675
Bug: T299251
Bug: T299767
Change-Id: Ib6b88114f6bdcd11ada0daf8ef6ec088569c88a6
2022-01-21 21:10:27 +00:00
Andrew Kostka 856ad0fc03 Show a keyboard shortcut when hovering over a toolbar button
Bug: T299490
Change-Id: I5af6ecf10b90c6a85bccc8489584322e1ba20bd5
2022-01-21 20:08:20 +01:00
jenkins-bot 9ec8a68891 Merge "Link to a list of keyboard shortcuts from the template help dialog" 2022-01-21 18:28:30 +00:00
jenkins-bot ae3d442dc7 Merge "Restore a way to delete transclusions on mobile" 2022-01-21 16:31:00 +00:00
Andrew Kostka eaa438abcb Link to a list of keyboard shortcuts from the template help dialog
Bug: T299487
Change-Id: Ieef99eeb9c43817981e2ae5b5340a58c2aca4920
2022-01-21 17:24:34 +01:00
jenkins-bot fdd195a241 Merge "Update accept button in confirmation dialog" 2022-01-21 16:22:30 +00:00
jenkins-bot 3982a3bfba Merge "Fix transclusion node double clicks being tracked differently" 2022-01-21 15:47:34 +00:00
jenkins-bot 8318edae25 Merge "Disable edit button when double clicking transclusion node" 2022-01-21 15:47:32 +00:00
WMDE-Fisch cede096333 Update accept button in confirmation dialog
The only places where this dialog is used now will have the same
button labels and format. We want to use "normal" destructive here
so no additional "primary" styling.

It seems that the focus on the action will only be applied
automatically when it is primary. So extra code is needed.

Bug: T299647
Change-Id: Ib5250b79e85d27ea197b83c6380863d0749e5d89
2022-01-21 15:32:58 +00:00
jenkins-bot c37d6f86e8 Merge "Hide parameter search when there are only 3 params" 2022-01-21 14:18:41 +00:00
jenkins-bot 8fa3a7a4eb Merge "Update the context menu title for multipart templates" 2022-01-21 11:40:58 +00:00
Andrew Kostka d4fff29148 Update the context menu title for multipart templates
Bug: T299495
Change-Id: I082a4e925c15ba5966a575127046e33f2fc3f62a
2022-01-21 11:51:31 +01: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
Andrew Kostka 8da9661e11 Add a title to the templates help button
Bug: T299499
Change-Id: Ibb4aca479674668d6c14b8ace037433fa305dc35
2022-01-21 11:11:46 +01:00
jenkins-bot 4015ad1bf5 Merge "Defer creating template parameter widget for 0 parameters" 2022-01-21 08:52:37 +00:00
jenkins-bot dd8d53d19f Merge "Image model: Clear originalWidth/originalHeight attributes when changing source" 2022-01-21 00:27:44 +00:00
Ed Sanders 75edbaad08 Convert ve.init.mw.DesktopArticleTarget.init.css to less
Change-Id: Icab13075903d6fad4007847c2381696d6b98fa96
2022-01-21 00:04:27 +00:00
Bartosz Dziewoński 49a4ac0463 ve.ui.MWLinkInspectorTool: Parse "education popup" text as wikitext
Bug: T298837
Depends-On: I0b8ba7c13e97868ab79dcec5c132d0b30dcc9c60
Change-Id: I9258cb7521e43a62cffb5b3698f25e6801f8ae92
2022-01-20 22:57:07 +01:00
Bartosz Dziewoński 9f54e34764 ve.ui.MWEducationPopupWidget: Allow formatting in the popup text
Bug: T298837
Change-Id: I0b8ba7c13e97868ab79dcec5c132d0b30dcc9c60
2022-01-20 22:55:44 +01:00
Bartosz Dziewoński 65d723b62b Restore a way to delete transclusions on mobile
For most nodes, isDeletable() returns false on desktop and true on
mobile. Change e0bbf0b979 meant to
change the desktop version to depend on the new config settings, but
accidentally changed mobile too.

Bug: T298828
Change-Id: I8ec5e8031a27eee18c16dfcd267937cc76722c50
2022-01-20 22:39:55 +01:00
Thiemo Kreuz 28a74445f0 Fix transclusion node double clicks being tracked differently
Double clicks have been tracked as "window-open-from-command", but are
now tracked as "window-open-from-context". This patch changes this
back.

Bug: T297773
Change-Id: Icabc5db526c35d681d077043c54ca009b2296bbe
2022-01-20 15:41:08 +01:00
Thiemo Kreuz 8759a60516 Disable edit button when double clicking transclusion node
The first click opens a little context menu (…ContextItem in the
code). This patch makes a double click trigger the "Edit" button in
this context item instead of executing the "open window" command
itself. This is needed to trigger the "Loading…" code in the context
item.

Bug: T297773
Change-Id: Ie1daa2e6b460c5c506a847bd767af2cb48e73a61
2022-01-20 15:20:28 +01:00
jenkins-bot 835464802a Merge "Disable edit button while loading template dialog" 2022-01-20 13:50:51 +00:00
jenkins-bot 2cbe4f7d6f Merge "Fix left margin of hide unused and checkboxes" 2022-01-20 13:07:07 +00:00
jenkins-bot 16e188e815 Merge "Defer creating template parameter search when it's not needed" 2022-01-20 12:52:19 +00:00
jenkins-bot d4b354a1ba Merge "Removed left padding in parameter description" 2022-01-20 12:31:34 +00:00
Thiemo Kreuz 8fd1b6d8b8 Defer creating template parameter widget for 0 parameters
From the user's perspective nothing changes. A template without
parameters doesn't show anything. (Technically there was an empty
<div>, but it doesn't do anything.) The moment the first parameter
is added the required sub-widget is created and available from there
on.

This saves loading time and memory, especially when a multi-part
template contains many templates without parameters.

Bug: T298259
Change-Id: Ib1bd2cd0be4fece4acc92e6e5f63133a7986cf81
2022-01-20 12:06:03 +00:00
Svantje Lilienthal adb85f341a Removed left padding in parameter description
Bug: T299518
Change-Id: Iaa7118a111cfbc1856bbe7c1ff6917587ba6c395
2022-01-19 14:40:06 +01:00
WMDE-Fisch 0e4c6104ef Fix left margin of hide unused and checkboxes
The checkboxes are actually indented a bit more than the search box
with this change the extra indentation is applied and the hide
button text is alligned accordingly.

Bug: T298259
Change-Id: I5508ab883c23e7285c023dc127529ffa4dbe58c7
2022-01-19 14:21:37 +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 110db0e3c7 Remove conflicting section IDs in diff views
Bug: T218492
Change-Id: I84c60a36859190efc37c68e380ae44225be06d9c
2022-01-19 01:26:14 +00:00
Ed Sanders 63603e0cba MWImage: Fix handling of error-image dimensions
Change-Id: Ic808930bbd49bab779bd2ed174e6ec2408d51554
2022-01-19 00:51:39 +00:00
Ed Sanders 658a08bc30 Broken image: Fix DM HTML for preview to include redlink text
Bug: T265655
Change-Id: I1283975fdafb219ae2b0c703ecf7c7b23bb0c067
2022-01-19 00:51:39 +00:00
Ed Sanders 64fa1d909f MWImage: Cache dataElement.attributes
Change-Id: I24a4d436a00e6300bf4234153188d02fd648f9ce
2022-01-19 00:51:39 +00:00
jenkins-bot 770884f14f Merge "Make sidebar header and search field sticky during scroll" 2022-01-18 12:55:11 +00:00
Thiemo Kreuz 33a2f21589 Disable edit button while loading template dialog
Bug: T297773
Change-Id: I51fc0af4c3b29fd0801fc06a1dc07ad3fd7f1da3
2022-01-18 12:29:27 +00:00
jenkins-bot b4e3c3b1e5 Merge "Add mobile specific styling for TemplatePage" 2022-01-17 17:14:00 +00:00
Ed Sanders 2dd810da85 Image model: Clear originalWidth/originalHeight attributes when changing source
Bug: T269035
Change-Id: I52e5e7fd46ce86a2190b9ef5484898f741105646
2022-01-17 15:32:30 +00:00
Adam Wight a244f510c4 Make sidebar header and search field sticky during scroll
The search field will stay at the top of the window while scrolling a
single template.  In multi-part transclusions, the header will also
be sticky.

Hides the template header in single-part transclusions.

Bug: T298618
Change-Id: Ib050e30a50ef965c1524e977d3a600c3ff836774
2022-01-17 16:09:54 +01:00
jenkins-bot 8d119a4356 Merge "Re-duplicate deduplicated TemplateStyles" 2022-01-16 00:24:31 +00:00
Bartosz Dziewoński 005a8d24ef Re-duplicate deduplicated TemplateStyles
Bug: T287675
Bug: T299251
Change-Id: I7711c30131cb441f84b3e2137983f0ba2a50b46f
2022-01-14 21:35:11 +00:00
jenkins-bot 2819958a8a Merge "Add button to sidebar to hide/show unused fields" 2022-01-14 11:35:19 +00:00
WMDE-Fisch 20435b319c Add button to sidebar to hide/show unused fields
Bug: T298259
Change-Id: I8e5091b97dfb19eba981b2a919b82b6f14823990
2022-01-14 11:09:04 +00:00
jenkins-bot 1150891885 Merge "Include TemplatePage styling on mobile" 2022-01-14 11:07:59 +00:00
Andrew Kostka 2e7d4dabd1 Fix positioning of the "add parameter" button on mobile
Bug: T292749
Change-Id: I8c73189fcb94541087c6d44fbe7a82d14f9c3483
2022-01-13 15:18:40 +01:00
Andrew Kostka 914d9f7aaf Add mobile specific styling for TemplatePage
Bug: T292746
Change-Id: I3f2bc156d3f1be6e78b3a5d257c0cc484a65611c
2022-01-13 14:42:41 +01:00
Andrew Kostka 8c07926d4b Include TemplatePage styling on mobile
Bug: T292746
Change-Id: I52dcc8b489598ea8a892ad6c049c20d40f410d5b
2022-01-13 14:03:02 +01:00
Adam Wight 587ba4c662 Confirm before closing template dialog
Reuse the back button confirmation dialog for the close button.  The
condition is slightly different: need confirmation if there are any
manually-entered values for any parameter AND the user has edited
the template in this session.

The "reset" action was synthetic, only used internally and not
connected to buttons or menus.  Canonically, action='' is the close
action for OOUI.

Bug: T297792
Change-Id: I4ff644c7ab24ed9ba1a4c27d762563c5d6771cfc
2022-01-12 10:47:21 +01:00
jenkins-bot 1dbfad3503 Merge "Reuse touched-content logic" 2022-01-12 08:34:09 +00:00
Ed Sanders c0f3fc3a78 Pass visibleSection & visibleSectionOffset to target
* Find the first section below the top of the viewport
  (usually visible) and measure its offset.
* After loading the editor, ensure this heading is still
  at the same position on the page.

Bug: T296910
Change-Id: I9a05ea74ba3c19a4a91ddc1bc0afe311851c53e6
2022-01-11 20:39:27 +00:00
jenkins-bot e1b9e6a98e Merge "Watchlist API update: Call correct method" 2022-01-11 18:41:49 +00:00
Ed Sanders aea22d546e Watchlist API update: Call correct method
We changed the arguments, but not the function name.

Change-Id: Ic7b36f666ead57bc62aa6e40e148821ea267ee80
2022-01-11 18:21:12 +00:00
jenkins-bot 9b659687c7 Merge "Introduce ArticleTarget#afterSurfaceReady" 2022-01-11 18:11:50 +00:00
jenkins-bot 4f9f14f383 Merge "Replace confirmation overlay with a popup dialog" 2022-01-11 17:59:48 +00:00
Adam Wight 28e706b3dd Reuse touched-content logic
Without changing behavior, consolidate the logic for detecting
whether the editor has made changes to the template.  This is
responsible for enabling and disabling the "Apply changes" button.

Change-Id: Ic4755b13f30fb738a7cb1eebaddef0435ea61d34
2022-01-11 17:39:22 +00:00
Adam Wight cbe2fd634f Replace confirmation overlay with a popup dialog
Currently, the insert template dialog includes a back button in the
upper corner.  Confirmation of abandoning unsaved changes was
accomplished in an overlay panel.  This patch rewrites as a dialog
and updates the on-screen text.

Bug: T297792
Change-Id: Ifa2ff97c9284609ee2a784f455789c56a762ba50
2022-01-11 18:37:29 +01:00
jenkins-bot 83d1211ef6 Merge "Give getUniquePartId method a better name" 2022-01-11 13:31:10 +00:00
Ed Sanders 6c471c5b1e Introduce ArticleTarget#afterSurfaceReady
This method should be called once the surface is visible
and ready to be focused.

Change-Id: I43a1d9cabd59181d2beab8f4a29700d031903c22
2022-01-11 03:33:04 +00:00
Ed Sanders 93df71af77 ArticleTarget#scrollToHeading fixes
* Use this.getElementWindow
* Use this.surface.padding to avoid race condition
  when the toolbar hasn't fully rendered yet.

Change-Id: I055b1d9458d73e435ede6096941a3e72c9c1ce74
2022-01-11 03:32:52 +00:00
jenkins-bot b92f414e23 Merge "Use new wikipage.watchlistChange hook" 2022-01-10 22:42:17 +00:00
Ed Sanders 3800daf354 Use new wikipage.watchlistChange hook
Bug: T294254
Depends-On: I88af8585e8fc75f77ebef867d267199aeb2c6592
Change-Id: I60400124976093060b3b5478c6d7d9e6844cc217
2022-01-10 23:16:41 +01:00
jenkins-bot ccb74dc828 Merge "Enforce formatversion=2 in template search" 2022-01-10 12:57:05 +00:00
jenkins-bot 8886773548 Merge "DiffPage: Only set user pref on 'choose' event" 2022-01-08 01:33:31 +00:00
jenkins-bot 67aad36acb Merge "DiffPage.init: Move and rename some vars" 2022-01-08 01:33:29 +00:00
jenkins-bot 451555ac64 Merge "Tests: Fix unbalanced HTML" 2022-01-08 00:26:53 +00:00
Ed Sanders 40a50cac4a DiffPage: Only set user pref on 'choose' event
This prevents your preference being changed if you just
followed a link with a diffmode parameter.

Change-Id: I755563bde285e95c0367119d49a40e1dd3c5e178
2022-01-06 16:48:02 +00:00
Ed Sanders 302303de46 DiffPage.init: Move and rename some vars
Change-Id: Ibcef23650e6c77d9142055e9e7357ce095ba3b49
2022-01-06 16:47:35 +00:00
Thiemo Kreuz 579cdaa145 Enforce formatversion=2 in template search
This is guaranteed via ve.init.mw.Target.getContentApi(). But the
ContentTranslation extension replaces this, and does not set a
formatversion. See e.g. SectionTranslationTarget.getContentApi().

Bug: T298599
Change-Id: I8768cae3153e9cbc29a8796ec21ef249f80471ed
2022-01-05 12:49:44 +01:00
mewoph 93d54c701b Check for saveDialog in ve.init.mw.DesktopArticleTarget.saveComplete
In case the save is triggered without the save dialog (for example, when a null edit is made during suggested edits task in GrowthExperiments)

Bug: T298552
Change-Id: Id49b967cfa52d33848e9c911086000fa4501fa7f
2022-01-04 13:35:21 -08:00
Ed Sanders 9e4915d7c3 Tests: Fix unbalanced HTML
Change-Id: I997c68ce33263004b8ae9b686aae7295eec12ea7
2022-01-04 02:01:38 +00:00
Thiemo Kreuz 454dc53126 Give getUniquePartId method a better name
It's not a getter, but a generator. I found the name confusing.
Getters typically don't return something different every time you
call them.

Change-Id: I6eeab8b6a8644e430003f6e1ad77ab4b28e0d8c9
2021-12-22 13:03:01 +01:00
Ed Sanders 1c6dbf433f Remove more DOM garbage introduced by 'Web of Trust' extension
Bug: T297862
Change-Id: Ib6efe0c4ea68a1b17efd37839cec428dc9ebf6b7
2021-12-20 17:54:20 +00:00
Ed Sanders b57fe3e8ba Only set diffmode-historical user option when it has changed
Bug: T290703
Change-Id: I289e0c20db9235a432f7f49a425328ab617d57f3
2021-12-20 14:27:37 +00:00
jenkins-bot 717b5cf534 Merge "Use no-jquery/no-html to warn against writing HTML strings to the DOM" 2021-12-17 16:42:53 +00:00
jenkins-bot c92ea76af8 Merge "eslint: Enable no-jquery/no-append-html" 2021-12-17 16:42:42 +00:00
jenkins-bot 53ad459b27 Merge "ve.ui.MWMediaDialog: Clean up image metadata display" 2021-12-17 16:42:39 +00:00
jenkins-bot 6dc75d8283 Merge "Remove obsolete performance bottleneck from TransclusionModel" 2021-12-17 13:24:19 +00:00
jenkins-bot 26d22ee4bc Merge "Delay initialization of all invisible "add parameter" components" 2021-12-17 11:52:48 +00:00
jenkins-bot 4a1063e87a Merge "Skip bad suggestedvalues and aliases in the template dialog" 2021-12-17 11:16:21 +00:00
Ed Sanders 2098292318 Use no-jquery/no-html to warn against writing HTML strings to the DOM
This forces us to comment when we are doing this deliberately.

Change-Id: Ide1bcb64f6c6076b48e88f1f27045bd93392f8a0
2021-12-16 01:28:42 +00:00
Ed Sanders 4d13a4f4ed eslint: Enable no-jquery/no-append-html
Prevents accidentally treating plain text or user input
as HTML, which could be an XSS vulnerability.

Change-Id: Id4af48447a0907962a57340cb60aca08df9cc505
2021-12-16 02:04:11 +01:00
Bartosz Dziewoński 97be4e21ad ve.ui.MWMediaDialog: Clean up image metadata display
* Fix incorrect use of .append() instead of .text() (which was causing
  some l10n messages to be treated as raw HTML)
* Avoid escaping and parsing HTML several times when plain text was
  intended
* Remove some unused options and variables

Follow-up to 839b64d882.

Change-Id: I124257c73fe09713afefccdec8e90200e6ae433d
2021-12-16 01:52:54 +01:00
sbassett 839b64d882 SECURITY: ve.ui.MWMediaDialog: Escape plaintext image metadata fields
CVE-2021-44855

Bug: T293589
Change-Id: I691b4065e67c53c4276599c8d16c31ab5591db3a
2021-12-15 16:14:35 +00:00
Thiemo Kreuz 7cf10ea474 Delay initialization of all invisible "add parameter" components
The "Add parameter" page always starts collapsed. Even if a template
doesn't contain anything but this. But most of the content isn't
visible, unless the user presses the button. It's not only a lot of
content, it's also rather expensive, including .parseDom(),
LinkCache.styleElement(), and ve.targetLinksToNewWindow(). This adds
up in large multi-part transclusions. In an example with 200 parts
the total blocking time goes down from 2.9s to 2.4s. Which means this
is not a major bottleneck, but still worth it.

Bug: T296335
Change-Id: Ieab9fd35d145142b04d2267d8e5a2e10a4c02784
2021-12-15 08:28:16 +00:00
jenkins-bot 6bfd3ab7c0 Merge "Add link to undocumented parameter help" 2021-12-13 13:56:52 +00:00
Thiemo Kreuz 66636e1dd8 Skip bad suggestedvalues and aliases in the template dialog
Bug: T297386
Change-Id: I6456d720c923e8cff9b4500b6cfe52bc6fbc9dad
2021-12-09 16:58:13 +00:00
Thiemo Kreuz 845cd69bf5 Don't scroll to template parameters while the dialog loads
Bug: T296743
Change-Id: Icd501ae89695a202e8c264d1b5e9811e812a56d1
2021-12-09 14:57:20 +01:00
Andrew Kostka 887a01a355 Revert "Hide more button on parameter descriptions for screen readers"
This reverts commit 3e23d78d32.

Bug: T296997
Change-Id: I74a338aa4e8cb7754feaabc348b6c308f7f2eeae
2021-12-09 10:10:53 +01:00
jenkins-bot abc7a7d4b6 Merge "Use new select[First|Last]SelectableContentOffset methods" 2021-12-08 16:43:53 +00:00
Ed Sanders 5c0344aeda Use new select[First|Last]SelectableContentOffset methods
* Make ve.ce.MWBlockImageNode autofocus=false, remove
  unused transition property
* Remove ignoreChildren from ve.dm.MWBlockImageNode
  based on new definition
* Remove tests which assert that deleting in a list next
  to a block image always de-indents. If this is desired
  behaviour it should be fixed without reference to
  ignoreChildren.

Bug: T295905
Depends-On: Idc0cccbe73d1b49d07b60c14a192a40f47d64608
Change-Id: Ib79a070f5d36dbe7742fa0760f8cdf55fe3046ed
2021-12-08 15:53:35 +00:00
jenkins-bot 39199ae44f Merge "Remove unused CSS from template dialog" 2021-12-07 14:43:51 +00:00
WMDE-Fisch 742aee7f9d Add link to undocumented parameter help
Bug: T284985
Change-Id: Ie5a61beed39aa3572c2a5e82dbc3711fdcd35ba8
2021-12-07 15:12:20 +01:00
Thiemo Kreuz 847ab1800b Remove unused CSS from template dialog
These pieces are only relevant when the new "inlineDescription"
feature is enabled. In other words: This can't have an effect on
the old dialog.

The 2.5em left and right are from an old styling when the
parameter pages have been indented.

Change-Id: I022b0dd94ee66f7de114c055c3f453317a7f6131
2021-12-07 13:57:18 +00:00
jenkins-bot 131f7e940d Merge "Add safe-guard for early template dialog resize events" 2021-12-07 13:08:42 +00:00
Thiemo Kreuz fd669a4d16 Remove obsolete performance bottleneck from TransclusionModel
This sorting algorithm was introduced via Ic6bc348 (T274544). Note
there is no index parameter in the .onReplacePart() handler at this
point. When a part was moved, it was removed and simply appended
to the end. The additional sorting was needed to move it back to the
correct position.

This changed a few days later via Iafe29f1. There is now an index
parameter. The .onReplacePart() handler does the same as before, but
puts the part at the correct position right away. The additional
sorting is pointless since then.

The removed code alone is responsible for 1/3 of the total blocking
time when the template dialog opens.

Bug: T296335
Change-Id: I6c3fa70b532d34cd29d59c3b48ab81ebf608d548
2021-12-06 17:36:53 +00:00
Svantje Lilienthal 65bef19f73 Prepend multipart message in onReplacePart to prevent it from moving around
onReplacePart is being called when templates are being moved up or down. 
To prevent that the multipart message gets moved around passively e.g. 
by one element being added above it, this patch adds it to the top after each movement.

Bug: T292829
Change-Id: I946c9bc4ba5e1d261aefbb28a8c642bb58964842
2021-12-06 13:58:09 +00:00