Commit graph

1120 commits

Author SHA1 Message Date
MusikAnimal 7d3482f89e Isolate build step to CM6 library and restructure files to work with RL
CodeMirror 6 requires the use of NPM, but we can still bundle all CM
packages into one file, and then everything else (i.e. our code) is
managed by ResourceLoader as per usual. This makes contribution
considerably easier as we no longer need a build step for each change.

CM5 files are now under resources/legacy, and the CM6 files are moved to
the root of the resources/ directory. Only one file,
codemirror.bundle.js, is managed by Rollup, while everything else is RL.
The Rollup output for now is put under resources/lib/ alongside the CM5
upstream files.

This patch is *mostly* renames of files, along with changing ECMAScript
Module (ESM) syntax into the CommonJS style that ResourceLoader prefers.
We also remove more modern JS syntax (i.e. private class methods) that
we were able to use before because we had a build step with Babel.

This patch should effectively make no user-facing changes, or to the
ResourceLoader modules we offer in Extension:CodeMirror.

Finally, bump version in extension.json to 6, to match the upstream lib,
and add Bhsd as an author :-)

Bug: T368053
Change-Id: Ie258e49f5df8db23a7344ac3c4c9300aaa991042
2024-07-31 22:45:48 -04:00
jenkins-bot f3be172173 Merge "Apply color inversion until dark syntax styles are chosen" 2024-07-29 16:11:07 +00:00
Translation updater bot e4581a0709
Localisation updates from https://translatewiki.net.
Change-Id: Ieebb12aee6a8be9a67c81d3af95b0bd4e81227e3
2024-07-29 09:26:16 +02:00
Sjoerd de Bruin c25da847c2 Apply color inversion until dark syntax styles are chosen
Bug: T365311
Change-Id: I72cf4e5ca776e7fda11b07174493696bfde7fde0
2024-07-27 21:37:47 +00:00
bhsd 0e0e4927ab codemirror.mediawiki.js: add Mod-Shift-x
This patch adds a keyboard shortcut `Mod-Shift-x` to toggle between left-to-right (LTR) and right-to-left (RTL) text directions.

Bug: T170001
Change-Id: Ia857ad0b0aff0bb206b45e4d27dee6e91a3effce
2024-07-20 17:29:09 +08:00
Translation updater bot 999382fd16
Localisation updates from https://translatewiki.net.
Change-Id: Iecc5ff3b0f6c6fad86812e1557bcf4249f308085
2024-07-18 09:22:26 +02:00
Translation updater bot e229edaf75
Localisation updates from https://translatewiki.net.
Change-Id: I1ec995a128047fc153a26b08463aab1b37e2f394
2024-07-16 09:39:20 +02:00
jenkins-bot a1770cb3e8 Merge "build: Update jsdoc-wmf-theme to 1.1.0" 2024-07-08 13:34:52 +00:00
Fomafix e0dc1c0c32 Use service 'GadgetsRepo' instead of deprecated GadgetRepo::singleton()
The service 'GadgetsRepo' gets injected as optional service.

This change requires a phan dependency on extension Gadgets in
project integration/config in file zuul/parameter_functions.py:
I5052e0c666b7dc7af6061e57001f9feac666e029

Change-Id: Ib405ad79b3c348bed51a8938a6a8f73bd35267d2
2024-07-01 09:32:50 +00:00
Ed Sanders 17fefeb8fb build: Update jsdoc-wmf-theme to 1.1.0
Bug: T368081
Change-Id: I188c5549415f4620bb95df2e285c5519bc97ead1
2024-06-26 12:09:52 +01:00
MusikAnimal 08730d2a85 CM5 mediawiki.less: Inherit font color from skin
This is a short-gap measure to make the 2017 editor + dark theme more
readable. Implementing a dark theme for all of the MediaWiki tokens will
come in a future patch.

Bug: T365311
Change-Id: Ie56b88960eb0d27e9a1f821101dfa14af37c0130
2024-06-25 00:43:18 +00:00
Ed Sanders b3316356c0 Remove unnecessary local context variables
Change-Id: If73c0cfca93711003ece3332c9cdc6f3e3fa4944
2024-06-22 10:26:58 +01:00
Ed Sanders f0fb93d3e1 ESLint: Enforce prefer-const
Change-Id: I7f45137a47dddcd2fc70201f28680edce907b522
2024-06-22 10:26:58 +01:00
Ed Sanders 1b101f09ee ESLint: Update syntax to ES6 and autofix
Change-Id: I613cc64a9bf3f375a40f75a1441b83f181a2ab42
2024-06-22 10:26:58 +01:00
Ed Sanders 6958b99f2e build: Update eslint-config-wikimedia to 0.28.2 and autofix
Change-Id: I622f53bf5f56782b7a0529cdc6bb27c1315ff5a0
2024-06-17 13:02:26 +00:00
James D. Forrester 170869190c HooksTest: Swap out use of deprecated getOptionKinds()
Change-Id: I992b102de6fc4e346d27d6a729c5b518a6d2fb3c
2024-06-14 11:34:06 -04:00
libraryupgrader f98b120974 build: Updating braces to 3.0.3
* https://github.com/advisories/GHSA-grv7-fg5c-xmjg

