Commit graph

1177 commits

Author SHA1 Message Date
Thiemo Kreuz 7298834211 Follow naming convention for static methods
Change-Id: Ie2d7fb061fcb46765ba8796911425d58218736d1
2022-01-27 09:12:23 +01:00
Adam Wight 7e7ad97bf6 Don't wrap unknown actions with confirmation
For example, the "apply changes" button was producing a confirmation
dialog.

Bug: T300095
Change-Id: I77e53cc0cf62ff7c0aca052568384e20490ce7ec
2022-01-26 14:40:58 +01:00
jenkins-bot 1f8e56a333 Merge "Move copyright warning message parsing from RL module to API" 2022-01-26 11:07:03 +00:00
Bartosz Dziewoński 8080bd2f5d Move copyright warning message parsing from RL module to API
Parsing it in the RL module caused the module cache key to depend
on the parse, which is slow and makes ResourceLoader sad. The usual
approach for solving this (I206bb05d28) can't be used, because of
how EditPage generates this message.

Bonus #1:
Generate the message for the correct page title. MediaWiki allows
customizing it per-namespace or even per-title, which we haven't
supported before.

Bonus #2:
Pass the context for message localisation (depends on I5f7c77970d).
EditPage::getCopyrightWarning() was parsing messages without the
interface flag, causing some needless processing elsewhere.

Depends-On: I5f7c77970d0525c0ff394f8bd72c69dcb5d00623
Bug: T298822
Change-Id: Iaa626f0e6379a5a370f9c465cea8528bb5bde7f7
2022-01-24 22:19:04 +00:00
WMDE-Fisch 5b4e53148d Confirm before close when all parameter values are deleted
Do show a confirmation when editing templates without parameters,
but don't show the confirmation when you're only on the template search
page.

Bug: T299394
Change-Id: I8205bb6a0f92b7b535a80f7f6a43674f1aa5b51b
2022-01-24 11:43:27 +01:00
Adam Wight a7ba729d8c Refactor confirmation logic
Shouldn't change behavior.

Split from I8205bb6.

Bug: T299394
Change-Id: I32876939d4f61c3be8e756c6eba6f74ea98c11f1
2022-01-24 11:43:27 +01:00
Bartosz Dziewoński 8bcb50b6a2 Fix showing caption and alt text fields in media and gallery dialogs
We were using addItems() incorrectly, and it stopped working after
change Ib1241f93d214e8a7d2f757a120f84de3879575af in OOUI.

Bug: T299818
Change-Id: I2d00cb929673a419789ca6f8bc308721373e1da8
2022-01-22 03:27:22 +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
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
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
Andrew Kostka 8da9661e11 Add a title to the templates help button
Bug: T299499
Change-Id: Ibb4aca479674668d6c14b8ace037433fa305dc35
2022-01-21 11:11:46 +01:00
Thiemo Kreuz 33a2f21589 Disable edit button while loading template dialog
Bug: T297773
Change-Id: I51fc0af4c3b29fd0801fc06a1dc07ad3fd7f1da3
2022-01-18 12:29:27 +00: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
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 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
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 845cd69bf5 Don't scroll to template parameters while the dialog loads
Bug: T296743
Change-Id: Icd501ae89695a202e8c264d1b5e9811e812a56d1
2021-12-09 14:57:20 +01: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
WMDE-Fisch eef0ce91f7 Parse new link in multipart message
We forgot change the way that message is build while adding the link
in 07f105fd7. Now it gets parsed correctly and the link will open in
a new tab.

Bug: T284985
Change-Id: I1ed9dfdafd08d08c5aff45f4b74c540b35ec14a1
2021-12-03 10:36:44 +00:00
WMDE-Fisch 1467800331 Remove temporary hacks that got fixed upstream
Fixes are part of OOUI v0.42.1

Change-Id: Ic133d6cc503538fb8b4319bed037bc6e8596bd1c
2021-12-02 13:27:40 +01:00
Thiemo Kreuz ddaa6a18c1 Fix missing Meta+D shortcut on Mac
I also discovered and applied ways to make this code more compact.

