Commit graph

65 commits

Author SHA1 Message Date
MusikAnimal d652f3d2a2 CM6: Add jsdoc build step, fix JSDoc annotations, and add @stable tags
There is a known bug with JSDoc and using `export default`. These must
be separate statements for JSDoc to parse properly.
See https://github.com/jsdoc/jsdoc/issues/1132

Update README; change log now lives on the wiki.

Bug: T359986
Depends-On: I58a0766e35eddaf7bebe2c080757bb09963d8555
Change-Id: Ibc2212ef9eab512511b13a99ecc2ccbda8c52ece
2024-03-26 13:35:47 -04:00
MusikAnimal ca02360228 CM6: Switch to using Rollup instead of Webpack; make RL-compatible
See https://w.wiki/9Twh for example usage with ResourceLoader.

Webpack is retired in favor of Rollup, which allows us to convert the
ECMAScript Modules into CommonJS modules for use by ResourceLoader.
We now have a file in dist/ for each RL module that we want to offer,
including the 'lib' module which includes the CM library itself.

Because Rollup has no knowledge of the ResourceLoader module registry,
the generated output requires other modules via relative path, when it
needs to be the RL module name. To get around this, we do a crude
find/replace after the files are generated. Hacky, but necessary to make
CodeMirror usable by gadgets and scripts that don't also want
WikiEditor.

Add new RL modules 'ext.CodeMirror.v6.lib' (vendor code) and
'ext.CodeMirror.v6' (the main CodeMirror class, sans WikiEditor).

Clean up extension.json, listing the v6 modules beneath the old ones.

Bug: T214989
Change-Id: Ide716247e545cf2bdd977bea645729564ebbe6e2
2024-03-19 22:48:52 -04:00
libraryupgrader b19d4c3383 build: Updating bundlesize to 0.18.2
Change-Id: I746631d5890930cf7d37673d88ce00e49d68c973
2024-03-15 22:32:23 +00:00
bhsd 506d998767 CodeMirror 6 template folding
This patch adds an icon displayed above the cursor inside a template. By clicking it, the template parameters become hidden and replaced by three dots, while the template name remains visible. Clicking the dots will unfold the template. New key bindings include fold (Ctrl-Shift-[/Cmd-Alt-[), unfold (Ctrl-Shift-]/Cmd-Alt-]) and unfoldAll (Ctrl-Alt-]).

Bug: T30684
Change-Id: I631fe0ecf21d0a80306bd40d66d22478a1aefe58
2024-03-07 13:47:47 +08:00
bhsd e4eb2846c9 fix scroll behavior of CodeMirror 6
Previously, the CM6 editor always scrolls into view, which is annoying during preview. With this patch, the CM6 editor only scrolls to the selection while the whole webpage does not scroll. In addition, the editor's scroll position will be memorized when previewing.

This patch requires an update of the @codemirror/view package.

Bug: T212899
Bug: T254962
Change-Id: I7f5e4694fa55c380958fa60ff6b3341bea1d2f02
2024-03-01 13:01:11 +08:00
MusikAnimal 46b458cc0c CodeMirrorWikiEditor: add extension for multiple selections/cursors
This was preexisting behaviour in CM5 as a rather hidden feature,
and this patch brings it to CM6 keeping it just as hidden. That is,
to have focus in the texatrea, hit Ctrl (or ⌘ on Mac) to insert multiple
cursors, and similarly multiple selections and change their content.

This doesn't actually fix the bug reported at T211205. That may not
even be fixable, since jQuery.textSelection is the interface used to
interact with editors, and it doesn't support multiple selections.

Bug: T211205
Change-Id: I9d4d634c2ba46b909543a0090b871cee4b183fa0
2024-02-14 08:09:25 -05:00
libraryupgrader 1651e7e3e2 build: Updating dependencies
composer:
* mediawiki/mediawiki-phan-config: 0.12.1 → 0.14.0

npm:
* grunt-banana-checker: 0.11.0 → 0.11.1

Change-Id: I9cf51b23b89c9fea0b777c7abb9104f23e8647d0
2024-02-10 07:28:15 +00:00
James D. Forrester 75127a79e3 .nvmrc: Update now we're using Node 18
This also necessitated switching to a newer version of
babel-loader that is compatible with Node 18's SSL stack.

