Commit graph

554 commits

Author SHA1 Message Date
jenkins-bot 84f26ccfd2 Merge "Properly disable insert-link button" 2022-02-08 04:21:55 +00:00
Ed Sanders 7fea791042 build: Update eslint-config-wikimedia to 0.21.0
Change-Id: I87bca80d107c965296af74e16961cd855d72b806
2022-02-07 17:27:27 +00:00
David Lynch fda6c3c117 New bucket for abtest data
Bug: T291308
Change-Id: I7aa47139e3fe552833798d6b8daacc1b30517915
2022-02-02 15:50:21 -06:00
Sam Wilson 739b93310d Properly disable insert-link button
Use jQuery UI's proper button disabling system, rather than trying
to set attributes manually.

Also remove the alert which used to show when trying to insert a
blank link target, as it now has no use. The functionality was
removed in I3541f438fad9b7e0bf23ead2f2e164e84565d254
when the insert-link button was changed to always disable when an invalid
link was being attempted, but the alert was not noticed at that point
(and nor was this disabling bug).

Bug: T298596
Change-Id: I17c454d6ba336abd0b4eeee0d7166fdf81d25734
2022-01-10 15:35:04 +08:00
jenkins-bot 1e95619723 Merge "Set link type radio when confirming looks-like internal" 2021-12-21 19:51:38 +00:00
jenkins-bot 0fe853a748 Merge "Move insert-link mode constants to a better location" 2021-12-09 20:13:04 +00:00
Sam Wilson dd1173de39 Set link type radio when confirming looks-like internal
When closing the alert that appears when a link looks like an
internal URL, the link target text was changed but the radio
button was not. This patch rectifies this.

Bug: T295517
Change-Id: Ie0339f3aac8ccfd118c604602ce638539ff67e03
2021-12-08 14:34:11 +08:00
Sam Wilson b8a4fcc998 Fix link-inserter event value when dialog opens
When the insert-link dialog is opened, a change event is manually
fired in order to get the system in sync. This is not optimum,
but until we refactor jquery.wikiEditor.dialogs.config.js it's
a simple way to do it.

The issue was that this manual event was being given an empty string
as the title value, but it should've been the actual current field
value. The reason it's not the same is that when the dialog is
closed with the cancel button, the state of all the fields is not
reset (this is a long-standing design feature of the dialog).

Bug: T293167
Change-Id: I8e2a0a5169b5d2a6d706623dc0c879469acd9afa
2021-12-08 10:00:48 +08:00
jenkins-bot 1072dcc27c Merge "Tag WikiEditor edits with a hidden tag" 2021-12-07 23:58:30 +00:00
Ed Sanders b4f144057e Tag WikiEditor edits with a hidden tag
Bug: T249038
Change-Id: Ia4267bc430ba0f12cce496ebf6f8c1773ae355a6
2021-12-07 23:30:27 +00:00
Sam Wilson b296fc3578 Move insert-link mode constants to a better location
Also capitalize them and don't keep them in an array.

The data values for the radio buttons are also removed, because
they're not used for anything.

This is a follow-up to Ie40e8bdebe6f1330fc75ea1861f120e51ad58224.

Bug: T293168
Change-Id: I2f6de07f6f82e9e59ab67c771fcd60a68ad577dc
2021-12-07 16:39:11 +08:00
Sam Wilson d96435cd18 Prevent external links from showing as invalid
* When the link target text is changed, only change the URL mode if the user
  hasn't explicitely set the type (internal/external).
* Improve the conditions for the display of the 'external' and 'exists'
  link-target messages.
* Validate the link target (i.e. show messages) not only when the text is
  changed but also when the target type radio is changed.
* Rename the TitleInputWidget.isExternalLink() method to
  looksLikeExternalLink(), to make its purpose clearer.

Bug: T293168
Change-Id: Ie40e8bdebe6f1330fc75ea1861f120e51ad58224
2021-12-06 15:24:04 +08:00
Sam Wilson 94569125a7 Add new 'secondary' toolbar section
Add a new top-level section to the right side of the toolbar,
containing a single (empty) 'default' group.

