Commit graph

105 commits

Author SHA1 Message Date
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
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 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
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
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
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
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
Ed Sanders 344da9de80 Move var declarations inline
Change-Id: I841ed46dfde9a6e2a5927e49ac3383d6e17bda66
2021-06-15 15:45:13 +01:00
Ed Sanders 137395538e Fix eslint warnings
Change-Id: I57b11c6b4c6e67bb38bb67a93b06d6d1d3009933
2021-05-23 15:49:49 +01: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
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
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
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
Fomafix 9542561b9c Preload modules of the file upload dialog
This prevents a delay when showing the file upload dialog.

Change-Id: I0c29def8e65302078d4fd528abee7c07373803e7
2020-03-03 06:26:10 +01:00
Fomafix 47a7e21216 Lazy load the modules for the upload dialog
This reduces the initial loaded modules.

Also add the dependency on module 'oojs-ui-widgets' because
jquery.wikiEditor.toolbar.js uses OO.ui.ToggleButtonWidget.

Change-Id: I03d0f73fb77bb389dd4e5ad2aa15b3ff5a97e5f5
2020-03-03 06:25:51 +01:00
Fomafix 3def0a39fc Use document.body instead of 'body' as jQuery selector
Change-Id: I05737b760a4875a58101a520d18cd21528175410
2019-12-16 11:36:27 +01:00
Ed Sanders 85ac5f2e07 build: Update linters
Change-Id: Idcac2a782781a86dabd91f30a41adac1ea94ef16
2019-10-29 22:16:13 +00:00
jenkins-bot 9a25fc5557 Merge "Remove use of jquery.tabIndex (take 2)" 2019-10-16 21:49:54 +00:00
Timo Tijhof b505eaed24 Remove use of jquery.tabIndex (take 2)
This was used for setting incremental tabindex attributes
on the <button> elements of the "Find and replace" dialog
as opened from the "Advanced" toolbar section. I was unable to
find a difference in behaviour with and without this code running.

Both with and without this, when tabbing from the first input
field in the dialog, the buttons are in the tab order after
the input fields (matching the visual rendering). Unclear
what this was doing.

This re-applies commit 81b08daa48, which was reverted (5f356b1a),
because I forgot to remove the calls in  dialogs.config.js.

Bug: T234581
Bug: T235701
Change-Id: Ic51074c3d2b2e9b9b050c9f42862519a3e78af16
2019-10-16 22:03:29 +01:00
Ed Sanders 2112538387 build: Update linters
Change-Id: I3a50982ee652c4c1c9b357c793e07cccf014e261
2019-10-07 16:52:10 +01:00
Timo Tijhof 7e5b71b04e mediawiki.RegExp (deprecated) -> mediawiki.util
Bug: T218339
Change-Id: Idd56fbd34648eeb42434848119b118375562cd14
2019-09-09 17:55:24 +00:00
Alex Monk 20d3c66c2c Follow-up Ia75d685c: Fix the insert file dialog
This appears to have been an oversight in the above change. Since the magic
words variable was no longer set, magicWordsI18N became null which broke
things, and caused whitespace info to not get recorded, which broke the
ability to handle the dialog being submitted too.

Bug: T230078
Change-Id: I5c44ed348de6ac2363d3d789b38053caa3935f62
2019-08-07 23:02:19 +00:00
Roan Kattouw d23d096281 Convert ext.wikiEditor module to packageFiles
This allows us to bundle the wgWikiEditorMagicWords and
mw.msg.wikiEditor(?!) config vars that were previously exported globally
in the startup module.

This code is old and crufty, so this is a somewhat minimal conversion:
* Use require() for jquery.wikiEditor.{dialogs,toolbar}.config.js,
  and for jquery.wikiEditor.{dialogs,toolbar}.js
* Don't attempt to convert jquery.wikiEditor.js to something
  require-based, instead just run it and let it set the $.wikiEditor and
  $.fn.wikiEditor globals
* Consolidate ext.wikiEditor.{dialogs,toolbars}.js into
   ext.wikiEditor.js

Bug: T222828
Change-Id: Ia75d685cbde786e8fceb6db36f2436b2beea1499
2019-08-05 22:24:56 +00:00
Alexander Jones 2075d6d2dc Pre-fill fields in image dialog when image code is selected in editor
This commit adds a function to parse image syntax selected in the
editor and uses the parsed data to automatically fill the fields
of the WikiEditor image dialog. Surrounding whitespace in the
selected wikitext is now included in the result. This causes an
issue with the ownline option in line 840, which appends an extra
line regardless of the post text.