Change-Id: I637259940dcc6d3a3c1bec1cd6d75a671db921f9
2024-06-11 02:56:45 +00:00
Translation updater bot 3c741fd43c Localisation updates from https://translatewiki.net.
Change-Id: Ie9f17ba7a7f7417fb7cd5ee42aeadd777721554e
2024-06-10 09:54:59 +02:00
MusikAnimal 293a15725d ext.CodeMirror.visualEditor: check language dir of html for new pages
New pages do not have body content yet, so the LTR check added with
If3825d6e54 failed. This commit adds the document root (<html> element)
as the fallback, so CodeMirror can be used on new pages.

This is just a quick fix. CM6 for VE 2017 wikitext editor is almost
done, and that will come with RTL support (T357482).

Bug: T366201
Bug: T363752
Follow-Up: If3825d6e5467d2bcff2d83e838081bf041243920
Change-Id: I9d4a4b817ac2462396c159ceae6f1510c0fae64d
2024-05-30 23:48:05 -04:00
James D. Forrester 0c7044e764 .nvmrc: Update version from 18.17.0 to 18.20.2
Change-Id: Ie6b0918ff7cd627e9323e5f447c993f6b1448d8f
2024-05-30 22:04:13 -04:00
MusikAnimal 7856e62dea CodeMirror: +rectangularSelection and crosshairCursor as def extensions
These were default in CM5

To be added to the preferences panel once that's a thing (T359498)

Change-Id: I5a8b330444dd2dff0acfbd8e2d429a5b5273cd61
2024-05-21 22:52:08 -04:00
MusikAnimal 0e5fe342d9 CodeMirror: make bracket matching match CJK full-width brackets
This is only done for wikitext because CJK brackets can cause unexpected
errors in other languages.

Bug: T362992
Change-Id: Icf98e8fd7e0392845df2e3b7d3201e7f94f95a3f
2024-05-21 23:17:43 +00:00
Translation updater bot a21aa79e2d Localisation updates from https://translatewiki.net.
Change-Id: Ibcc25f7b10ec183fd83c14f459a9f0e62006bcd7
2024-05-20 09:24:50 +02:00
libraryupgrader 31815d8036 build: Updating grunt-banana-checker to 0.13.0
Change-Id: Ieeb3108280f96193a45dd8e5c5472ee97a985388
2024-05-18 03:53:50 +00:00
jenkins-bot 549539c3b5 Merge "rollup: speed up dev build by bypassing babel and terser plugins" 2024-05-14 02:12:23 +00:00
MusikAnimal 198a1f7d72 rollup: speed up dev build by bypassing babel and terser plugins
Brings it down from ~3 secs on my machine to ~600 ms.

This also allows for debuggers, and essentially eliminates the need
for source maps on your local (though we should probably still look
into them for prod).

Change-Id: I4c164b409b2c327e439e1524d4a898693bd8d907
2024-05-14 01:51:13 +00:00
jenkins-bot b23a901106 Merge "CM6: Add 'ext.CodeMirror.input' hook; improve code examples" 2024-05-14 01:48:35 +00:00
jenkins-bot d594143c04 Merge "CM6: Rework ResourceLoader modules" 2024-05-14 01:23:01 +00:00
jenkins-bot f4e9eb38e2 Merge "ext.CodeMirror.visualEditor: don't load on RTL pages" 2024-05-13 23:46:31 +00:00
Translation updater bot 2e3aac9a1e Localisation updates from https://translatewiki.net.
Change-Id: I91c6d789d652e152d42ba5567e54b71107b4453c
2024-05-13 09:26:46 +02:00
libraryupgrader 477da344c0 build: Updating grunt-banana-checker to 0.12.0
Change-Id: I2fda64fe3eeb5f681911ddd5454d0409405dceb6
2024-05-10 02:24:46 +00:00
libraryupgrader 8ea2953375 build: Updating dependencies
composer:
* mediawiki/minus-x: 1.1.1 → 1.1.3

npm:
* jsdoc-wmf-theme: 1.0.0 → 1.0.1

