Commit graph

356 commits

Author SHA1 Message Date
MusikAnimal 6ad8e6231b Add BetaFeature for CodeMirror 6
Don't list beta feature if $wgCodeMirrorV6 is true

Move all images to new images directory

Bug: T376735
Change-Id: I3ce25cccb7c66fbf5c719e6b704af9c22f405876
2024-11-25 14:03:05 -05:00
Translation updater bot 0c25c1745d
Localisation updates from https://translatewiki.net.
Change-Id: I6c9af893093cfaad20810b231f6ebecc20ae9763
2024-11-25 08:22:51 +01:00
jenkins-bot b61fe12dfe Merge "CodeMirrorSearch: catch exceptions from invalid regex input" 2024-11-22 23:21:05 +00:00
MusikAnimal b464df36ab CodeMirrorSearch: catch exceptions from invalid regex input
Invalid regular expressions would error out on SearchQuery's getCursor()
method. This is arguably an upstream bug, but we want to inform the user
of invalid input anyway. We now show "Invalid regular expression" where
the "$1 of $2" codemirror-find-results message is normally shown, and we
add the error class to the Codex input. This is to be consistent with
how the 2017 editor behaves.

Also disable autocompletion which is more often distracting that
helpful for a search field.

Bump codemirror/search to include a fix where the selection isn't
updated after a regex replacement.
See https://discuss.codemirror.net/t/8832

Bug: T371436
Change-Id: I68722da98ef4925439caa64e8f3366031d56cf8e
2024-11-22 19:42:11 +00:00
Translation updater bot 0906e75c94
Localisation updates from https://translatewiki.net.
Change-Id: Id5c298dca0d16de5ce38bb29810c6f05db980720
2024-11-22 08:41:05 +01:00
Translation updater bot 4dfd50860f
Localisation updates from https://translatewiki.net.
Change-Id: I9b6c86cd502005c69784a3335936f29f210a94fb
2024-11-21 08:21:22 +01:00
Translation updater bot b250cf90d5
Localisation updates from https://translatewiki.net.
Change-Id: I188738969d1a83e0f00c3d42c327d4ee3c88d119
2024-11-20 08:25:15 +01:00
jenkins-bot 8fb5d8cc5d Merge "CodeMirrorModeMediaWiki: autocompletion" 2024-11-19 18:54:45 +00:00
bhsd 197b5649ff CodeMirrorModeMediaWiki: autocompletion
Autocomplete magic words, tag names and url protocols. This patch also enables block comment using `<!-- -->`.

Bug: T95100
Change-Id: If37da956ac1eb945b96753e6728c0247b1a68b66
2024-11-19 16:02:35 +08:00
Translation updater bot 94128280de
Localisation updates from https://translatewiki.net.
Change-Id: Ie7df21a656a64634e8086784cb0213ffd16d678b
2024-11-19 08:17:32 +01:00
MusikAnimal 13c9eae26e CodeMirrorPreferences: add panel to tweak prefs with the editor open
This is toggled by pressing Mod-Shift-, (or Command-Shift-, on MacOS),
which then puts focus on the preferences panel. It can be closed with
the Escape key, just like other CM panels.

The CodeMirror class comes with these extension which can be toggled in
preferences:
* Bracket matching
* Line numbering
* Line wrapping
* Highlight the active line
* Show special characters

Only bracket matching, line numbering, and line wrapping are available
in the 2017 editor.

The bidi isolation and template folding extensions are registered in
CodeMirrorModeMediaWiki as they are MW-specific. CodeMirrorPreferences'
new registerExtension() method allows any consumer of CodeMirror to add
any arbitrary extensions to the preferences panel. This is expected to
be called *after* CodeMirror has finished initializing. The
'ext.CodeMirror.ready' hook now passes the CodeMirror instance to
accommodate this.