Bug: T296447
Change-Id: If88789f20420f02c729122392e16509bbc5ae7d0
2021-12-01 11:19:41 +08:00
Sam Wilson 79a0d3040e Disable link-insert button if target is empty
Set the opening state of the insertion button (in the insert-link
dialog) to disabled, and also disable it whenever the target field
is empty. This makes it unneccessary to show an alert when trying
to insert a blank target so that code is removed.

Bug: T293167
Change-Id: I3541f438fad9b7e0bf23ead2f2e164e84565d254
2021-11-26 12:45:48 +08:00
jenkins-bot e9121b2d1c Merge "Fix bug when target looks like internal link" 2021-11-24 01:49:29 +00:00
Sam Wilson a70bd3876e Fix bug when target looks like internal link
Refactor the code for selecting the first match, so it can also
be called from the look-like button method — this will be changed
once the whole link-inserter dialog is OOUI.

Bug: T295517
Change-Id: I56b289dbf07707b0391b263464bdfd6307142574
2021-11-17 09:27:34 +08:00
Sam Wilson a2cccc57af Add live-preview logging
Log on every click (by any means, including accesskey) of the
main editing preview button.

Bug: T290521
Change-Id: I67d821445c5e39034bcb121beccf17a765a311ed
2021-11-04 10:09:56 +08:00
jenkins-bot 3bcaa37303 Merge "Remove template for insert-link dialog" 2021-10-13 20:20:30 +00:00
jenkins-bot 97780d5e3e Merge "Remove 'resize' logic from jQuery UI dialogs" 2021-10-13 18:59:15 +00:00
Sam Wilson 54f3e15199 Remove out-of-date CSS
* #wikieditor-toolbar-link-int-text was removed in I17f34a8cbf72b80f3916581867e5828d9b129789
* .wikiEditor-template-dialog-fields was removed in I47119d6cfdde4b40ff5b07be0c7d327b80598142

Change-Id: If669eb3fa8e1401d640c879f808c097682c30f31
2021-10-13 11:03:32 +08:00
Sam Wilson 60be1db1d1 Remove template for insert-link dialog
The HTML template is no longer required, as all three fields are
now OOUI and so provide their own HTML.

Bug: T289214
Change-Id: Id7e02119f00e30244b8dc2048c1f694500151b25
2021-10-13 10:03:44 +08:00
Daimona Eaytoy 834632650d Remove 'resize' logic from jQuery UI dialogs
Added in https://phabricator.wikimedia.org/rSVN56198 in 2009

It seems to have no user-visible effect, and resizing is still working
as expected for the dialogs that use it.

OTOH, this logic is broken, since it doesn't account for elements hidden
via classes or anything other than inline style. For instance, if there
are OOUI text fields inside the dialog, the logic in resize() will add

  style="display:inline"

to the empty icon elements, which would then cover part of the input
field.

Bug: T293065
Change-Id: If53937dd9e80835774ef936c5aa19f78c7266ca7
2021-10-12 11:46:21 +02:00
Sam Wilson 0b14ae0666 Change insert-link radio buttons to OOUI
Add new OOUI field for the link-type radio buttons in the
insert-link dialog.

Bug: T289214
Change-Id: Idf80c533e5a17de3e9a57051c0608524b6d45098
2021-10-12 13:01:26 +08:00
Sam Wilson e3e9ebb6cb Change the (insert-link) title field to OOUI
Following-up on I9fb7e66bf925eb9a8260d6245d2a7db54a7a2fec
this converts the link-text field to OOUI.

Bug: T289214
Change-Id: I17f34a8cbf72b80f3916581867e5828d9b129789
2021-10-11 14:45:02 +00:00
jenkins-bot c3d4bfcd2e Merge "Allow a free-text string 'title' field when adding characters" 2021-10-08 22:24:07 +00:00
Sam Wilson 6384498d75 Switch to OOUI TitleInputWidget for the link-inserter
In order to get a better look-up experience (images, description,
redirects, and disambigutation pages listed last), swich from
a custom title-autocomplete input (that used jquery.suggestions)
to OOUI's standard one (which is used in a bunch of other places
in MediaWiki).

