Commit graph

1024 commits

Author SHA1 Message Date
Translation updater bot 9b01891916 Localisation updates from https://translatewiki.net.
Change-Id: Ibe1f917f664fb1f6adfda1b689a110771867b55e
2024-03-12 08:24:09 +01:00
jenkins-bot 7fa0883811 Merge "styles: Replace error color with #d73333" 2024-03-11 23:15:44 +00:00
MusikAnimal 894d2c33e9 Hooks: further limit where CodeMirror RL modules are loaded
This fixes a preexisting issue where we were loading CodeMirror on pages
where it would never be used. We use the EditPage__showEditForm_initial
hook so we don't need to check the action.

This commit introduces the CodeMirrorContentModels extension attribute,
used to limit where CodeMirror is loaded automatically. By default,
this includes only CONTENT_MODEL_WIKITEXT ('wikitext'). This extension
attribute serves as a stepping stone to CM being used on content types
other than just wikitext.

Bug: T359206
Change-Id: Ibefc028c5ef6275393202fe773c26162715e1bca
2024-03-11 17:30:10 -04:00
Volker E 0e0e55e143 styles: Replace error color with #d73333
This patch promotes a consistent design decision across projects in
MediaWiki core, extensions, and skins. The darker red color meets the
W3C Web Content Accessibility Guidelines (WCAG) at Level AA that text
or images of text must have a contrast ratio of at least 4.5:1.

Bug: T343239
Change-Id: Id66e6636e2237ae956d3c0e4821e862f875a6e30
2024-03-11 22:03:30 +01:00
Translation updater bot e578597263 Localisation updates from https://translatewiki.net.
Change-Id: I3130f67228f31701a7fa1e193566647e9fe520ad
2024-03-11 08:26:33 +01:00
jenkins-bot 829ad8e79f Merge "Use namespaces class MediaWiki\Context\RequestContext" 2024-03-08 20:26:44 +00:00
Translation updater bot 9696056dfe Localisation updates from https://translatewiki.net.
Change-Id: Iab371c59161a0f585d71cffe9232692152699098
2024-03-08 08:22:43 +01:00
jenkins-bot 985f2991e5 Merge "CodeMirror 6 template folding" 2024-03-08 02:38:43 +00:00
Fomafix f706c0dc99 Use namespaces class MediaWiki\Context\RequestContext
This change depends on I4dbef138fd0110c14c70214282519189d70c94fb
included in MediaWiki 1.42.

Change-Id: I37b5bbe06dfb99b5ff819188a1b76ad6c669ecda
2024-03-07 20:05:27 +00:00
jenkins-bot 210f78aa90 Merge "Avoid wgTitle in tests" 2024-03-07 19:21:51 +00:00
Translation updater bot dda2606d3a Localisation updates from https://translatewiki.net.
Change-Id: I17b34d8855bfe7930a6e0c9a8d9e6910c22c020c
2024-03-07 08:48:12 +01: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
jenkins-bot 4c01432da8 Merge "CodeMirrorModeMediaWikiConfig: add missing tokens for nested templates" 2024-03-07 04:23:56 +00:00
gerritbot 1a906e41ad styles: Update color in Less from #d33 to #d73333
This patch promotes a consistent design decision across projects in
MediaWiki core, extensions, and skins. The darker red color meets the
W3C Web Content Accessibility Guidelines (WCAG) at Level AA that text
or images of text must have a contrast ratio of at least 4.5:1 (or 3:1
for large text).

Bug: T343239
Change-Id: I1c3a7a91e28a8fe9695531cdfd7be6807d7c8999
2024-03-06 22:48:56 +00:00
Fomafix b4b1004499 Avoid wgTitle in tests
Change-Id: I1323b9b9542598d33f7150cc0d468e581b0d8c09
2024-03-06 15:59:33 +00:00
MusikAnimal 321d462311 CodeMirrorModeMediaWikiConfig: add missing tokens for nested templates
Nested templates have background shading relative to their level of
nesting. See the newly added test case as an example. Without these
tokens registered, the styling won't show properly.

Since these tokens aren't referenced directly by the StreamParser, nor
do they have a parent Tag, we don't need them as constants like we do
for other tokens.

Bug: T348019
Change-Id: I87bb99d538344957987b2bd88f902a1427a36522
2024-03-05 00:34:34 -05:00
MusikAnimal 7002bc434d CM6: use textarea height unless WikiEditor's Realtime Preview is loaded
The ResizingDragBar makes the editor resizable, so we need to set the
CodeMirror height to 100%. This only happens when the Realtime Preview
module is loaded.

