Commit graph

812 commits

Author SHA1 Message Date
libraryupgrader 5717268bf2 build: Updating composer dependencies
* mediawiki/mediawiki-codesniffer: 35.0.0 → 36.0.0
* php-parallel-lint/php-parallel-lint: 1.2.0 → 1.3.0

Change-Id: Ic0a73b848e4fe838be71a6450dff8bb6bd06c1b8
2021-05-04 02:01:33 +00:00
Alexander Vorwerk 6bf535cffc Avoid using User::getOptionKinds()
User::getOptionKinds() is deprecated and should be replaced with UserOptionsManager::getOptionKinds()

Bug: T277600
Change-Id: Ie30ae74839f91aa48c53a5ebf680adb21eb9b047
2021-05-03 11:39:48 +00:00
jenkins-bot 6fd33d774f Merge "Fix MediaWiki highlighter partly failing on quoted attributes" 2021-04-30 12:43:30 +00:00
Željko Filipin ae374bf752 selenium: remove @wdio/devtools-service NPM package
Devtools Service is "A WebdriverIO service that allows you to run
Chrome DevTools commands in your tests".

It was introduced in 2019 (1955a8a) but we are not using it.

For more information see:
https://webdriver.io/docs/devtools-service/

Bug: T280334
Change-Id: Idc5172cd62a1ca3fea9275829dda764c94d877ed
2021-04-28 12:37:18 +02:00
Thiemo Kreuz 032bed3c61 Fix MediaWiki highlighter partly failing on quoted attributes
In T270880 an example with a slash in <ref name="a/b"> is
described. The same issue happens with several other characters
including the closing bracket, e.g. <ref name="a>b">. This patch
fixes all of this by accepting _all_ characters between double
and single quotes.

Bug: T270880
Change-Id: I03a1e1a25af692dc703b44a57b2d23d6fc15c8c9
2021-04-23 20:43:33 +02:00
jenkins-bot f569bf8d75 Merge "Fix bracket matching getting stuck when leaving the brackets" 2021-04-23 14:58:23 +00:00
Thiemo Kreuz 26a05d1dd0 Allow HTML comments and newlines in template names
Bug: T277767
Change-Id: I0a82af178d768e5f4d3dd81b1759c0ce72310397
2021-04-23 15:34:20 +02:00
Thiemo Kreuz 5186c6f3a2 Fix bracket matching getting stuck when leaving the brackets
Bug: T278840
Bug: T280978
Change-Id: Ia552fcd829ce38cbb7ac7fd7ebecad971a83e4c3
2021-04-23 14:48:23 +02:00
libraryupgrader 6e6356ccc0 build: Updating eslint-config-wikimedia to 0.20.0
Change-Id: I2ba141a980f111088c29a2730b23d7d6695513a6
2021-04-16 06:19:03 +00:00
Adam Wight ed2f9944ea Enable line numbering only on configured namespaces
Introduces a new config variable `CodeMirrorLineNumberingNamespaces`
that can restrict line numbering to only appear for specified
namespaces.  Setting to null enables everywhere.

This takes some liberties with the `lib` module, turning it into a
container for shared functionality.  This can be pursued in later
work, by cleaning up duplicated code in this repo.

FIXME: failed to deduplicate the code for now.

Bug: T267911
Change-Id: Ida2b33eef38edc57d29756ec472c6f2c83bd7b11
2021-04-12 12:05:14 +02:00
Thiemo Kreuz 6937d0e51c Fix incomplete (auto)clear for highlighted brackets
The issue can be reproduced as described in T278840. What
happens is that an (auto)clear is triggered and removes all
marks, but the cached values in `currentMarks` remain. The next
time the same marks are found, they are discarded and don't
show up, because the cache says they are already there, when
they are not.

Bug: T278840
Change-Id: If83bd99e924f579854cfe4b01fab4ef86892933b
2021-04-09 11:07:26 +02:00
jenkins-bot 58f29d0895 Merge "Reposition line numbering to be flush with the title" 2021-04-08 13:02:06 +00:00
Adam Wight f2b6cec8f6 Reposition line numbering to be flush with the title
Bug: T267911
Change-Id: I8aab2f53ebba63a93f5a6bd63d616db801965ae0
2021-04-08 13:22:10 +02:00
jenkins-bot 47c39056e9 Merge "Enable line numbering" 2021-04-08 11:19:24 +00:00
Thiemo Kreuz 7365cc9a96 Enable line numbering
Line numbering will be unconditionally enabled.

