Commit graph

851 commits

Author SHA1 Message Date
Adam Wight d6c6dbd73a Browser tests for CodeMirror (wikitext 2010 editor)
Basic tests to show that the highlighting classes have been attached
to the expected elements.

TODO in later patches:
* tests for the wikitext 2017 editor

Bug: T270240
Change-Id: I01ebd9881d38dd877f19ee3bb4fdcbb74d43afaf
2021-01-08 11:01:13 +01:00
Ed Sanders b59f296849 Guard against WikiEditor being removed by the time the hook runs
Bug: T271457
Change-Id: I73d2934847361592bceec51108404bf45ed4a5d7
2021-01-07 21:06:25 +00:00
Ed Sanders 7aceb6d65c Make private convertOffset function a shared method
Change-Id: I7e644ff998bd44e854b26dd9b11ba9a5d3bd0435
2021-01-06 14:57:32 +00:00
jenkins-bot 9b1b5795a6 Merge "Simplify onSelect handler implementation" 2021-01-06 11:20:44 +00:00
Thiemo Kreuz a43984fc67 Simplify onSelect handler implementation
Optimizations for the code introduced in Ic403e0a:
* Skip this entirely when something is selected (as discussed
  in Ic403e0a).
* Use a combination of existing methods. I benchmarked these
  again. This approach is "significantly" slower compared to
  the custom code from before. However, "significantly" here
  means something like 1 nanosecond vs. 4 nanoseconds. Both
  is effectively nothing.
* Use the same approach in another place. This one is triggered
  every time a change is made, e.g. a character typed. I
  benchmarked this as well. The new code is about 500x faster
  (yes, seriously).

Bug: T269094
Change-Id: I00fe595a89be7a257e27ed28d38568c81483338b
2021-01-05 22:50:04 +00:00
jenkins-bot 9a018ccb4a Merge "Provide cookie workaround for setting the feature flag" 2021-01-05 16:19:57 +00:00
jenkins-bot 773b308fab Merge "Integrated bracket matching for CodeMirror with VisualEditor" 2021-01-05 11:37:57 +00:00
Adam Wight 88fd6a4e28 Provide cookie workaround for setting the feature flag
This is a convenient way to propagate alternate configuration during
browser testing.

Bug: T270240
Change-Id: Ica6399c53499be7f930e8d13b838ad265b66cdf4
2021-01-04 16:09:11 +01:00
jenkins-bot 1ea61ad2aa Merge "Use wikiEditor.toolbarReady hook instead of ready event" 2020-12-31 03:29:51 +00:00
WMDE-Fisch 17fb4ceb7e Integrated bracket matching for CodeMirror with VisualEditor
Bug: T269094
Change-Id: Ic403e0a037127ed006e8d1168d710e6160a922d5
2020-12-29 21:34:16 +00:00
Ed Sanders 0c681f5300 ve-cm: Fix selection opacity when using fallback technique
The fallback technique makes the whole edit surface semi-transparent,
so reset native selections to full opacity.

Change-Id: If6cd585b1a09c549781fe82a3bdf18d64ac597b5
2020-12-28 23:38:16 +00:00
Ed Sanders 5bba5436a8 Use wikiEditor.toolbarReady hook instead of ready event
The hook avoids race conditions as it will run even if
CodeMirror loads after the toolbar.

Change-Id: Ida035fad473210add4a604b3c8d65d2d4edb49dc
2020-12-28 23:26:39 +00:00
Translation updater bot 16f8d02327 Localisation updates from https://translatewiki.net.
Change-Id: I8878e7489cff56f54ed7ca2bd058fb2ca70eebc1
2020-12-28 10:37:43 +01:00
libraryupgrader 65d92d8cb0 build: Updating mediawiki/mediawiki-phan-config to 0.10.6
Change-Id: I6744bcc582625b26a9fc9ca6666cff6ae48b1e56
2020-12-19 12:42:09 +00:00
Adam Wight d8f4982e79 Added bracket matching
* using CodeMirror addon matchBrackets
* highlights the matching bracket of a pair
* highlights brackets when cursor is inside a pair
* feature usable in source code editor

Bug: T261857
Change-Id: Ib01d9919a47bb29684b54501644b01936b57972a
2020-12-15 13:09:06 +00:00
libraryupgrader 4a6641f93a build: Updating ini to 1.3.8
* https://npmjs.com/advisories/1589