This fixes a critical issue introduced by I4deeda192b that caused blank
renderings when scrolling large documents.

Bug: T357794
Follow-Up: I4deeda192bdc233101ba61739a636f8fd143c1de
Change-Id: Ib49d1d9e71df3653b13dfd44a8efedbf1ef9cd93
2024-03-04 17:41:04 -05:00
Fomafix c3df98cff6 Remove $this->setService( 'UserOptionsLookup', ... ) in tests
The mocked service UserOptionsLookup is already injected via contructor
to Hooks.

Change-Id: I013aa6f62bd50802889a0037721ba06902d1a18e
2024-03-04 20:04:02 +00:00
Translation updater bot 6b3c480f02 Localisation updates from https://translatewiki.net.
Change-Id: Ib2ea3432f11878c67facd2d430478e5469632607
2024-03-04 08:23:06 +01:00
jenkins-bot 21a6adca11 Merge "fix scroll behavior of CodeMirror 6" 2024-03-01 19:25:00 +00:00
Translation updater bot 2f4917dfd7 Localisation updates from https://translatewiki.net.
Change-Id: I15076c6940e5def9f1663e7000ec65a538846f56
2024-03-01 08:32:46 +01: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 c9c9ed27d3 CodeMirror: default to using the same height as the textarea
CodeMirrorWikiEditor: add a 'ext.CodeMirror.initialize' hook to allow
integrations to manipulate the DOM before CodeMirror is initialized.

This is necessary for ProofreadPage, for example (I5c0824bf38cf7).

Bug: T357794
Change-Id: I4deeda192bdc233101ba61739a636f8fd143c1de
2024-02-26 14:22:33 -05:00
jenkins-bot 5bfb8dddad Merge "CodeMirror: sync text editor font preference" 2024-02-26 09:08:14 +00:00
Translation updater bot 734f9a386b Localisation updates from https://translatewiki.net.
Change-Id: I64825d7fd6613a52ec05cca28c65cd8c9d8701df
2024-02-26 08:35:40 +01:00
MusikAnimal 657ba3648a CodeMirror: sync text editor font preference
This only effects users of the CM6 CodeMirror class, so doesn't (yet)
solve the issue for the 2017 editor which is partly what T245568 is for.

I135bf0f7bf supposedly fixed it for the 2010 editor, but that fix
apparently doesn't work anymore, and thus those styles have simply been
removed (the .CodeMirror element is never a child of the edit font
classes).

This change also incidentally fixes font sizing issues by ensuring the
styles are applied to `.cm-content` and not `.cm-editor`. This prior bug
was most notably visible in other skins such as Timeless and Monobook.
The colorblind CSS class is now applied in the same way using the
EditorView.contrentAttributes facet.

Bug: T245568
Change-Id: Iaaf65e47ce8ed9303147aadc7e18a9aaa051405b
2024-02-25 23:08:38 -05:00
jenkins-bot 0b7916bc59 Merge "CodeMirror: partially implement $.textSelection 'encapsulateSelection'" 2024-02-26 04:02:30 +00:00
Translation updater bot 2696e69570 Localisation updates from https://translatewiki.net.
Change-Id: I44dbf8cd5420e6eff38c6bcba24451e0c70e597c
2024-02-20 08:38:14 +01:00
Translation updater bot 74d7847358 Localisation updates from https://translatewiki.net.
Change-Id: If4ec7835d8ee076f665c0e112d1e6d257dfb281f
2024-02-19 08:39:50 +01: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
jenkins-bot 113c179138 Merge "Localisation updates from https://translatewiki.net." 2024-02-15 13:40:58 +00:00
Translation updater bot 39783e901e Localisation updates from https://translatewiki.net.
Change-Id: Iefd780f09b6dac93a0b9bbba5f66ccddc4ebba1d
2024-02-15 13:27:47 +01:00
MusikAnimal 15215cb81f Utilize __non_webpack_require__ so we can source virtual files
This removes the need for a separate init module. Using
`__non_webpack_require__` will force Webpack to compile as `require`
instead of `__webpack_require__`, allowing ResourceLoader to inject the
virtual file.