The preferences are stored as a single user option in the database,
called 'codemirror-preferences'. The defaults can be configured with the
$wgCodeMirrorDefaultPreferences configuration setting. The
sysadmin-facing values are the familiar boolean, but since CodeMirror is
widely used, we make extra efforts to reduce the storage footprint (see
T54777). This includes only storing preferences that differ from the
defaults, and using binary representation instead of boolean values,
since the user option is stored as a string.

For now, all preferences are ignored in the 2017 editor. In a future
patch, we may add some as toggleable Tools in the VE toolbar.

Other changes:
* Refactor CSS to use a .darkmode() mixin
* Add a method to create a CSS-only fieldset in CodeMirrorPanel
* Fix Jest tests now that there are more calls to mw.user.options.get()
* Adjust Selenium tests to always use CM6
* Adjust Selenium tests to delete test pages (useful for local dev)
* Remove unused code

Bug: T359498
Change-Id: I70dcf2f49418cea632c452c1266440effad634f3
2024-11-18 22:23:22 -05:00
Translation updater bot a1415b27ac
Localisation updates from https://translatewiki.net.
Change-Id: I4c547c321bed98305ec2b6d90ea3cbc6446e6c43
2024-11-12 08:17:29 +01:00
Translation updater bot 57b6aa9ee2
Localisation updates from https://translatewiki.net.
Change-Id: I649f015a8970fb96c2c73942c6eeec2ec6807bbb
2024-11-11 08:22:09 +01:00
Translation updater bot c412a73fb8
Localisation updates from https://translatewiki.net.
Change-Id: I408bc2b7e6ab5f35a98be57a94ee0e39f7603f1f
2024-11-08 08:28:18 +01:00
Translation updater bot 4770cb4c3a
Localisation updates from https://translatewiki.net.
Change-Id: Ie2e1351e68cd7b86034ebc1b39001b123cbad0f9
2024-11-05 08:32:03 +01:00
Translation updater bot 93ed8014a3
Localisation updates from https://translatewiki.net.
Change-Id: Id23e2ee7484d1c83d56f2031f5076b6a0b052367
2024-11-04 08:21:12 +01:00
jenkins-bot 140ac0cdb0 Merge "CodeMirrorSearch: add num results and current selection; improve tabbing" 2024-11-01 05:52:50 +00:00
MusikAnimal 3c3050447b CodeMirrorSearch: add num results and current selection; improve tabbing
Just like the 2017 editor, we show the number of results and which one
is currently highlighted.

This patch also brings the Tab behaviour closer to the 2017 editor.
Hitting Tab from the search input focuses the replace input, followed by
the replacement buttons, then the find buttons, then the content
editable. Shift+Tab largely does the reverse, except Shift+Tab from the
editor doesn't bring you to the search panel. Doing this would require a
lot of work for minor benefit, as we'd need to determine which panel to
focus to.

Add basic unit test

