Commit graph

532 commits

Author SHA1 Message Date
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 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
David Lynch fa2b80e22a Edit page normally lacks wgRevisionId, but has form field parentRevId
Bug: T230133
Change-Id: I5e3defe22aee58e36d662ef051ebfb3ff1b64dde
2020-12-21 12:27:46 -06:00
libraryupgrader d3fab1c494 build: Updating npm dependencies
* eslint-config-wikimedia: 0.15.3 → 0.16.2
* grunt-eslint: 22.0.0 → 23.0.0

Change-Id: Icb97167116171aeaa7e5ce17b4da2bb59992a33d
2020-07-17 06:12:18 +00:00
bkudiess-msft 358c587ffb Makes special characters booklet accessible
Bug: T253410
Change-Id: Ic42c3cb437d128ca12d15908bb93e83902d997cb
2020-06-29 19:12:56 +00:00
jenkins-bot 38cc6f1f3f Merge "Add caption when inserting table" 2020-06-17 11:55:00 +00:00
jenkins-bot 17b14f3251 Merge "Update VisualEditorFeatureUse with new fields" 2020-06-10 19:53:46 +00:00
David Lynch 7ab9ac2a73 Update VisualEditorFeatureUse with new fields
Bug: T252925
Change-Id: Id6f3748bfd3865e7bb0e4ef5e882206438063e0f
2020-06-09 15:57:07 -05:00
Bartosz Dziewoński 036b7c28a3 Use jQuery.textSelection API for compat with CodeMirror extension
We were already using it for almost all interactions with the editing
area, except for this code which restores the selection after closing
a dialog.

Bug: T254612
Change-Id: I26d22d9c5d64fe8c861405e65cd4464c349aeac9
2020-06-08 18:45:14 +00:00
bkudiess-msft 44e82ec089 Restores focus after dialog closes
Bug: T253595
Change-Id: I125d6c00239091cb3028818e3b72c212babf10b3
2020-05-28 12:23:14 +00:00
jenkins-bot b38a83c670 Merge "Extend comment on overqualified selector from code example" 2020-05-12 19:22:53 +00:00
Volker E b51d815435 Extend comment on overqualified selector from code example
Change-Id: Ic5d91d862f1ec2e986be3b0a2b95c0427dc7eda3
2020-05-11 22:49:24 -07:00
pcoombe a822d1c197 Add caption when inserting table
Data tables should always include a caption for accessibility reasons.
So add a placeholder caption when using the "insert table" button.

Bug: T252350
Change-Id: I6773e2274007946de516ae34e841f66ad20ebc0c
2020-05-11 11:09:23 +01:00
Ed Sanders 90c0b245fc Move 32px dropdown height to -wikimedia.less
Bug: T251682
Change-Id: I86afcb66b8d5d8fdff4f95944c863b10a1949518
2020-05-03 21:17:03 +01:00
Ed Sanders 8e9d306510 Create a toolbarReady hook for attaching toolbar tools
Using an event introduces a race condition where the extension
adding the listener has to do so before WikiEditor finishes loading.

Change-Id: I5a8dc6f8fd1b1939b5d98307b20ef1fd355cee99
2020-04-21 15:28:40 +01:00
Timo Tijhof 0f24c10873 jquery.wikiEditor: change autoIcon() to no longer append version string
Remove use of mw.loader.getVersion, which I'm planning to remove
from the public API. The only valid use case I found of it (not
in WMF repos) is to check if a module exists, for which one can
use mw.loader.getState() already.

The code path here handles with the 'icon' property of a
WikiEditor "toolbar group tool". In other words, the buttons
you can click in the toolbar to open a dialog or insert markup.

I found two ways to reach this code path:

* For the built-in tools and icons that are part of WikiEditor.
  These are all based on OOUI now and no longer use inline styles
  with background-image etc., they are class-based instead, with
  the URLs and language variants handled server-side by RL.

* For user scripts that register a custom tool and icon.
  To try this, copy snippets to the console on an edit page from
  <https://meta.wikimedia.org/wiki/User:Krinkle/Scripts/InsertWikiEditorButton>

  These pass urls as the 'icon' property and thus don't satisfy
  the hasOwn condition in this code. And even if they did, there'd
  be no reason for the module version to be helpful to the thumbnail
  url the user would have passed.

This line of code has existed with the mw.loader.getVersion() call
since the repository's very first commit in 2010 (9d278e8dee).

The worst that can happen is if there are stil some internal icons
hitting this path, they'll be cached for 1 hour instead of 7 days
(per /w/static.php rules in production). For third parties, there
would be no difference and such static paths have no caching by
default either way (outside WMF).

Change-Id: I6ec29abde0085d04b662b56b5ebcc2bd7fa267f8
2020-04-07 20:55:01 +01:00
jenkins-bot 855a7d73fa Merge "Simplify the CSS definition and extend the clickable area by 4px" 2020-04-07 09:48:15 +00:00
Fomafix b3335607e6 Simplify the CSS definition and extend the clickable area by 4px
Change-Id: I7fd42f647eccc24561474e6e977768bc0d1bfd07
2020-04-05 11:27:50 +02:00
jenkins-bot ce1640bae9 Merge "Localize numbers before passing to mw.msg" 2020-03-30 08:16:56 +00:00
Alexander Jones 884991e4a0 Localize numbers before passing to mw.msg
This commit localizes numbers before passing to mw.msg. This occurs
in two places, the successful replacement count and the error message
where too many cells are used in the table tool. The comment above the
second call was not correct, as the existing message used a substitution.

Bug: T244812
Change-Id: I00f83bd478bc42cb536edceba2bcc9daf0b13b3d
2020-03-27 14:04:27 +00:00
jenkins-bot 52bdc80a21 Merge "Replace arrow variants with CSS transformations" 2020-03-27 07:36:58 +00:00
Ed Sanders ec78f1a2b6 Replace arrow variants with CSS transformations
* Allows us to briefly animate the transition between
  expanded and collapsed
* Remove the left/right-arrows, and just use a single
  down-arrow with rotations.
* Remove the up-arrow used by the dropdown, we don't
  use that elsewhere in WMUI.
* Remove PNG fallback as `transform` works only with IE 9+
  and we're not supporting WikiEditor on Grade C browsers.

Change-Id: I29ab0c35b890689bdea8de5f6bbeef0948483fa5
2020-03-26 16:20:36 -07:00
jenkins-bot d050676356 Merge "Improve accessibility of expandable controls" 2020-03-13 19:36:35 +00:00
Akinwale Alagbe b2222d0afa Improve accessibility of expandable controls
Fixing aria-* attributes to the Heading menu and roles property to 
the menu dropdown items in order to make the element function like an 
ideal menu to screen readers. 

Adding aria-expanded attribute to Expandable panes(Advanced, 
Special Characters and Help) widgets to allow
screen readers announces of the state expandable buttons. 

Bug: T244426
Change-Id: I0cb47afd7f3622ed83a57410086984d9abc9acfd
2020-03-13 19:23:10 +00:00