Change-Id: I00203f4665b49cb92ee9db356445fdc2ab17fc5f
2024-02-14 08:47:21 -05: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
jenkins-bot ec28e18016 Merge "CodeMirror: load colorblind theme when preference is set" 2024-02-14 11:58:16 +00:00
jenkins-bot de95ad10d9 Merge "CodeMirror: highlight special characters and non-breaking spaces" 2024-02-14 10:59:00 +00:00
jenkins-bot be693cde3c Merge "CodeMirror 6: localize search dialog" 2024-02-14 10:24:17 +00:00
MusikAnimal 5fe4ab8d58 CodeMirror: load colorblind theme when preference is set
This is only done for wikitext, as the stylesheet only references
.cm-mw-* classes.

Change-Id: I15a82c7680a12fb10baff4a2e78626677536c291
2024-02-13 14:57:42 -05:00
MusikAnimal 75f5c9b2be CodeMirror: highlight special characters and non-breaking spaces
The highlightSpecialChars() should act mostly identical to CM5. An
example is the soft hyphen (U+00AD). These are highlighted as a red dot
because they are non-printable characters.

The i18n may seem like overkill, but CM6 would otherwise actually print
the same message in plain English and without a way to localize it.

Per request at T181677, we also highlight non-breaking space and the
narrow non-breaking space. These are shown as a faint gray dot, to match
CM6's highlightWhiteSpace() extension. That extension isn't used here
because it would also highlight normal spaces, which we don't want.

Bug: T181677
Change-Id: Iac1a8cf78e4cd0a27abc917f4b70bdfbaf86252a
2024-02-13 14:57:06 -05:00
MusikAnimal 5a07eb35db CodeMirror 6: localize search dialog
As of this patch, these should be the only messages used by us that live
in the CodeMirror library. More may be added later as new features
are added. We load all translations as a default CodeMirror extension
given the small cost and importance of localization.

German translations from the CodeMirror docs:
https://codemirror.net/examples/translate/

Also add a note in the README about the search dialog.

Bug: T317243
Change-Id: Iba40bcaf197ed48166ce4cdcc4f48177fc8d07f3
2024-02-13 14:56:23 -05:00
Translation updater bot 62f60d5a1f Localisation updates from https://translatewiki.net.
Change-Id: I28d92a5021097f21ba5b68f08cb525b3aa04fa5e
2024-02-12 14:49:09 +01: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
Translation updater bot 398200b2cd Localisation updates from https://translatewiki.net.
Change-Id: Ic0bbd40b440e91c86f7309527013f4e2c574b925
2024-02-08 09:14:46 +01:00
Taavi Väänänen 90254fb130
build: add /vendor to .eslintignore
Change-Id: Ib0a945fd722eefd28625d5666d3785052b7ecd82
2024-02-07 11:10:17 +02:00
bhsd 8a3d203a03 fix attributes of table caption and table cell
Merging `inTableCaptioin` method into `eatTableRow` with an additional parameter so that table caption attributes can be respected. This patch also distinguishes double pipes (`||`) which start a new table cell and single pipe (`|`) which ends the attributes.

Bug: T324374
Change-Id: If2d4600067c587fe0b6a6edb332fd4e55abec607
2024-01-19 10:53:51 +08:00
bhsd 5235dbb322 fix protocol-like words not as URL protocol
A valid URL, whether free or not, requires at least 1 character after the protocol.

Bug: T309880
Change-Id: I972c4f0ea4273a3f50db17376af808770f28df0b
2024-01-19 10:27:55 +08:00
jenkins-bot 84d88b1f4e Merge "improve treatment of lists at start of line" 2024-01-19 00:42:52 +00:00
bhsd b4e762bd99 improve treatment of lists at start of line
In the parser, '*', '#', ';' and ':' can actually become nested lists (<ul>, <ol>, <dt> and <dd>) in any possible combinations. This patch does not yet support the `; dt : dd` syntax.

This patch also fixes the 'Unknown highlighting tag undefined' warning.

Bug: T184272
Bug: T170042
Change-Id: I13cc55fadbc9b03fd7c70eab123f7e378d52898d
2024-01-19 00:36:54 +08:00
bhsd e0af18f99d fix heading style conflict with CM5
CSS classes such as `.cm-mw-section-3` are assigned to the `<pre>` elements in CM5 while to the `<span>` elements in CM6. The heading styles for CM6 should not interfere with CM5, at least for now.

Bug: T355290
Change-Id: I47426a8319e67503014f847fba39891bdf42db5b
2024-01-18 23:53:52 +08:00
Daimona Eaytoy 1a038072b4 Update tests for PHPUnit 9.6
- Avoid withConsecutive()

Bug: T342110
Change-Id: I32c7d465942c55608891165d79d22ae6e31a5aaf
2024-01-17 17:21:49 +01:00