Bug: T371436
Change-Id: I968f91320ecb6ab9e9da0994052d33c76f85974b
2024-10-31 18:25:05 -04:00
Translation updater bot e87db823f3
Localisation updates from https://translatewiki.net.
Change-Id: I768adf6767f0e1e2bc344e4b8e7e0b37531e302f
2024-10-28 08:21:50 +01:00
Translation updater bot 9c13028f12
Localisation updates from https://translatewiki.net.
Change-Id: I625c8d853d02be6664c70afacd2fd23a9214a62d
2024-10-21 09:19:46 +02:00
Translation updater bot 7add5426ea
Localisation updates from https://translatewiki.net.
Change-Id: I6654e248d55c964c519b37ceefb3c13d12cae6ab
2024-10-14 09:28:45 +02:00
Translation updater bot f26c3a8058
Localisation updates from https://translatewiki.net.
Change-Id: I67ed443c460e29d8eb67aabb0af0d00a79fe31bd
2024-10-07 09:25:22 +02:00
Translation updater bot ea4541b775
Localisation updates from https://translatewiki.net.
Change-Id: I6d32a192d4c7157ace9ff41cc39aabb456814d0b
2024-10-01 09:37:05 +02:00
Translation updater bot 20e9b86a28
Localisation updates from https://translatewiki.net.
Change-Id: Id53c1bee9ce52a934ab014d646102a152e6724b4
2024-09-30 09:20:46 +02:00
Translation updater bot c867ff594f
Localisation updates from https://translatewiki.net.
Change-Id: Ia3f52be7871f943cdd12f877eb812eab63299db1
2024-09-27 09:18:19 +02:00
Translation updater bot 8ad93bdc50
Localisation updates from https://translatewiki.net.
Change-Id: I81c8e65f19693ec50504dc09f22c6967449c2ee6
2024-09-25 09:17:21 +02:00
Translation updater bot e3113cf1bc
Localisation updates from https://translatewiki.net.
Change-Id: I2b3b14dfcbd76942ee1a5e5ddc5383633902a21d
2024-09-23 09:21:07 +02:00
Translation updater bot 63a49bbe28
Localisation updates from https://translatewiki.net.
Change-Id: I30145fe0a9b34fda3007d8652078e2e94e633720
2024-09-19 09:17:58 +02:00
Translation updater bot 293606db65
Localisation updates from https://translatewiki.net.
Change-Id: I0b9ed1626e0055b646f496e7f6911b7072669a9b
2024-09-18 09:18:41 +02:00
Translation updater bot cb9a82fa0d
Localisation updates from https://translatewiki.net.
Change-Id: I398d6d7e3d9b05cd1ea1d039249eeeba644f6d20
2024-09-17 09:26:51 +02:00
Translation updater bot 4d1619c8a3
Localisation updates from https://translatewiki.net.
Change-Id: I1feeed69abdb34a710eaf651fe0ab6e5078472e0
2024-09-16 09:25:36 +02:00
Translation updater bot fe4770e96f
Localisation updates from https://translatewiki.net.
Change-Id: I070793164c7b347d41393f10aa415bfc1460d5da
2024-09-09 09:22:16 +02:00
Translation updater bot c587a83a50
Localisation updates from https://translatewiki.net.
Change-Id: Idc5b8af4ac5acad8c0b11fd6e713b53fb8f22530
2024-09-06 09:39:03 +02:00
Translation updater bot b8cf07f86f
Localisation updates from https://translatewiki.net.
Change-Id: I5943df57e0abe8c8892b21d2c325b2b8cde7217a
2024-09-05 09:23:03 +02:00
Translation updater bot 373c16ad38
Localisation updates from https://translatewiki.net.
Change-Id: I8e40b8f629ebf645faabd6df6b9b8b6ca7f27c63
2024-09-04 09:16:12 +02:00
jenkins-bot 74aeccf9c6 Merge "Implement dark mode styles and use Codex CSS components in search panel" 2024-09-03 15:59:15 +00:00
Translation updater bot 2263d5050c
Localisation updates from https://translatewiki.net.
Change-Id: I13444f696b6a2786cceb02fd09c5343770cecb32
2024-09-03 09:31:55 +02:00
Translation updater bot 7890ebc334
Localisation updates from https://translatewiki.net.
Change-Id: Ic4cbb937827d897220d8b1720af1e2baef1497f7
2024-09-02 09:20:23 +02:00
MusikAnimal 81ec0c292a Implement dark mode styles and use Codex CSS components in search panel
Use Codex design tokens where possible, and implement custom dark
theming for things for which there is no suitable design token.
This means we're changing the colors for light mode ever so slightly.

We need to style the search panel for dark mode, so we might as well
tackle T371436 and use CSS-only Codex components. The same is done for
the "Go to line" panel (can be opened with Mod+Alt+g). The messages in
this panel are now also localizable.

The search panel (and goto line panel) are abstracted, with helpers to
create the Codex components. These will not only be used here but also
for the upcoming preferences panel (T359498).