Bug: T267911
Change-Id: I9eb07dd433e352ed5cea5dc978d469ee2ea6f347
2021-04-08 09:53:23 +02:00
DannyS712 d45f03e989 Delete empty translation files
Change-Id: I61dc2163b3614f6a6f6c27009f45bbbf554bd27d
2021-04-08 02:07:35 +00:00
libraryupgrader a915a7ce90 build: Updating y18n to 3.2.2
* https://npmjs.com/advisories/1654 (CVE-2020-7774)

Change-Id: I012b0b09e2eab2d3837fef9a65f33db8978b77a9
2021-03-29 23:31:41 +00:00
libraryupgrader 6d572ef018 build: Updating wdio-video-reporter to 3.1.1
Change-Id: I29e1ab8f3bac5a24238f4c200408efd1c137e65e
2021-03-16 07:23:30 +00:00
libraryupgrader b5cae2deed build: Updating eslint-config-wikimedia to 0.19.0
Additional changes:
* eslint: Renamed `wikimedia/client` profile to `client-es5` (T277085).

Change-Id: I1484baf844452307972f6f3904a4e1dba9bd9fed
2021-03-13 07:17:44 +00:00
Translation updater bot 06291d721d Localisation updates from https://translatewiki.net.
Change-Id: I9f900e109f4e624657a5b103b3470e28ffed903a
2021-03-12 08:45:20 +01:00
jenkins-bot f1ef877d28 Merge "Update color scheme to meet accessibility standards" 2021-03-09 16:08:25 +00:00
jenkins-bot cf79b0f237 Merge "Refine bracket matching styling" 2021-03-09 10:35:16 +00:00
WMDE-Fisch 9bea2a7905 Refine bracket matching styling
Adds a custom class for matched brackets to allow better integration
with custom bracket styles. The brackets won't be bold in the 2017WTE.
Bold font might lead to misalignment there. See ticket.

Note: box-shadow seems to be supported for quite some time by all
relevant browsers

Bug: T270926
Change-Id: Ica1e301f63a106a96db3bfaba4b2f322af64b009
2021-03-08 09:26:07 +01:00
libraryupgrader 8869ebc998 build: Updating eslint-config-wikimedia to 0.18.2
Additional changes:
* Dropped .php5 and .inc files from .phpcs.xml (T200956).

Change-Id: I91e283fc746d1521e668e7230d0d107c1d862dfd
2021-03-06 09:27:20 +00:00
Andrew Kostka aaf67a9c0b Update color scheme to meet accessibility standards
These changes to the color scheme are hidden behind a feature
flag for the time being.

Bug: T271895
Change-Id: I0a4b03e0f3bc8239f31edbbd5ae55661607b76f6
2021-03-05 16:39:14 +01:00
jenkins-bot 05241f1259 Merge "Add accesskey to CodeMirror input field" 2021-03-02 09:26:32 +00:00
Jon Harald Søby e325bc2e13 Add accesskey to CodeMirror input field
Add the same accesskey that the normal <textarea> uses.

Bug: T259347
Change-Id: I67c3b9d374203a5dabc29cc8c61fa76e2b64cb5a
2021-02-25 14:06:51 +01:00
Adam Wight 5956c74773 Finalize event platform migration
Bug: T275005
Change-Id: I55c4282dea0820a31bf8d7d428913512a35c6986
2021-02-24 16:38:09 +01:00
jenkins-bot 92524135c0 Merge "Revert "Lower maxHighlightLineLength limit to 5000"" 2021-02-10 16:35:47 +00:00
Thiemo Kreuz (WMDE) 0268f68170 Revert "Lower maxHighlightLineLength limit to 5000"
This does not have an effect any more with all the other
optimizations in place.

This reverts commit 094f20902c.

Bug: T274369
Change-Id: I288039a35270093bd22b5a073e70f6b769088c13
2021-02-10 16:19:10 +00:00
Thiemo Kreuz cfecfbc099 Fix remaining bottleneck in wikitext syntax highlighter
I was wondering why the performance when editing wikitext is
still so bad, and profiled it again. Turns out
StringStream.match() is still the bottleneck (even if already
100 times better than before Icbb1122).