Change-Id: Ic9b65ced978fd91a3c0e50ab94cd59556c355ba9
2024-01-11 11:05:51 -05:00
MusikAnimal c670344851 Implement core MediaWiki stream parser for CodeMirror 6
This is more or less a exact port of the old stream parser, with the big
notable change being that all configuration-related code lives in a
separate class, CodeMirrorModeMediaWikiConfig. A smaller change is that
closing HTML tags that are marked as errors now have the ending '>'
character highlighted red, when it didn't before.

Integration with other extensions and modes is saved for a future patch
(T348684). This means <nowiki>, <ref> and other extension-supplied
markup is not yet highlighted.

The entry point for WikiEditor integration is now at
ext.CodeMirror.v6.WikiEditor.init.js, which needs to first require the
virtual file set via the DataScript (PHP) class. This can't be
integrated into the CM6 code because it needs to be precompiled before
ResourceLoader can use it (T281781).

Known issues, to be addressed separately:

* No support for TagModes / PluginModes (T348684)
* Identical adjacent tokens produce excess markup (T352917)
* Section headings do not have line-level styling (T351686)

Bug: T348019
Change-Id: I8f8a81f362bed60dea14ecde9487a2b0c89225e8
2024-01-02 23:18:32 -05:00
MusikAnimal 62485151c2 CodeMirrorWikiEditor: add bracketMatching as default extension
By default, this feature highlights unmatched brackets when the cursor
is placed over it. This can be disabled, but seems useful so we'll add
it as one of the new features in README and see how users react.

Bug: T348019
Change-Id: Ie6af715e40aeb8217a7c4dfe0c6e6a3dcfa725d5
2023-12-06 01:46:58 -05:00
MusikAnimal 75fa1ec8c7 Bump Node dependencies and fix deprecations and linting failures
Bumps the following, which will be needed by subsequent patches:

* stylelint-config-wikimedia = 0.16.1
* webpack = 5.89.0
* webpack-cli = 5.1.4
* @babel/preset-env = 7.3.0

Change-Id: Icd44ad126f11365ee1215672cee66868e79c8978
2023-12-06 00:43:15 -05:00
MusikAnimal 880c690a10 CodeMirror6: add new modules, feature flag, and URL query parameter
Add a new $wgCodeMirrorV6 temporary feature flag that when enabled,
will load the 'ext.CodeMirror.v6.WikiEditor' module that is built
against CodeMirror 6. You can also pass in the ?cm6enable=1 query
parameter to force use of CodeMirror 6. This is currently only
implemented for the 2010 editor.

Due to packaging constraints with CodeMirror 6, we now use Webpack to
bundle the files, which are then used by ResourceLoader. This is similar
to what is done for Extension:Popups, MobileFrontend, among other
extensions.

A new generic class CodeMirror can be used on other areas where syntax
highlighting is desirable, but not necessarily for editing (i.e. without
WikiEditor).

This commit merely lays the foundation for CodeMirror 6 and updates
WikiEditor to use it. The actual MediaWiki syntax highlighting will come
with a future commit.

With the new Webpack build, the Gruntfile was removed and the tasks
moved to npm commands.

Bug: T317243
Change-Id: I2239d2449b2db3b638551f847eb4eff1aafa6276
2023-10-09 19:51:24 -04:00
WMDE-Fisch e6852a47f8 [build] Bump wdio-mediawiki to v2.3.0
Change-Id: I87225bc7cb311b6bbeb57f56e9ed4715f4958f76
2023-09-22 16:01:38 +00:00
Ed Sanders 21c121b898 build: Update linters
Change-Id: I49eb2de402a8c89065968cf927a2ca6a361ca684
2023-09-13 14:02:43 +01:00
James D. Forrester 9e9a38d6fc Refactor CodeMirror WebdriverIO tests from sync to async mode
Bug: T300205
Change-Id: Idfcfc984833ca6ca6c09500cd4715a4e5504f84e
2023-06-06 10:49:22 +02:00
libraryupgrader c898ddf371 build: Updating npm dependencies
* grunt-banana-checker: 0.10.0 → 0.11.0
* stylelint-config-wikimedia: 0.14.0 → 0.15.0

Change-Id: I952b7bd8671bd684446b90d92d2b0ba2837b3cc8
2023-06-01 02:55:40 +00:00
libraryupgrader 025910fccd build: Updating eslint-config-wikimedia to 0.25.0
Change-Id: I1eab6254c50272e4b794eb60721cc52eae319ad9
2023-05-04 01:35:40 +00:00
libraryupgrader fc5ad37762 build: Updating dependencies
composer:
* mediawiki/mediawiki-phan-config: 0.12.0 → 0.12.1