Bug: T40829
Change-Id: Ib117a2e6350400f9298d4892a00981ac41f3dbbf
2019-08-01 00:34:06 -05:00
jenkins-bot 7c75285577 Merge "Search: Add option to search whole words" 2019-05-19 18:21:54 +00:00
Derk-Jan Hartman f501cdc9c6 Search: Add option to search whole words
Bug: T24478
Change-Id: Idb47ac392b0f8b1425053c6916db8f25c11c9762
2019-05-15 22:03:54 +02:00
Ed Sanders f9f01cf6b7 build: Update eslint-config-wikimedia 0.10.1
Change-Id: I71b5c0a1b499865b56ef6957427cae7c97609d73
2019-02-06 01:26:47 +00:00
Ed Sanders 583ad04b87 build: Update eslint-config-wikimedia to 0.10.0
Change-Id: I5fea8a1d6c91ea69c3490101ea38ce4626bd7e11
2019-01-08 23:32:56 +00:00
jenkins-bot 6cc83d2f93 Merge "Search & Replace: Fix using replace as first action" 2018-11-30 23:35:24 +00:00
Ed Sanders c19397ffbc Update eslint-config-wikimedia to 0.9.0
Change-Id: Ie60321d33b786a9f56fbf0df26571be7c0a29de8
2018-11-27 17:36:31 +00:00
jenkins-bot 4d479d62f9 Merge "Search & Replace: Use actual global replace" 2018-11-19 22:54:43 +00:00
Derk-Jan Hartman 38c3f2ed98 Search & Replace: Fix using replace as first action
When you use replace, before having used find, matchIndex gets out of
sync with what replace is expecting and encapsulateSelection won't
have a selection and thus defaults to position 0.

Bug: T76750
Change-Id: I1dcc724e7548690a3cc63672f93a3099c028f123
2018-11-19 07:21:21 +00:00
jenkins-bot 7ff3ffa829 Merge "Remove the dialog version of ref inserter" 2018-11-18 14:38:23 +00:00
Derk-Jan Hartman 8284c0480d Search & Replace: Use actual global replace
The old S&R implementation introduces problems with regexes (T58228 and
T50614) and is also rather slow. At some point in the past it was faster
to do multiple search/replace actions using textSelection perhaps, but
with current browsers doing a one shot replace will perform much faster.

If you have CodeMirror enabled, there will be a delay after replacing
all content on a major page, but no worse than the original page load
one, which I think is acceptable.

Bug: T58228
Bug: T50614
Bug: T25510
Change-Id: Ifab1d071d9f09ec55aa6556b5dca04378c4e5273
2018-11-17 21:11:01 +00:00
Derk-Jan Hartman 0089645a46 LinkDialog: Switch to jquery.throttle-debounce plugin
Change-Id: Iebca0398d6bc2939a0904c4cd23395d3207cfea5
2018-11-17 12:07:39 +00:00
Derk-Jan Hartman 709e2bbdfd Remove the dialog version of ref inserter
1: reftoolbar is used in more advanced situations
2: it doesn't actually do much
3: leaner

Keeping it in the same file, because that will preserve order. seems
safer.

Change-Id: I9bb2cf1e8731d12551a00b717b11602e6192d299
2018-11-16 21:49:31 +01:00
Derk-Jan Hartman aaa454b618 Remove browser arrays
Follow-up to I189516917d805dff3819e742a9fd8ad96a161159

Change-Id: Ic2e5389cc565ef061f4f846ad628ee6ea1a8a9fb
2018-11-15 22:59:51 +01:00
Derk-Jan Hartman a686b7f580 LinkDialog: use placeholder instead of fake values
Use proper placeholder attribute instead of faking it with a value.
This predated even jquery.placeholder and is no longer needed.
Also fixes a bug where it was checking with the API for the existence
of the placeholder value.

Bug: T133716
Change-Id: I290ec48f6b1d250da28efffd7ebdb6b681c0227e
2018-11-15 07:06:20 +00:00
Ed Sanders 4fa41179e8 Remove obsolete aliases from closures
Bug: T208951
Change-Id: I0b2993912de221e810414e46708c19be163922f6
2018-11-12 22:28:40 +00:00
Zoranzoki21 7ccbaa3539 Fix "the the" typo
Bug: T201491
Change-Id: I93f905e2f83c6f93aa75a3c826897c165873f6f5
2018-08-27 20:13:56 +00:00
James D. Forrester a24d4748a5 Fix missing 'find' icon, now called 'articleSearch'
Change-Id: I364ac11825564619898c699e66de7d36963cab49
2018-08-24 09:41:17 -07:00
Volker E 17b772e314 Use 'reference' instead of 'book' icon
'reference' is the standard icon for reference.

Bug: T202463
Change-Id: I3e0ed63c449de623a139b3ee3c6866ba3faa7712
2018-08-21 15:53:22 -07:00
Ed Sanders 72e48c26e0 Convert remaining tools to OOUI
Replaces the insert and advanced-insert groups, which
are currently multi-colour icons.

Drops the button-sprite + offset mode, according to
mwgrep there are no other users of this.

Bug: T191031
Bug: T143508
Change-Id: I7032f98908a591ea5c9d3dbbb7616e2c10bbfc80
2018-04-11 15:50:23 +01:00
jenkins-bot b0a5d572d1 Merge "Remove never-used tools" 2018-03-21 19:38:23 +00:00