The method is called with many different patterns from
mode/mediawiki/mediawiki.js. I profiled them individually and
found a single outlier. The idea is the same as in Icbb1122.
A pattern that is able to find something *in* a string is
doing nothing but wasting time, as StringStream.match() ignores
every result that is not at the start of the string.

The change adds the missing ^ anchor and wraps the regex pattern
from mw.config.get( 'wgUrlProtocols' ) (that is something like
"ftp:\/\/|http:\/\/|https:\/\/|…") in (?:…), which is a
non-matching group. This is necessary because of the | in the
pattern. The result is a pattern that looks like /^(?:…|…|…)/i.

I remember looking at this code while working on Icbb1122, but
didn't include it in the patch, and then forgot about it.

Bug: T270237
Bug: T270317
Change-Id: Iea2fd116b68704c3186b0edf965006cc7c6eda82
2021-02-05 16:07:40 +01:00
Adam Wight 81bd2fe546 Clean-up: inline array merge
Change-Id: Ie976bf70f4117db09b53e6192f983930c7e6a458
2021-02-01 13:24:05 +01:00
libraryupgrader 37b851824d build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 34.0.0 → 35.0.0
* mediawiki/minus-x: 1.1.0 → 1.1.1

npm:
* eslint-config-wikimedia: 0.17.0 → 0.18.1

Change-Id: I9e4ed7d632072b303d0dcb4135a5ecaaf4b68685
2021-01-29 06:50:49 +00:00
jenkins-bot 96b81c3420 Merge "Log user edit count bucket" 2021-01-27 09:11:17 +00:00
Adam Wight 36212a7877 Log user edit count bucket
Bug: T269986
Change-Id: Iff3c983a59738312bc39bf65e2428526724fe139
2021-01-27 09:03:28 +00:00
Thiemo Kreuz 6bc81ffd50 Improve matchbrackets performance when moving the cursor
My previous patch Icbb1122 focused on the behavior of the
matchbrackets addon when the text is *edited*. This patch here
is about moving the cursor without changing the text. I
realized the addon re-draws everything every time the cursor
moves, even if the highlighted pair of brackets is still the
same. This triggers very expensive code in the CodeMirror lib.

I had a look at this expensive code, but did not found an easy
win. It just is what it is: an expensive re-draw. Instead I
introduced a caching layer that remembers the positions of the
previously highlighted brackets and bails out as early as
possible when nothing changed.

The biggest chunk of code is that "did something change?"
comparison. It looks expensive, but typically isn't. There are
typically only 2 elements in the array for a single
opening–closing pair. (Possibly more when there are multiple
text selections.) The elements in the two arrays are typically
in the same order. (Except the cursor is on the closing
bracket.) Which means the nested `every` → `for` loop will
typically be executed 2 times only – one time for each of the
2 elements.

I won't upload this change upstream because it is only relevant
together with our custom "in the middle" bracket highlighting.
With our customization we have many, many situations where the
highlighted brackets don't change. This (almost) doesn't happen
upstream.

Bug: T270317
Change-Id: I789b45362388f0818e797f789f6af427a35e3e06
2021-01-27 08:54:32 +00:00
Thiemo Kreuz 26f41000a8 Fix failing new WikiPage() call
Apparently this started to fail when the first character is not
capitalized.

Change-Id: Id9233984095652560cd473a33721f9835497b13b
2021-01-27 08:42:19 +01:00
Translation updater bot a059689440 Localisation updates from https://translatewiki.net.
Change-Id: I550836e9a5bf6c68eb188320a5b42e0c12e3bcff
2021-01-27 08:33:54 +01:00
Thiemo Kreuz 473a711aaa Rename our customized matchbrackets addon
Bug: T269096
Change-Id: I5b58099166f71ccc1b3b19334f28e8bbaafaceb3
2021-01-20 11:17:59 +01:00
jenkins-bot 9ab93e1c54 Merge "Lower maxHighlightLineLength limit to 5000" 2021-01-20 10:03:06 +00:00
Thiemo Kreuz 094f20902c Lower maxHighlightLineLength limit to 5000
While working on T270317, I realized the performance of the
matchbrackets addon is not as good as described in
T270237#6739993. The issue with my original benchmark was that
I did it with a single pair of brackets with thousands of
characters between. A paragraph with thousands of brackets
behaves much worse. So bad that I feels painful when moving
the cursor.