npm:
* grunt-eslint: 24.0.0 → 24.0.1

Change-Id: I6a871fed872d8314e82cd083db2ab98ba683d63a
2023-04-29 01:27:19 +00:00
libraryupgrader d4d29ace60 build: Updating npm dependencies
* grunt: 1.5.3 → 1.6.1
* stylelint-config-wikimedia: 0.13.1 → 0.14.0

Change-Id: Ib5ce0735dfac337882d65155b767adc773f0691b
2023-03-27 19:38:31 +00:00
Umherirrender 818245a30f build: Updating npm dependencies
* eslint-config-wikimedia: 0.22.1 → 0.24.0

Change-Id: I576c1693596280e56b05ea6f485c1a995167112c
2023-03-25 22:37:01 +01:00
Peter Wangai 070ba2cf9b selenium: Remove webdriverio npm package from the CodeMirror extension
The `webdriverio` package does not need to be an explicit dependency.
It is a dependency of `@wdio/cli`.

Bug: T325059
Change-Id: I74db4da791a3a9da5e130bf5e676264c8aff28ef
2023-01-11 15:36:51 +03:00
libraryupgrader d6983e8a53 build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 39.0.0 → 40.0.1

npm:
* stylelint-config-wikimedia: 0.13.0 → 0.13.1

Change-Id: If385e70b0bf3353adbf9d3b2f95986c9e38476a8
2022-11-16 04:20:15 +00:00
libraryupgrader b75dfe00ae build: Updating grunt-stylelint to 0.18.0
Change-Id: I1fa7e3a65a17a90bd69af999f195634f5c27a22a
2022-11-13 02:34:56 +00:00
libraryupgrader 9ee72034e8 build: Updating grunt-banana-checker to 0.10.0
Change-Id: Iadb6cf0718e589b83bc0b833fcd066cb53081e26
2022-10-06 21:10:21 +00:00
libraryupgrader ab9fa44e39 build: Updating grunt to 1.5.3
Change-Id: Ice96760213e0b100bfa38255f5330ea711c9d6d0
2022-05-26 09:01:24 +00:00
libraryupgrader 0924c055bb build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 38.0.0 → 39.0.0
* mediawiki/mediawiki-phan-config: 0.11.0 → 0.11.1
* php-parallel-lint/php-console-highlighter: 0.5.0 → 1.0.0
* php-parallel-lint/php-parallel-lint: 1.3.1 → 1.3.2

npm:
* grunt: 1.4.1 → 1.5.2
* stylelint-config-wikimedia: 0.12.2 → 0.13.0
* wdio-mediawiki: 1.1.1 → 1.2.0
* async: 3.2.0 → 3.2.3
  * https://github.com/advisories/GHSA-fwr7-v2mv-hh25
  * https://github.com/advisories/GHSA-fwr7-v2mv-hh25
* ejs: 3.1.5 → 3.1.8
  * https://github.com/advisories/GHSA-phwq-j96m-2c2q
* jake: 10.8.2 → 10.8.5
  * https://github.com/advisories/GHSA-fwr7-v2mv-hh25
  * https://github.com/advisories/GHSA-fwr7-v2mv-hh25
* json-schema: 0.2.3 → 0.4.0
  * https://github.com/advisories/GHSA-896r-f27r-55mw
* jsprim: 1.4.1 → 1.4.2
  * https://github.com/advisories/GHSA-896r-f27r-55mw
* minimist: 1.2.5 → 1.2.6
  * https://github.com/advisories/GHSA-xvch-5gv4-984h
* mocha: 9.1.2 → 9.2.2
  * https://github.com/advisories/GHSA-qrpm-p2h7-hrv2
* nanoid: 3.1.25 → 3.3.1
  * https://github.com/advisories/GHSA-qrpm-p2h7-hrv2
* node-fetch: 2.6.1 → 2.6.7
  * https://github.com/advisories/GHSA-r683-j2x4-v87g

Additional changes:
* Set `name` in package.json.

Change-Id: Ib0f4642ab65e3e04ee6e324a84486accb107f564
2022-05-21 01:38:38 +00:00
Ed Sanders 80336b322a build: Update devDependencies
Change-Id: Ia0f3481cb4e153338ef68c1d44951d897ddc7195
2022-03-13 22:56:14 +00:00
Željko Filipin 3d72bc7fc4 selenium: Remove wdio-video-reporter npm package
The repository uses video recording from wdio-mediawiki package.

