Commit graph

10 commits

Author SHA1 Message Date
Sam Wilson 6cd0094581 Fix return value of TitleInputWidget.looksLikeExternalLink()
This method is supposed to return a boolean.

Change-Id: Id8fd80879770b6eeb5fcfce00eab4f124a8c1a56
2022-04-20 14:47:03 +08:00
Thiemo Kreuz dbb6583bbb Streamline smaller pieces of JavaScript code
The main idea is to make the code shorter and easier to read.

One notable change is to use .test() for boolean tests instead of the
actual .match() function.

Change-Id: Ic43442b75f839906b644d4586c907601f4d5d521
2022-03-04 09:22:07 +00:00
Timo Tijhof 90e6ccaced Remove unused jquery.wikiEditor.html file
Has sat there since the first commit in 2010 (r73055), but not used.
I imagine it was was a design prototype at some point.

Also fix a few minor eslint warnings about line length, and remove the
one-off "ext-" prefix and capitilised "WikiEditor" CSS class name that
the rest of the repo doesn't use.

Change-Id: Id0eeb456fffdb490a6a86974288e57099e53ce71
2022-03-03 15:27:18 +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
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 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 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