Change-Id: Iee4eda7181d333c3c18162347a8732eafd3c9bdc
2020-12-12 22:44:28 +00:00
jenkins-bot 8ef6d23814 Merge "Update CodeMirror to 5.58.3" 2020-12-10 08:49:44 +00:00
libraryupgrader b080db35f4 build: Updating mediawiki/mediawiki-phan-config to 0.10.5
Change-Id: Ic157781bf1ddd469dcb5b63c545c589f586616a8
2020-12-10 04:02:32 +00:00
Thiemo Kreuz 4a3c2dcad5 Update CodeMirror to 5.58.3
I had to make some CSS selectors more specific, because the
library changed

 .CodeMirror pre

to

 .CodeMirror pre.CodeMirror-line,
 .CodeMirror pre.CodeMirror-line-like

This is only relevant for entire lines (implemented as <pre>
elements). Most of the custom CSS is for characters, not lines.

In my tests in the Wikitext editor as well as VisualEditor I
could not spot any difference between the old and new version.

Bug: T258999
Change-Id: I6f0f030f972838727f3ef220feb105264f122798
2020-12-07 20:20:49 +00:00
libraryupgrader 759c05628b build: Updating mediawiki/mediawiki-codesniffer to 34.0.0
Change-Id: Ibf2cb27387e8a04fe1b5cb11a568aeb62eab2d14
2020-12-06 04:02:30 +00:00
jenkins-bot 43577c13d8 Merge "Record usage statistics for syntax highlighting" 2020-11-26 11:53:39 +00:00
Andrew Kostka 7d01567c4f Record usage statistics for syntax highlighting
Bug: T260138
Change-Id: Ic9b95d6331bf85704822a69483880faaaa578a0e
2020-11-25 15:18:01 +01:00
libraryupgrader 6eb419a981 build: Updating npm dependencies
* grunt-stylelint: 0.15.0 → 0.16.0
* stylelint-config-wikimedia: 0.10.1 → 0.10.3
  The following rules are failing and were disabled:
  * unit-disallowed-list

Change-Id: I5a9fb77b79121a25846d0ab6a85cbfe70b9624c6
2020-11-21 23:22:44 +00:00
libraryupgrader 4912720a1b build: Updating mediawiki/mediawiki-phan-config to 0.10.4
Change-Id: I1399f5150d3a10f7a813a1a37054433185c65aae
2020-11-20 01:52:47 +00:00
libraryupgrader de62f40fc2 build: Updating mediawiki/mediawiki-codesniffer to 33.0.0
Change-Id: I45a2d7e506decf76fa2ae5cdc072eda4ad507b24
2020-11-03 14:03:10 +00:00
libraryupgrader 10b701f029 build: Updating mediawiki/mediawiki-codesniffer to 32.0.0
Change-Id: I0221e69e1c93d734fbad9171823a1f2828680d19
2020-10-29 07:32:58 +00:00
jenkins-bot 024b890554 Merge "Add missing PHPUnit tests for better coverage" 2020-10-28 10:04:49 +00:00
Translation updater bot 6d27cfbb5d Localisation updates from https://translatewiki.net.
Change-Id: Id7587435a02ca604ebb34ee2920f94bfce9a1703
2020-10-26 08:30:15 +01:00
Thiemo Kreuz ff1c26e877 Add missing PHPUnit tests for better coverage
Change-Id: I242aa52a24a11de3db106e5e2c73bd6f2a95d80c
2020-10-08 10:18:45 +02:00
Translation updater bot effb782d7e Localisation updates from https://translatewiki.net.
Change-Id: Ie2e6d58dd457f5609a7c8c262f9a5f5730fdfeca
2020-09-30 08:41:22 +02:00
libraryupgrader 0a2f5ab225 build: Updating mediawiki/mediawiki-phan-config to 0.10.3
Change-Id: I1747ec159a73f783d87ef4b4714ba7426de4c7e5
2020-09-24 23:05:04 +00:00
Translation updater bot cd07272c23 Localisation updates from https://translatewiki.net.
Change-Id: I4353f595b3e17d01e291c738d41acc2802ec58c6
2020-09-21 08:29:02 +02:00
libraryupgrader 6588901edc build: Updating npm dependencies
* eslint-config-wikimedia: 0.16.2 → 0.17.0
* grunt: 1.2.1 → 1.3.0

Change-Id: I278fca1f9e622f1249f67e20dca8451a88095fbd
2020-09-05 11:09:53 +00:00
Thiemo Kreuz 3e9bb4fb08 Replace all .png images with rgba() background colors
The rgba() syntax is supported for a very, very long time now:
https://caniuse.com/#feat=mdn-css_types_color_alpha

Notes:

I realized the numbers in these file names are actually their
transparency in percent (more precisely their opaqueness).
4 is 4% which translates to 0.04 in the rgba() syntax.

I used Gimp to pick the opaque color values from the images.
Gimp makes this easy. No guesswork or calculations needed.