Bug: T294341
Change-Id: I2a353b8443d1e5b1b4da8e21952ab882de2b89ae
2021-10-26 14:59:55 +02:00
libraryupgrader 6c842629d9 build: Updating npm dependencies
* @wdio/mocha-framework: 7.4.6 → 7.13.2
  * https://npmjs.com/advisories/5197 (CVE-2021-3807)
* ansi-regex: 5.0.0 → 5.0.1
  * https://npmjs.com/advisories/5197 (CVE-2021-3807)

Additional changes:
* composer.json: Updated phpcs command in composer test (T280592).
* composer.json: Added phpcs command to scripts (T280592).

Change-Id: Ie856dccce0f190788f394f0fd22d3fcddacddb87
2021-10-04 15:31:26 +00:00
libraryupgrader 71013b19ec build: Updating stylelint-config-wikimedia to 0.11.1
Change-Id: Ia9c3cbbff62e2363396741ec5655c0673e06c5cb
2021-09-04 19:10:40 +00:00
sahil daeaae012c selenium: Update wdio-mediawiki
wdio-mediawiki v1.1.1:
- Includes wdio-defaults.conf.js file that vastly simplifies wdio.conf.js.
- Replaces @wdio/spec-reporter with @wdio/dot-reporter.
- Introduces video recording.

Bug: T283597
Change-Id: I88096682276de901e9a9f0d406b7b2e5ca2d8875
2021-06-21 19:36:43 +05:30
sahil f1221d00ec selenium: Upgrade WebdriverIO to v7
Update npm packages: @wdio/* and webdriverio.

Bug: T274579
Change-Id: I6a154ffa5d00f86aa0718aacf5593259568f250d
2021-06-09 00:26:50 +05:30
libraryupgrader b076da0749 build: Updating npm dependencies
* grunt: 1.3.0 → 1.4.0
* hosted-git-info: 2.7.1 → 3.0.8
  * https://npmjs.com/advisories/1677 (CVE-2021-23362)

Change-Id: I8ab7ee85fb9af5504db5f4c6bbb91eb70f79492c
2021-05-09 06:02:25 +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
libraryupgrader 6e6356ccc0 build: Updating eslint-config-wikimedia to 0.20.0
Change-Id: I2ba141a980f111088c29a2730b23d7d6695513a6
2021-04-16 06:19:03 +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
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
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
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
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 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
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
Ed Sanders 2518861bc1 build: Update devDependencies
Change-Id: I2f2967a1525c6a66eba2f5fc225e74b89380c5dd
2020-06-12 22:51:38 +01:00
libraryupgrader 32f0200ad4 build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 29.0.0 → 30.0.0

npm:
* eslint-config-wikimedia: 0.15.0 → 0.15.3
  The following rules are failing and were disabled:
  * mediawiki/class-doc

* grunt-stylelint: 0.14.0 → 0.15.0
* stylelint-config-wikimedia: 0.9.0 → 0.10.1

Change-Id: Ib86ef0f1d74240a618b5694c2c749d63184d2956
2020-04-22 06:41:41 +00:00
libraryupgrader cf387d01e3 build: Updating grunt-banana-checker to 0.9.0
Change-Id: Iec901e0732834e33485de78d48ac49a5865d404c
2020-04-19 02:15:36 +00:00
libraryupgrader 2ea69d71ef build: Updating npm dependencies
* minimist: 0.0.8 → 1.2.5
  * https://npmjs.com/advisories/1179
* acorn: 7.1.1 → 7.1.1
  * https://npmjs.com/advisories/1488

Change-Id: I11461afeb50075494f9817203d4d41c079ec7a15
2020-03-18 05:13:57 +00:00
libraryupgrader 652c4585bd build: Updating npm dependencies
* grunt-stylelint: 0.13.0 → 0.14.0
* stylelint-config-wikimedia: 0.8.0 → 0.9.0

Change-Id: I21145215c3523a9b5923aa2a9b752f91b30a4dbc
2020-02-20 20:23:19 +00:00
libraryupgrader 8f250df41c build: Updating npm dependencies
* stylelint-config-wikimedia: 0.7.0 → 0.8.0
* grunt-stylelint: 0.12.0 → 0.13.0

Additional changes:
* Added .eslintcache to .gitignore.

Change-Id: Ie6e0ba151bb44cfbafe60e012d84f2c9ac9d3654
2020-01-09 04:54:00 +00:00