This means a fair bit of code can be deleted from
jquery.wikiEditor.dialogs.config.js, and some of it moved to
the new OOUI classes.

This patch aims to be the minimum required, and so leaves a few
things for subsequent patches (such as converting the other parts
of the insert-link dialog to OOUI).

Bug: T289214
Change-Id: I9fb7e66bf925eb9a8260d6245d2a7db54a7a2fec
2021-10-08 12:43:55 +00:00
Inductiveload b87612d937 Allow a free-text string 'title' field when adding characters
When adding characters to the WikiEditor toolbar, it's possible to set
titleMsg, but it's not possible to set a free-form string title. This is
rather limiting for personal or site-local scripts which might wish to
use a title tooltip but not be able to set a MediaWiki message.

This commit adds the ability to pass a 'title' field of a character
definition object. If both 'title' and 'titleMsg' are defined, 'titleMsg'
is used.

Bug: T292434
Change-Id: I00775d5e4690c0fd45c20639a122c39dc756135e
2021-10-04 15:48:55 +01:00
Ammarpad 2affca03b3 Revert "Support colon link escapes for categories and files"
This reverts commit e76eba6b96.

Bug: T290818
Change-Id: I88f86935f0686b98105ddb49ede4b773d5e6de54
2021-09-21 18:12:25 +01:00
Sam Wilson b0904ce4f1 Remove unused image: insert-link-error.png
This image appears to have never been used, according to Git log searching.

Bug: T289214
Change-Id: I230db9ea85e0b3305c9bcc84531db21e93fecf4e
2021-09-01 16:29:05 +08:00
Bartosz Dziewoński edbdc7f9e6 Add runes to special characters
Depends-On: I6c736563068a83f56990729ac6ef3be6c8a0f621
Change-Id: Ia5c43f5973ab512cc5f9e674063d47833eb9a6fc
2021-08-17 18:19:32 +02:00
Alexander Jones e76eba6b96 Support colon link escapes for categories and files
This commit adds bidirectional support for prefixed colons in
internal link targets, such as the ones required by links to files
and categories. It automatically adds a colon to links targeting
pages in the File and Category namespaces (as determined by mw.Title)
and allows an optional colon prefix for all internal links after
the optional whitespace.

Bug: T38227
Change-Id: Ie2801c42da4238555ad7c6544a8412610a528597
2021-07-30 21:59:20 -05:00
jenkins-bot faa1c10b8a Merge "Move var declarations inline" 2021-06-15 16:32:13 +00:00
Ed Sanders 344da9de80 Move var declarations inline
Change-Id: I841ed46dfde9a6e2a5927e49ac3383d6e17bda66
2021-06-15 15:45:13 +01:00
Ed Sanders b3dbb96cf3 Update stylelint-config-wikimedia
Change-Id: Ib7c44812e8adc159ff2c1d634712e05cc8511078
2021-06-15 15:14:04 +01:00
Alexander Vorwerk cdb9388b93 Fix call to renamed var
The var 'module' got renamed to 'm' in
I57b11c6b4c6e67bb38bb67a93b06d6d1d3009933. This patch fixes the
call to it.

Bug: T284716
Change-Id: I57b7a5fd4a8f2fe2fa98ab5fc41c5bd2500f3a67
2021-06-10 11:11:44 +02:00
Umherirrender fbcc93d98c Avoid "Cannot read property 'top' of undefined" in toolbar
Can happen when using up and down keys without selection

Bug: T282607
Change-Id: Ibf7b4711fe7d0ebc14638a77770acff9149a9d7a
2021-06-01 22:30:15 +02:00
Ed Sanders 137395538e Fix eslint warnings
Change-Id: I57b11c6b4c6e67bb38bb67a93b06d6d1d3009933
2021-05-23 15:49:49 +01:00
David Lynch cb1c5d49aa Log whether Javascript was supported on saveSuccess
Adds a hidden field to the edit page form, with JS that will set its
value. Server-side then checks for that value and logs whether it was
correctly set.