Change-Id: Id3d2d7b46648c8ea139ef8a72c12fb0861915922
2024-05-08 07:35:28 +00:00
Translation updater bot 4fa142e4dd Localisation updates from https://translatewiki.net.
Change-Id: I35c6955ba5ce0117e383b2d1b136922e49e34f86
2024-05-06 09:25:18 +02:00
jenkins-bot 45c2cf6d9e Merge "CodeMirrorModeMediaWiki: one-line definition list" 2024-05-03 07:22:42 +00:00
Translation updater bot 566e17ac8a Localisation updates from https://translatewiki.net.
Change-Id: Ib24099130aa32f4017ca59dd79c7ab484b882130
2024-05-02 09:19:15 +02:00
libraryupgrader 888593d412 build: Updating ejs to 3.1.10
* https://github.com/advisories/GHSA-ghr5-ch3p-vcr6

Change-Id: I6ca8243e3b40258207a01f0e8a91a7ddc0db47fb
2024-05-02 03:03:36 +00:00
MusikAnimal c873f9d9fa ext.CodeMirror.visualEditor: don't load on RTL pages
CodeMirror 5 does not work on RTL pages. This commit does a crude check
of the `dir` attribute of `.mw-body-content .mw-parser-output` because
the VisualEditor surface and even the native textarea isn't available
when the module is first loaded.

Bug: T363752
Change-Id: If3825d6e5467d2bcff2d83e838081bf041243920
2024-04-29 15:31:23 -04:00
Translation updater bot ee5b0ee87e Localisation updates from https://translatewiki.net.
Change-Id: I3d4b3a559c8ba593036a34cad86a958d54b8fb3f
2024-04-29 09:22:59 +02:00
bhsd 52471d4b8f CodeMirrorModeMediaWiki: one-line definition list
Add highlighting for a special one-line definition list syntax `;a:b`. Also highlight `;a` in bold.

Bug: T170042
Change-Id: Ia3bdf481469368fcb5a7651729dde4b5f3682ed8
2024-04-29 09:44:27 +08:00
Translation updater bot eee5093270 Localisation updates from https://translatewiki.net.
Change-Id: Ibc5f11ccd67a5bcd5afdcaa45978055cf47d7665
2024-04-26 09:47:51 +02:00
libraryupgrader f34db5db7f build: Updating dependencies
composer:
* php-parallel-lint/php-parallel-lint: 1.3.2 → 1.4.0

npm:
* jsdoc-wmf-theme: 0.0.13 → 1.0.0

Change-Id: Id6718e5acc928c5d0aae6d143d49b73afcf33bd9
2024-04-25 03:43:10 +00:00
Taavi Väänänen 5c71833728 build: Update eslint-config-wikimedia to 0.27.0
Change-Id: I71646291ecf6ba22dd5a0e45f44ea54eacfa6bfc
2024-04-24 11:46:59 +00:00
Translation updater bot ca6eb17ffe Localisation updates from https://translatewiki.net.
Change-Id: Ibf686ea7289ef5882b17cb5c63e982117364b2ed
2024-04-24 09:18:31 +02:00
Translation updater bot f466cbebd4 Localisation updates from https://translatewiki.net.
Change-Id: Ib2d60417bfa879138eb97f149d8436fbd1e6266a
2024-04-22 09:27:54 +02:00
MusikAnimal 2aa6d5c564 CM6: Add 'ext.CodeMirror.input' hook; improve code examples
A 'ext.CodeMirror.input' hook is added to give integrations direct
access to the ViewUpdate object when changes are made in CodeMirror.

Bug: T174811
Change-Id: Idb6166996abb7d64ac8a956f362aea5eda0392bc
2024-04-18 16:33:32 -04:00
Translation updater bot 0173293326 Localisation updates from https://translatewiki.net.
Change-Id: I4bf5892bd44a3217c75565e775e46b75c27c58f5
2024-04-18 09:20:11 +02:00
MusikAnimal c853e9587d CM6: Rework ResourceLoader modules
Documentation is at https://w.wiki/9kxt

The idea is that modules ending in `.init` imply they initialize
CodeMirror and maniuplate the DOM. The others only export classes for
use in integreations.

In doing so, 'ext.CodeMirror.v6.WikiEditor' now only exports the
CodeMirrorWikiEditor class, while 'ext.CodeMirror.v6.WikiEditor.init'
is added for use on #wpTextbox1 through action=edit.

Bug: T174811
Change-Id: Iec62ac9dc77918904bed886d2d46ccc03e0927f7
2024-04-15 12:40:16 -04:00
jenkins-bot 918b1bc295 Merge "Add $wgCodeMirrorRTL to control rollout to RTL wikis" 2024-04-15 13:57:44 +00:00
Translation updater bot 7f57f704b3 Localisation updates from https://translatewiki.net.
Change-Id: I29043a70e4a58c8412f4dbc8cd61ff4505ef8a86
2024-04-15 09:27:42 +02:00
jenkins-bot 5d3ca9785f Merge "CodeMirrorModeMediaWiki: put bidi isolation behind URL feature flag" 2024-04-15 04:01:27 +00:00