Commit graph

961 commits

Author SHA1 Message Date
jenkins-bot 89563724b0 Merge "Bump Node dependencies and fix deprecations and linting failures" 2023-12-08 12:16:45 +00:00
thiemowmde 1e845daedc Expand test case for {{!}} in the table syntax
The test case was super minimal, without any actual table cells.

Bug: T292967
Change-Id: I4d86a369b69d12ed0f4967e0e1edd00f886fcb1e
2023-12-07 11:33:40 +01: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
jenkins-bot 64e7054717 Merge "Don't detect additional { as part of the template name" 2023-12-06 05:26:20 +00:00
jenkins-bot 3b4975f888 Merge "Much more robust detection of template {{{variables}}}" 2023-12-06 05:25:51 +00:00
jenkins-bot 958220dc6a Merge "Add test cases for certain combinations of wikitext features" 2023-12-06 05:06:20 +00:00
gerritbot 1ead9c4b79 Update UserOptionsLookup's FQN
User-options related classes are being moved to the MediaWiki\User\Options namespace in MediaWiki Core; reflect that change here.

Bug: T352284
Depends-On: I9822eb1553870b876d0b8a927e4e86c27d83bd52
Change-Id: Ib0022571e750becc87c56adcb2d5bdb203b6254d
2023-11-29 12:38:30 +00:00
MusikAnimal 1b8539f2c2 config: remove DotsSyntaxHighlighter as conflicting gadget
Some users actually use CodeMirror and DotsSyntaxHighlighter, and
according to them and my own testing, there is no actual conflict. As
such, we shouldn't prevent CodeMirror from loading when this gadget is
enabled.

See https://w.wiki/8J4J