Bug: T263505
Change-Id: I8be06385aa6d97e5536cfc252d34297e1c000a32
2021-04-30 17:45:40 -05:00
Umherirrender 54af531265 Remove suggest param from opensearch api request
Deprecated in 1.35 (Iec572012de171d02871b8dc3207d2b34d17bf9ef)

Change-Id: Ic9cca2ff6f7372a64a216c65c408454dc2dc7cbb
2021-04-28 19:49:50 +02:00
Umherirrender 3f95a63650 Swap new mw.Title to mw.Title.newFromText to handle invalid input
Avoid failure on invalid user input (like invalid tiles with <>)

Bug: T279298
Change-Id: Iaeb6ca3ab232bbb206f05acfa5c0a14e16945ffc
2021-04-28 01:21:58 +02:00
jdlrobson 9ac850b28a Dialog data attribute action is a DOMElement
After looking more closely at the code, I noticed that
dialogaction is set to e.target or this which is a
DOMElement, not a jQuery Object, thus it doesn't have
the trigger method which explains the error.

Follow up to 760f023f2

Bug: T261529
Change-Id: Ie5f58e33ad385f2abae19264bb2c3cd34a721788
2021-02-25 08:12:16 -08:00
jdlrobson 760f023f21 TypeError: $button.trigger is not a function
This error is generating a large amount of logspam.
Add a check to avoid it, and DRY up.

The issue is caused by line 1182 setting dialogaction to false when
a dialog is closed. Presumably references to this data attribute
remain.

Bug: T261529
Change-Id: Ie75f737980dfcbcc4829def1e5a6894262d73b31
2021-02-10 21:36:27 +00:00
jenkins-bot ef5c29c5f1 Merge "Log the DiscussionTools a/b test bucket for relevant schemas" 2021-02-01 17:08:45 +00:00
David Lynch e052e46f94 Log the DiscussionTools a/b test bucket for relevant schemas
If someone is enrolled the DT a/b test, we want to know about their
editing here as well.

Bug: T273096
Change-Id: If2bb04011c8ca54e8c7ffd073e21bec45e92460c
2021-01-29 20:56:14 -06:00
Reedy 4dcd3baab0 Use only the first item of various magic words
Bug: T273231
Change-Id: I1f88eb3e043cb95f939a7e38ddaa3e39a49523fa
Follows-Up: Ib03932d3d85a5540bea325f2717da3365756a90e
2021-01-29 02:57:01 +00:00
jenkins-bot 3aa618b801 Merge "Export crude public interface for WikiEditor" 2021-01-27 10:27:05 +00:00
Bartosz Dziewoński d77a69f236 Don't lowercase image caption/alt when prefilling image fields
Judging by the presence of this bug, no one ever uses this feature.

Change-Id: I46a986dd83cf98a8b9f5dcb5bd4c3acb04a6cf5b
2021-01-22 21:23:44 +00:00
Bartosz Dziewoński dc93bf1b37 Parse alternative magic word translations when prefilling image fields
In some languages, image options like 'alt' or 'thumb' can have
multiple synonyms. They were only handled for English (and were
hard-coded).

Change-Id: Ib03932d3d85a5540bea325f2717da3365756a90e
2021-01-22 22:15:16 +01:00
Ammar Abdulhamid ab287ade14 Allow specifying alt-text in File dialog
* Also add expandable help message to explain the alt text field

Bug: T260006
Change-Id: If16ff742d7a8dee4917884e73e9c95bf76350773
2021-01-22 21:37:17 +01:00
Niklas Laxström c10d08d87b Export crude public interface for WikiEditor
Bug: T250862
Change-Id: Iac8778f0d0a0150acc99569d84422bc9817dfcc7
2021-01-21 12:22:52 +00:00