Visually, the search and goto panels were inspired by the 2017 editor
and share a similar layout. CodeMirror similarly uses a more compact
design than usual to maximize the real estate of the editor itself.

Other changes:
* Bump codemirror/search to get latest bug fixes
* Remove stylelint ignorance and fix errors
* Move CM5 styles to ext.CodeMirror.less
* Move CM-specific styles out of mediawiki.less and into codemirror.less
* Move WikiEditor-specific styles to codemirror.wikieditor.less
  (incidentally, these only apply to CodeMirror 6)
* Correct qqq documentation; the "dialog" should be called a "panel"
* extension.json: alphabetize list of messages

Bug: T365311
Bug: T371436
Bug: T359498
Change-Id: I6a3bbc6bce4e490886753ff484e377c1763de456
2024-08-29 18:59:57 -04:00
Translation updater bot 6a1f2fdb00
Localisation updates from https://translatewiki.net.
Change-Id: Ib3da1bc0ddb1320a8061bf2968982baa6d389312
2024-08-29 09:17:35 +02:00
Translation updater bot 56d9cc572e
Localisation updates from https://translatewiki.net.
Change-Id: Idc1ce91c2cb4763a42409634bd9af37244346690
2024-08-28 09:37:30 +02:00
Translation updater bot 7828d42109
Localisation updates from https://translatewiki.net.
Change-Id: I523c2ae19ee492506a0f0c226d1bb6e137c82056
2024-08-27 09:47:22 +02:00
jenkins-bot 56f63a0bba Merge "CodeMirrorWikiEditor: use new icon and add text to toggle button" 2024-08-27 04:10:54 +00:00
Translation updater bot 7660ca42fb
Localisation updates from https://translatewiki.net.
Change-Id: Ife2adcbae823e4e83151ffa25ea630e49c7f096b
2024-08-26 09:21:53 +02:00
Translation updater bot a921171236
Localisation updates from https://translatewiki.net.
Change-Id: Ic80bf56c8809a2cd13beaf405c251fc5eacff4dc
2024-08-20 09:42:01 +02:00
Translation updater bot 84c9051241
Localisation updates from https://translatewiki.net.
Change-Id: Iad21458855117c703abd5a10edaebbad69e568cf
2024-08-19 09:22:41 +02:00
Translation updater bot 76daceca00
Localisation updates from https://translatewiki.net.
Change-Id: I4afa253d54f04fc2cc1ac078aa3153adb3696b39
2024-08-14 09:22:15 +02:00
Translation updater bot 601809c398
Localisation updates from https://translatewiki.net.
Change-Id: Ie18f6ee98278aa546985c465449c29286bf68932
2024-08-13 09:50:22 +02:00
MusikAnimal 27b6aaebcc CodeMirrorWikiEditor: use new icon and add text to toggle button
For years, users have complained that the CodeMirror toggle button is
confusing and concealed. The icon looked too similar to the edit icon,
when it was supposed to be a highlighter. The new icon is similar but
has a highlighted line to help clarify what it is. We also now have the
text 'Syntax' accompanying the icon. Translators are instructed to try
to be brief to conserve space in the toolbar. "Syntax highlighting" is
the full correct term, and remains the text for the button's tooltip.

The new icon is ~0.3KB uncompressed, just meeting performance guidelines
for using @embed <https://w.wiki/AsPW>. This is also only temporary until the icon is upstreamed in Codex/OOUI.

New icon courtesy of Thiemo Kreuz (WMDE)

A corresponding change for the 2017 editor will follow I15453b33e7.

Bug: T174145
Change-Id: Ib6dbfc261214ed6672c1a54738e3401fa2f5d262
2024-08-09 06:08:33 +00:00
Translation updater bot f7d64fd0ee
Localisation updates from https://translatewiki.net.
Change-Id: I9c6f2b49bf726d8c51e0e90de14c6d9a78a92b9d
2024-08-06 09:46:18 +02:00