Commit graph

96 commits

Author SHA1 Message Date
libraryupgrader d034df411d build: Updating jsdoc to 4.0.4
Change-Id: I67c82008faec77e191e8bc57f52dfafa0913accc
2024-12-02 00:52:19 +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
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
libraryupgrader ab9d06c7eb build: Updating rollup to 4.22.4
Change-Id: I1b340e39467f574abc5f1d3d3740aa2e81add198
2024-09-24 00:56:45 +00:00
libraryupgrader 3b6e74ded4 build: Updating path-to-regexp to 6.3.0
* https://github.com/advisories/GHSA-9wv6-86v2-598j

Change-Id: Ia251367fc7be5d1d2ba94e2b5e1808e5266bdb7a
2024-09-12 02:17:10 +00:00
MusikAnimal 9f9bd4640a Bump Node version to 18.20.4
Bug: T373937
Follow-Up: Ifc511ef5bd3be9a032a5c80d0b81b4f76afe1e40
Change-Id: I17c912cc5681b5e87f9470994a718910ab6c7242
2024-09-03 20:21:31 +00: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
libraryupgrader 09114d3d25 build: Updating micromatch to 4.0.8
* https://github.com/advisories/GHSA-952p-6rrq-rcjv

Change-Id: I7e224e1a9eb8b01b9b6938f19f4ff286aa00f692
2024-08-24 20:52:56 +00:00
libraryupgrader 4fd186c142 build: Updating mediawiki/mediawiki-codesniffer to 44.0.0
Change-Id: I8e4e1901da3f1bd416d7dc2c85fbaa5ac9fb20c0
2024-08-11 04:36:17 +00:00
Taavi Väänänen 7e0d3cf2fd
build: Upgrade stylelint-config-wikimedia to 0.17.2
And convert the disable statements to individual ones so LibUp can
automatically push the next upgrade.

Change-Id: Id5fbfb4ebf4641c7577a4e2be2ab8bae678227c7
2024-08-10 08:03:19 +03: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
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
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
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
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
libraryupgrader 31815d8036 build: Updating grunt-banana-checker to 0.13.0
Change-Id: Ieeb3108280f96193a45dd8e5c5472ee97a985388
2024-05-18 03:53:50 +00: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
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
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
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
libraryupgrader 3a6c805135 build: Updating follow-redirects to 1.15.6
* https://github.com/advisories/GHSA-cxjh-pqwp-8mfp

Change-Id: I21a0b0aee97783e57e3860276df6eab3850ac9b6
2024-03-15 00:44:16 +00: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
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
libraryupgrader 381a119559 build: Updating http-cache-semantics to 4.1.1
* https://github.com/advisories/GHSA-rc47-6667-2j5j

Change-Id: I414aadd53d2ec5228b77ccb70e97d934f2d50419
2023-02-02 23:45:16 +00:00
libraryupgrader 9f6de44d25 build: Updating ua-parser-js to 0.7.33
* https://github.com/advisories/GHSA-fhg7-m89q-25r3

Change-Id: Ib87b1e8e4a6835fa47f4330e518cd239f29183b3
2023-01-26 10:09:13 +00: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 baa0bde13c build: Updating qs to 6.5.3
* https://github.com/advisories/GHSA-hrpp-h998-j3pp

Change-Id: Iec46b8b599c47210777df445bc305a3246c35831
2022-12-07 01:14:39 +00: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 295387b470 build: Updating npm dependencies
* minimatch: 3.0.4 → 3.0.8
  * https://github.com/advisories/GHSA-f8q6-p94x-37v3
* recursive-readdir: 2.2.2 → 2.2.3
  * https://github.com/advisories/GHSA-f8q6-p94x-37v3

Change-Id: I1ec62eb6de90481f215b6272a555fe5e12885bb9
2022-10-26 01:28:36 +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 522ba49be2 build: Updating got to 11.8.5
* https://github.com/advisories/GHSA-pfrx-2q88-qq97

Change-Id: I90cfb8eaeb0266ae457c06e14cb2ae3cb82c1dcd
2022-06-22 05:41:29 +00:00
libraryupgrader ab9fa44e39 build: Updating grunt to 1.5.3
Change-Id: Ice96760213e0b100bfa38255f5330ea711c9d6d0
2022-05-26 09:01:24 +00:00