Commit graph

1175 commits

Author SHA1 Message Date
Translation updater bot f7d64fd0ee
Localisation updates from https://translatewiki.net.
Change-Id: I9c6f2b49bf726d8c51e0e90de14c6d9a78a92b9d
2024-08-06 09:46:18 +02:00
MusikAnimal bdb8e008df CodeMirror: add Ctrl+Shift+z as redo shortcut on Windows
This worked in CM5, so we'll retain it in CM6 for those who have the
muscle memory.

Bug: T365072
Change-Id: I4d45ca03773b5140f3e39e15bfba664b577c055d
2024-08-05 15:11:41 -04:00
MusikAnimal f9ecb5b2de Use dispatchEvent instead of jQuery triggerHandler for focus/blur events
triggerHandler will not bubble up the DOM, which is necessary for some
listeners such as Charinsert.

This patch applies the fix to both CodeMirror 5 and CodeMirror 6.

Bug: T361465
Change-Id: I4c01b031de0b19d72b6f2c31566a7f9cc0b02ad8
2024-08-05 13:45:06 -04:00
bhsd 925775778a CodeMirror 6 for VE 2017 wikitext editor
Add new temporary ext.CodeMirror.visualEditor.init RL module which
selects the temporary ext.CodeMirror.visualEditor.v6 or non-v6 based on
$wgCodeMirrorV6. This will allow us to deploy CM6 further.

As a result of this work, the core CodeMirror class now has knowledge
of ve.ui.Surface.

Other changes:
* Add Compartment for specialCharsExtension so it can be disabled in VE.
* Add option to mediaWikiLang() to disable template folding.
* Add support for RTL wikis where $wgCodeMirrorRTL is enabled.
* Make CodeMirror.logUsage() and setCodeMirrorPreference() static.
* Fix unit and linting tests.

Some code courtesy of Fandom, GPLv2-or-later; see:
https://github.com/Wikia/mediawiki-extensions-CodeMirror/commit/ef297c48c

Bug: T357482
Change-Id: I15453b33e77e1c1b4d5e5183e41e53d56ff14c3e
2024-08-01 03:15:21 -04:00
bhsd 8ba52cdfcb CodeMirrorModeMediaWiki: various small fixes
This patch fixes a few minor issues in the tokenizer, including indented table (T108454), tag name followed by punctuations (T357720), free external link ending with `~` and `'` (T358643), and Hebrew parser function containing whitespace (T170004).

Bug: T108454
Bug: T357720
Bug: T358643
Bug: T170004
Change-Id: Ib3fff9ea8f9045d885ecfb1dc58c72f5afb8877a
2024-08-01 02:03:17 -04:00
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