Commit graph

18 commits

Author SHA1 Message Date
MusikAnimal d1863e4d0b tests: disable flaky CM5 bracket matching test for 2017 editor
This legacy CM5 test has always been flaky and is now consistently
failing. It can be reinstated with T357482, or not at all, seeing as
bracket matching is a core extension in CodeMirror 6 and probably
doesn't need a dedicated test on top of what's upstream.

Change-Id: I77362c1c47be902cc888682aae926154470f1a56
2024-03-19 22:47:23 -04:00
MusikAnimal d927b01ec1 CodeMirror: fix implementation of jQuery.textSelection encapsulate
In Idc0abb64eb we added support for 'encapsulateSelection' and multiple
cursors, but broke other jQuery.textSelection functionality in the
process. In this commit, we move the logic to a dedicated class, and
more fully and accurately mimic the native implementation.

All functionality in WikiEditor should now be supported.

Bug: T359671
Follow-Up: Idc0abb64eb036fa4a60382aca401d1dba1722405
Change-Id: I9b947d80616bd4c4372b981b2271a281d1fc0252
2024-03-11 17:38:20 -04: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
MusikAnimal 26d5023bb7 CodeMirror: partially implement $.textSelection 'encapsulateSelection'
Popular extensions like Charinsert use this method to wrap text around a
selection. This patch adds support for multiple selections in CM6.

Some options to encapsulateSelection do not yet have explicit support
here, such as 'peri', but it's unclear if they are truly needed.

Bug: T211205
Change-Id: Idc0abb64eb036fa4a60382aca401d1dba1722405
2024-02-16 04:42:14 +00: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 361741ec86 CodeMirrorWikiEditor: sync with textarea when using CodeMirror toggle
This was working before somehow… but according to the CodeMirror docs,
it never syncs with the textarea automatically, so regardless this is
a necessary safeguard at least.

Repro steps:
1) Have CodeMirror turned on
2) Open a page for editing
3) Add content
4) Toggle CodeMirror off

With this patch, it should now always be synced.

Also add selenium test to ensure this doesn't break again.

Bug: T317243
Change-Id: Ie44e62fe5838bf32f40c6a3595ec3f541380cfe1
2023-10-21 00:42:22 +00:00
MusikAnimal d1cb5a0d01 CodeMirror: fix scrollToCaretPosition $.textSelection implementation
Add selenium tests for textSelection API.

Bug: T317243
Change-Id: I0904a715698aa235fb0744cbc4ff0f9787387592
2023-10-11 01:25:10 -04:00
WMDE-Fisch 4bb409887d selenium: run tests concurrently
Includes a bit untangling of the setup. Concurrent tests should not
overwrite each others user settings so one of the tests gets it's
own user.

Bug: T337862
Change-Id: Iae245063932d4c5d9e6b61c1fe102505d70c1039
2023-06-30 11:29:32 +02: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
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
Adam Wight 9f34c4d220 Remove $wgCodeMirrorEnableBracketMatching feature flag
Bug: T307188
Change-Id: Ibb21dea29c87d8fac898506c19f329273348c190
2022-06-13 10:34:41 +02:00
Thiemo Kreuz be08e04309 Reduce noise in syntax highlighting tests
* What we care about is the <pre>. The class="CodeMirror-line" is
  added to every <pre>. We don't really learn anything new when we
  include it in our tests.
* Testing the ARIA role is testing a CodeMirror feature, not a
  feature of the mediawiki mode under test.

Change-Id: I33bfedb304228240c4e835cc983117668c398c61
2021-12-16 06:53:47 +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 1b35a907d9 selenium: Update README.md file
Bug: T282237
Change-Id: I790cb97f0c6b274ff881c87b48a5693538538e14
2021-05-24 18:10:43 +00:00
WMDE-Fisch 9bea2a7905 Refine bracket matching styling
Adds a custom class for matched brackets to allow better integration
with custom bracket styles. The brackets won't be bold in the 2017WTE.
Bold font might lead to misalignment there. See ticket.

Note: box-shadow seems to be supported for quite some time by all
relevant browsers

Bug: T270926
Change-Id: Ica1e301f63a106a96db3bfaba4b2f322af64b009
2021-03-08 09:26:07 +01: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 27f964e240 Browser tests for CodeMirror (wikitext 2017 editor)
Bug: T270240
Change-Id: If1a2530e428122713277fbe87cd015cb729ab550
Depends-On: I2ba889e1a5dd03549d8d7cb00678a30882ff03fe
2021-01-11 12:47:49 +01: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