Commit graph

6 commits

Author SHA1 Message Date
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
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 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 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