Lowering the limit to something in the middle (between the
original 1000 and my 10000) makes it behave much, much better
on my machine.

Bug: T270237
Bug: T270317
Change-Id: I31f850f4c7778d6b5ff1d0eb17fdaf0edf7ae019
2021-01-19 15:04:14 +01:00
WMDE-Fisch 7ec8ebc84d Concretised comment around WMDE disabled line
Change-Id: Ibc4e1568bae78e92371e21314edc16857be7afed
2021-01-19 13:21:48 +01:00
jenkins-bot 081071e534 Merge "Disable non-matching highlighting via config flag" 2021-01-19 08:46:42 +00:00
Thiemo Kreuz 18a64328bb Disable non-matching highlighting via config flag
My upstream patch was accepted within 9 minutes:
https://github.com/codemirror/CodeMirror/pull/6565

Note: This backport includes another upstream commit that fixed
some typos.

Bug: T269096
Change-Id: Ib5b64214d7536bc952886f45290d537eab2f9bbb
2021-01-18 09:51:05 +00:00
libraryupgrader 995d1ed3f2 build: Updating ini to 1.3.8
* https://npmjs.com/advisories/1589

Additional changes:
* Added the "composer phan" command to conveniently run phan.

Change-Id: I3911019defc17997ebf18b6102a9cf96bd06b1e4
2021-01-14 15:20:11 +00:00
Thiemo Kreuz a43acbeb6b Activate bracket matching for longer lines
The addon does have 3 settings:
- maxHighlightLineLength is for the current line where the
  cursor is. Bracket matching is simply not done when the
  current line is longer. The default is 1000, which is rather
  low.
- maxScanLineLength is for every other line that is scanned in
  the process. I don't understand why, but this limit is 10x
  higher.
- maxScanLines is the number of lines that can be scanned.

Simply raising the first to be 10000 as well fixes our issue.

Note that CodeMirror does have a limit of 10000 anyway. It's
called maxHighlightLength there. Lines that are longer get
syntax highlighting only for the first 10000 characters. The
rest of the line is black. Using the same limit in the addon
makes it's behavior consistent. Means: The user can see when
the syntax highlighting stops, and bracket matching stops
working the same time.

I benchmarked with both settings. It doesn't have a measurable
effect. Bracket matching is done in <1ms in both cases.

Bug: T270237
Change-Id: Ia56bf4c2fb023c9f117376242221d39f51196173
2021-01-14 11:28:02 +00:00
jenkins-bot ea8cffe3f2 Merge "Fix performance bottleneck in mediawiki syntax highlighter" 2021-01-14 11:22:33 +00:00
jenkins-bot 68ab91b64d Merge "Fix minor code style issues in matchbrackets addon" 2021-01-14 10:50:06 +00:00
Thiemo Kreuz 88984d2965 Fix minor code style issues in matchbrackets addon
Less ambiguous variable names. Less duplication. The minor
issues have been introduced in T270317.

Bug: T270317
Change-Id: I366396a61b76e19293ce8d14c2f346b97498fe40
2021-01-14 11:13:24 +01:00
Thiemo Kreuz f1cf1a534c Fix performance bottleneck in mediawiki syntax highlighter
I continued profiling the matchbrackets addon for T270237 and run into
performance issues that turned out to be unrelated to the addon. The
flame graph highlighted a "match" function. Note this is not the
String.match() from JavaScript, but something in the CodeMirror lib:

StringStream.prototype.match = function (pattern) {
  var match = this.string.match(pattern);
  if (match && match.index > 0) {
    return null;
  }
  return match;
}

(Note: I simplified this code so we can focus on the bug.)

When the pattern is a regular expression, it's executed via
JavaScript's String.match(). The function then checks if there was a
match and if it's at the start of the string. If not, it's not a
match and doesn't return one.

In other words: Even if there is a match somewhere in the string, the
function acts as if there was no match.

When we change all patterns to be anchored via ^, they don't scan the
entire string any more but return much ealier when there is no match
at the start of the string. We are effectively replacing nested loops
(hidden in the patterns) with single calls.

This bug exists since 2014.

The disabled line in the matchbrackets addon is just dead code. I
don't remove it to document the fact that we disabled it.

Bug: T270237
Bug: T270317
Change-Id: Icbb1122e6a3b26c0606726ff405e108931d185be
2021-01-13 16:58:57 +01:00