For multiple, stacked images I calculated the colors by
averaging their RGB values (considering how opaque each color
is). Note this is actually *more* precise than the stacked
images before. Stacking alpha colors is flawed. For example:
Let's say we have an rgba(255, 255, 255, 1) background.
Layering a half transparent rgba(255, 0, 0, 0.5) on top means
half the background shines through. This averages to
rgba( 255, 127, 127, 1). Now we stack rgba(0, 0, 0, 0.5) on
top. Again, half the background shines through, resulting in
rgba(127, 63, 63, 1).

When we apply the two colors the other way around, the result
is rgba(191, 63, 63, 1), a much brighter red.

This flaw doesn't happen when precalculating the averages, as
done in this patch.

Change-Id: I29026864714c5f90c2613af57f08693e7e2b996c
2020-08-11 14:24:20 +02:00
Translation updater bot eb2b184c47 Localisation updates from https://translatewiki.net.
Change-Id: I9c42dc0012b8dfda12aa7bffefdc2fc8eb59e32c
2020-07-21 09:10:49 +02:00
libraryupgrader 2e6df07619 build: Updating grunt to 1.2.1
Change-Id: I4c436acf28a54810bb7035c92bcaa66636daed6c
2020-07-18 02:49:18 +00:00
libraryupgrader d66ed8d702 build: Updating eslint-config-wikimedia to 0.16.2
Change-Id: Idfdc82e8ebc8981d58536bf3abd0a6e5b76cbc2a
2020-07-15 22:25:58 +00:00
jenkins-bot f40872ec83 Merge "Fix 'setSelection' in textSelection API" 2020-07-15 19:21:51 +00:00
Ed Sanders 9f566d6046 Fix 'setSelection' in textSelection API
focus needs to come after setSelection

Change-Id: Ib073ddad445e05c4bc042b9c382a7d74369e29e1
2020-07-12 15:10:58 +00:00
Pavel Astakhov a9da1fa59e Load pluginModules in CodeMirrorAction class
Change-Id: Ia698be63171868cf568b136df89ce3e48eab1340
2020-07-10 17:12:23 +06:00
libraryupgrader 35593d526e build: Updating lodash to 4.17.19
* https://npmjs.com/advisories/1523
* CVE-2019-10744

Change-Id: I1e138a3c826b4b5817f8ee612b9ac7cfec84257b
2020-07-09 04:43:40 +00:00
Ed Sanders 89f52f6fbb VE: Add explicit dependency on targetLoader
Change-Id: I3d67837b462e0b79e124eff158bd7f88b5aaf63e
2020-06-30 22:47:41 +01:00
Ed Sanders 2518861bc1 build: Update devDependencies
Change-Id: I2f2967a1525c6a66eba2f5fc225e74b89380c5dd
2020-06-12 22:51:38 +01:00
libraryupgrader e849f7feb2 build: Updating mediawiki/minus-x to 1.1.0
Change-Id: Ie2fc67295839fc54381427b68f0b2f4bccfd87ee
2020-06-08 06:50:27 +00:00
libraryupgrader 3f8a9e9f21 build: Updating mediawiki/mediawiki-phan-config to 0.10.2
Additional changes:
* Removed phan-taint-check-plugin from extra, now inherited from mediawiki-phan-config.

Change-Id: I71e11b4cb6129fb9ed4380686da8d96efa9b9fda
2020-06-02 10:37:08 +00:00
libraryupgrader 781dea919d build: Updating composer dependencies
* php-parallel-lint/php-console-highlighter: 0.4.0 → 0.5.0
* php-parallel-lint/php-parallel-lint: 1.0.0 → 1.2.0

Additional changes:
* Replaced "jakub-onderka" packages with "php-parallel-lint".

Change-Id: If172ac9a842ba5495374ac974349fa1d91d42b1b
2020-05-31 01:08:19 +00:00
libraryupgrader 2d843a31c3 build: Updating mediawiki/mediawiki-codesniffer to 31.0.0
Additional changes:
* Replaced "jakub-onderka" packages with "php-parallel-lint".

Change-Id: Ieff06ce69212205a73c29e80459f6ef9031e1488
2020-05-29 10:17:30 +00:00
Reedy 55e2bd0558 Move CodeMirrorPluginModules from config to attributes
Change-Id: I38c33f5d140a88f9eda1df7094a203fd7009412e
2020-05-12 18:29:44 +00:00
jenkins-bot 3a62cc522b Merge "Convert to manifest_version 2" 2020-05-12 17:43:30 +00:00
Reedy 58289325f4 Convert to manifest_version 2
Bug: T252470
Change-Id: I23fea7028e5adc0a95b783aa0a3caf80c04f6a00
2020-05-12 16:53:47 +00:00