Follow-Up: If6c953858f9cf73024959b5a3b71b33ab7b48b4c
Change-Id: I259737d27cc3190fbdc335da2ccd471fcc0cff8b
2023-11-27 17:17:46 -05:00
thiemowmde 4c92345e6f Don't detect additional { as part of the template name
It's impossible to have a template that has the character { as part
of the name. The real-world example explained in T292967 is the
sequence {{{!}}. The old code detected this as:
* A template that starts with {{
* The template name is {!
* Template ends with }}

New behavior as proposed in this patch:
* A single { with no special meaning
* The parser function {{!}}

Note this is only a very small improvement, but doesn't fully solve
T292967.

Bug: T292967
Change-Id: Ica3fb110cebb5650f66be321b533ed030e2c9698
2023-11-21 12:47:15 +01:00
thiemowmde aa391c1c77 Much more robust detection of template {{{variables}}}
Variables like {{{foo}}} with 3 brackets typically only appear in
templates. But odd combinations of other features that also start
with 3 brackets are much more common. These should not be detected
as variables.

1. When something starts with 4 or more brackets it's not a variable
but something else. E.g. the start of a template where the template
name is a variable (2 + 3 = 5 brackets).

2. Tables can start with {{{!}}.

Note this doesn't fully solve T292967 but already improves the
situation a lot.

Bug: T108450
Bug: T292967
Change-Id: Id5e50c2bafb35a211d4b63609126c40b32f06a64
2023-11-21 12:30:13 +01:00
thiemowmde 8274034243 Add test cases for certain combinations of wikitext features
Document the status quo. This is relevant for the next two patches.

Change-Id: I7907b4743b4dec60c6523dfcc210d947926161be
2023-11-21 12:27:55 +01:00
Translation updater bot 59d83e4c9c Localisation updates from https://translatewiki.net.
Change-Id: I7c3e32d463db80e6b0a81ab00289ce0d339e0f8d
2023-11-13 08:40:33 +01:00
Ed Sanders 329235c417 Document generated message keys
Change-Id: Ie6f7dbea0726ec711fa5f23c1779b999107c7612
2023-11-02 18:46:56 +00:00
Translation updater bot 4fcc732610 Localisation updates from https://translatewiki.net.
Change-Id: I026dd80f0b248f6a4ca6c5402efe7c22daee30fe
2023-10-27 09:19:41 +02:00
Volker E c7662a4e74 docs: Remove reference to WikimediaUI Base
And replace with Codex color label, see
https://doc.wikimedia.org/codex/latest/style-guide/colors.html

Bug: T334934
Change-Id: Ia99eae4e09b2b5e622a9b0d316b03006e0ef94ed
2023-10-25 20:06:42 -07:00
MusikAnimal 314bd6d8c4 CodeMirrorWikiEditor: scroll selection into view on inital load
Without the scrollIntoView option set, CodeMirror will always scroll
to the bottom.

See:
https://codemirror.net/docs/ref/#state.TransactionSpec.scrollIntoView

Bug: T317243
Change-Id: I3174685cd3508abf8074eb47e8f2bf81bd303916
2023-10-20 20:47:13 -04: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 65b864588b Enable support for RTL when using CodeMirror 6
Refactor common contentAttributes Facet into a default Extension

Bug: T170001
Change-Id: I648bac617b5939c1fc4e115144e55a5cb77d6d66
2023-10-17 20:33:01 -04:00
Fomafix 6a37fedf73 Use $this->getServiceContainer() in tests and update class names
Consistently use
	$this->getServiceContainer()
instead of
	MediaWikiServices::getInstance()
in tests.

Also use namespaced classes
* MediaWiki\Output\OutputPage instead of OutputPage and
* MediaWiki\User\User instead of User.

Change-Id: I0cc39ba6cc706bf01581687e440ef9fb4ad39d81
2023-10-11 20:11:49 +00:00
MusikAnimal c0b01008a4 Add $wgCodeMirrorConflictingGadgets instead of checking wikEd directly
Since wikEd and DotsSyntaxHighlighter are both popular gadgets in and
outside WMF wikis, they are included in this setting by default.

Change-Id: If6c953858f9cf73024959b5a3b71b33ab7b48b4c
2023-10-11 01:33:35 -04: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
MusikAnimal 06829a5a0a CodeMirrorWikiEditor: add missing hook and fix reference to textarea
This fixes integration with some consumers of the
'ext.CodeMirror.switch' hook, such as Extension:Disambiguator.
The jQuery element passed to the hook is around the CodeMirror DOM
element which has the jQuery.textSelection() API registered to it.

Bug: T317243
Follow-Up: I2239d2449b2db3b638551f847eb4eff1aafa6276
Change-Id: Iec368613da3c69df52ce5e7ca441c31172cdc5de
2023-10-10 16:11:18 -04:00
jenkins-bot 39ed5a05fc Merge "CodeMirror6: add new modules, feature flag, and URL query parameter" 2023-10-10 08:49:11 +00: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
jenkins-bot 35647af3f1 Merge "Use white-space: break-spaces" 2023-10-05 14:47:57 +00:00
Ed Sanders 1c853da980 Use white-space: break-spaces
Bug: T347902
Bug: T348006
Change-Id: I62cb4c4f55a9ed80c043c4a1c27dd276559b1cba
2023-10-05 14:30:54 +00:00
Fomafix b6c3eca38b Use namespaced classes
Change-Id: I2d9f6a9a8b7e0812a0a758455219aef826a0ffa5
2023-10-03 09:18:59 +00:00
jenkins-bot 1a19f48c70 Merge "[build] Bump wdio-mediawiki to v2.3.0" 2023-09-22 18:22:04 +00:00
WMDE-Fisch e6852a47f8 [build] Bump wdio-mediawiki to v2.3.0
Change-Id: I87225bc7cb311b6bbeb57f56e9ed4715f4958f76
2023-09-22 16:01:38 +00:00
James D. Forrester 764ff6478d resources: Manage upstream CodeMirror using ManageForeignResources
Depends-On: Ica6a80d6eb127cc10a00d3d6d0890ad724762ff2
Change-Id: I15721ef93c270a5a2f9194d678cd6876e14c7ea6
2023-09-21 12:40:53 +01:00
David Lynch e9e6361610 Update embedded CodeMirror library to 5.65.15
Was at 5.58.3

Bug: T334994
Change-Id: I74e792a5952973240a111180dde9f5097b48c278
2023-09-20 09:17:03 -05:00
jenkins-bot 4eed68bb4e Merge "build: Update linters" 2023-09-18 17:37:46 +00:00
Ed Sanders 21c121b898 build: Update linters
Change-Id: I49eb2de402a8c89065968cf927a2ca6a361ca684
2023-09-13 14:02:43 +01:00
Ed Sanders d0fe4c0673 Grunt: Use conf.MessagesDirs for banana
Change-Id: I50716a121eff72562a4ba2dd8ea499345da8a997
2023-09-12 18:19:53 +01:00
Translation updater bot 8e5e2170c3 Localisation updates from https://translatewiki.net.
Change-Id: I0ddca034e25562f029baf532a3b6f7b3634a4122
2023-09-12 08:26:32 +02:00
jenkins-bot 406d23f6de Merge "build: Update MediaWiki requirement to 1.41" 2023-08-31 05:34:02 +00:00
Translation updater bot 36b9492ced Localisation updates from https://translatewiki.net.
Change-Id: Ia33b3c9b598b181424e9b7385efa735cb997390c
2023-08-29 08:27:59 +02:00
jenkins-bot 2738060873 Merge "Convert applicable ResourceLoader modules to use packageFiles" 2023-08-24 22:21:10 +00:00
MusikAnimal 46b7208d13 Convert applicable ResourceLoader modules to use packageFiles
Move WikiEditor-specific code to ext.CodeMirror.WikiEditor, leaivng only
CodeMirror-specific things in ext.CodeMirror, including the logUsage
method which was duplicated in the VE plugin and now refactored.

Add .env to .gitignore so that selenium tests can be ran more easily

This patch leaves the other non-mediawiki modes still using the
'scripts' system instead of 'packageFiles'. These are not used in
MediaWiki directly but by some extensions (i.e. PhpTags) and using
packageFiles will break that integration.

Bug: T272035
Change-Id: I3bafef196c1f713443d7b8e9cb7dc2891b379f5d
2023-08-24 11:55:13 -04:00
gerritbot e1fb56e38e Replace some moved Title class uses, now MediaWiki\Title\Title
Bug: T321681
Change-Id: I4ac93c24d2c90d51532fc3c39e60efbb4f8f8bfb
2023-08-19 13:12:12 +00:00
James D. Forrester 2e46dcf630 build: Update MediaWiki requirement to 1.41
All extensions in Wikimedia production are expected to track MediaWiki's release directly.

Change-Id: I1898175817b67e3255376e4817ffca3d4a739d62
2023-08-19 13:10:57 +08:00
WMDE-Fisch 7a49382bdf Add Database group to tests
Tests that create a user account actually use the database and
most be marked as such or they will thow an exception.

See Ic4a72fbfaee730b8417848ae0603443d4995fefc

Change-Id: I827b536006130c9813a2a079eab01be112e691be
2023-08-09 10:51:58 +02:00
Sam Wilson 7d48f2d8bb Use editRecovery.loadEnd JS hook to add change handler
Add core's change handler for CodeMirror changes as well, to
save in-progress edit data.

Depends-On: I32c13c1eeec55dc442b0a00ede9cb74422b0307e
Bug: T342882
Change-Id: I352470752130c7b9b2dfc55a066cecf785d40067
2023-07-31 10:44:08 +08:00
Translation updater bot 1cff0e3f3e Localisation updates from https://translatewiki.net.
Change-Id: Ied0dc3d61d547e35b56f0d67d9f54d58361d8e1f
2023-07-24 09:36:52 +02:00
Translation updater bot c0efed8f61 Localisation updates from https://translatewiki.net.
Change-Id: I44184dd189129b86a7047bd326c530c4be493c40
2023-07-10 09:37:14 +02:00
Func a19cd9b94a ve.ui: Set the CM wrapper to the appropriate language
Bug: T341342
Change-Id: Ibdac3d360527429e396b0c124b57d1531b959a76
2023-07-07 20:54:00 +08:00
Translation updater bot 87ef023efd Localisation updates from https://translatewiki.net.
Change-Id: Ie9a76b8c035681721e6e47b1ddc0e3d6d87583eb
2023-07-06 10:11:29 +02:00
jenkins-bot c82ea859c3 Merge "selenium: run tests concurrently" 2023-06-30 11:39:21 +00: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
Ed Sanders 9520546e09 Add tool to VE toolbar automatically using 'utility' group
This removes the need for the init module.

Bug: T340751
Depends-On: Ibcc81c90bc9ba6c5fd012c512daf861973b03b2e
Change-Id: Iec3a4c6b00288aee376af47e778c4aa67a98d29b
2023-06-29 14:40:43 +00:00