Bug: T294905
Change-Id: I1edc2b3b0a77e02bf8e7ac789cabe007c5f5c527
2021-11-23 10:38:50 +01:00
jenkins-bot 9f6c431fbd Merge "MWSaveDialog: Move header out of mw-body-content" 2021-11-19 17:25:38 +00:00
jenkins-bot 4c02fb7cef Merge "MWSaveDialog: Move var declarations inline" 2021-11-19 17:23:45 +00:00
jenkins-bot 609f589557 Merge "Move feedback icon to correct position in template dialog" 2021-11-15 14:45:57 +00:00
jenkins-bot b84a6198db Merge "Update shortcut to add a part in the template dialog, take #3" 2021-11-15 14:34:52 +00:00
Thiemo Kreuz 0e1a5379da Move feedback icon to correct position in template dialog
Bug: T294839
Change-Id: Ib1a895735d795e0d38f38952fd8bce6ad3fee50e
2021-11-15 14:04:18 +00:00
Ed Sanders 42b5fddf61 MWSaveDialog: Move header out of mw-body-content
Change-Id: I684e3025b97b546a391a64dd647365246e37d36c
2021-11-12 23:00:02 +00:00
Ed Sanders e111c40d09 MWSaveDialog: Move var declarations inline
Change-Id: I163dc057961e8d530ba394dbb92b97e4d866d867
2021-11-12 22:54:52 +00:00
jenkins-bot d8329b36a3 Merge "Minor fixes to floating help dialog in desktop mode" 2021-11-12 16:34:17 +00:00
jenkins-bot d4a25fdbe7 Merge "Use a fullscreen help dialog for templates on mobile" 2021-11-12 16:25:32 +00:00
Thiemo Kreuz dd68dd38d7 Minor fixes to floating help dialog in desktop mode
There was a remaining issue when the window was made very narrow in
desktop mode (smaller than 500px). This patch doesn't aim to really
"fix" the dialog's design in this case. The goal is to make the popup
window appear less broken, so the text can stil be read and the
buttons clicked. That's all.

This patch should not have any effect in:
a) mobile mode,
b) desktop mode when the window is wider than 500px.

Bug: T294839
Change-Id: I3171dbb991533b91eaadba63b78d0ff40aa486dc
2021-11-11 12:23:26 +01:00
Ed Sanders 33840e88ee build: Update eslint-config-wikimedia to 0.21.0
Change-Id: I19465a5ab3bf71cd97967fd1fac41c645f05a419
2021-11-10 14:52:56 -05:00
Andrew Kostka da2df5a118 Use a fullscreen help dialog for templates on mobile
Bug: T294839
Change-Id: I1effb6ea70bcf5e9ce4e84e65431765d0d2f8125
2021-11-10 15:33:25 +01:00
Andrew Kostka 72641151e4 Implement floating help dialog for templates
Bug: T294839
Change-Id: Id224b61bd0cd57f5e970ab62db2d82dab1db9252
2021-11-09 15:28:23 +01:00
Thiemo Kreuz 5e13ccfb43 Update shortcut to add a part in the template dialog, take #3
Same as I980b72c, but with another shortcut. Again. We tried
Ctrl+Shift+X before (conflicts with RTL feature in VisualEditor), as
well as Ctrl+Alt+D (conflicts with "hide all windows" incUbuntu).

Bug: T294905
Change-Id: Iae7ba759fcd7c107ef586bd5d9ae3cdbe445cedc
2021-11-09 10:48:52 +01:00
Andrew Kostka 7f3c24b48e Update the shortcut for adding a template in the template dialog
Bug: T294905
Change-Id: I980b72c98835865c065163fa17bfcc3b9434a80b
2021-11-03 15:40:16 +01:00
Adam Wight 1e82a4ce78 Still hide mode button unless in small screen mode
Bug: T294351
Change-Id: Iebd9cbc5d48711c2e85cab927d4515e6fe0a7d03
2021-10-28 10:42:44 +02:00
Adam Wight b3e5478221 Show the "other actions" toolbar when unknown buttons are available
For example, the Citoid extension adds a "change reference type"
button which should be visible when editing a citation template.

TODO: Decide whether we want to hide the "hide options" button in
this case.  This should be handled in a separate patch and possibly
in a follow-up phase, it requires deeper changes to the logic.

Bug: T294351
Change-Id: I1c6c322fe48044d7e726bf20ba7cd2eda422cd8b
2021-10-27 13:10:23 +02:00
Thiemo Kreuz 96adda0d13 Add safe-guard for early template dialog resize events
I can't reproduce this error, but I feel better having this safe
guard in place. In theory it's possible to trigger resize events
before the TransclusionModel is initialized.

Change-Id: I4bbac0f73873813629ff854ee728465c6e2a4ba7
2021-10-27 12:50:20 +02:00
Thiemo Kreuz 597bacd63b Fix rebase mistake in TransclusionDialog class
I6909b3f0b2c153b7ee9995441e995ffa793eab40 was rebased, but
I0226ca7d39e04a69617c0d8a5d3c293cfc9e0709 was merged in the meantime.

Bug: T293202
Change-Id: I3cfec9ebc135eaf998a0982f458cfe75bfb2f01c
2021-10-26 10:34:26 +02:00
jenkins-bot a932e5b6b3 Merge "Fix/cleanup template dialog methods dealing with parts vs. items" 2021-10-25 10:02:04 +00:00