Commit graph

25 commits

Author SHA1 Message Date
Reedy 386bb03b01 Namespace extension
Change-Id: I83913927e86d44726d3a1c3a682cc1f6e2372f07
2022-02-06 15:16:42 +00:00
vladshapik 60b14d1aa0 Avoid using User::getOption() method
Replace User::getOption() with UserOptionsLookup::getOption() since this method will be hard-deprecated.

Bug: T296083
Change-Id: I405251092fd94fa70a33319d313c5140c8cebc21
2021-11-30 09:12:09 +00:00
MusikAnimal f7ef01b412 Set default for 'usecodemirror' preference
This preferably would be set to on by default so that the extension
works out of the box, but it causes tests to fail in Core (T286623).

Despite the previous state of CodeMirrorHooks::onGetPreferences(),
CodeMirror was never on by default anyway.

Bug: T286270
Change-Id: Ic702b868b55aaa8ab71ddedd289c25f36b34b112
2021-07-20 23:25:12 -04:00
Adam Wight ed2f9944ea Enable line numbering only on configured namespaces
Introduces a new config variable `CodeMirrorLineNumberingNamespaces`
that can restrict line numbering to only appear for specified
namespaces.  Setting to null enables everywhere.

This takes some liberties with the `lib` module, turning it into a
container for shared functionality.  This can be pursued in later
work, by cleaning up duplicated code in this repo.

FIXME: failed to deduplicate the code for now.

Bug: T267911
Change-Id: Ida2b33eef38edc57d29756ec472c6f2c83bd7b11
2021-04-12 12:05:14 +02:00
Andrew Kostka aaf67a9c0b Update color scheme to meet accessibility standards
These changes to the color scheme are hidden behind a feature
flag for the time being.

Bug: T271895
Change-Id: I0a4b03e0f3bc8239f31edbbd5ae55661607b76f6
2021-03-05 16:39:14 +01:00
Adam Wight 88fd6a4e28 Provide cookie workaround for setting the feature flag
This is a convenient way to propagate alternate configuration during
browser testing.

Bug: T270240
Change-Id: Ica6399c53499be7f930e8d13b838ad265b66cdf4
2021-01-04 16:09:11 +01:00
Adam Wight d8f4982e79 Added bracket matching
* using CodeMirror addon matchBrackets
* highlights the matching bracket of a pair
* highlights brackets when cursor is inside a pair
* feature usable in source code editor

Bug: T261857
Change-Id: Ib01d9919a47bb29684b54501644b01936b57972a
2020-12-15 13:09:06 +00:00
James D. Forrester 85e56bb200 Use QUnitTestModule instead of deprecated ResourceLoaderTestModules
Bug: T232875
Change-Id: I84276ff7c30b9c1db5dd8e9532512d7f586ab401
2020-05-11 20:19:57 +00:00
Fomafix b17c8b7557 Move check for 'usebetatoolbar' from JS to PHP
This change avoids useless loading of the module 'ext.CodeMirror'.

Change-Id: I2637487b72c028d272748f2891239401412f77b5
2020-02-23 20:50:17 +00:00
Derick Alangi 4b17eb952c Type hint &$defaultPreferences & clean onResourceLoaderTestModules
* Per https://www.mediawiki.org/wiki/Manual:Hooks/GetPreferences, it is
  strict on $preferences being an array, so type hinted it to conform.

* Remove legacy hook behavior for onResourceLoaderTestModules() hook in
  CodeMirrorHooks. See: https://w.wiki/3Az for more information. Also,
  added `@see` with link to the documentation of the hook used.

Change-Id: I0a2fac4b4d491abf8d2f661be32bf2e0d791c90b
2019-05-07 15:44:14 +01:00
Derick Alangi 5579001506 CodeMirrorHooks: Objects are passed by default as references
Documentation here: [[mw:Manual:Hooks/BeforePageDisplay]] also
says so about objects passed by defaults as references, no need
for the &.

Also, fixed onResourceLoaderTestModules() function header for the
$rl parameter, removed the & symbol and updated this hook's docs
here: [[mw:Manual:Hooks/ResourceLoaderTestModules]].

Change-Id: Ifdabc47a1a4f02aec4906edb800d360ca4febd76
2019-04-04 00:38:24 +01:00
Derick Alangi 3359cbde31 CodeMirrorHooks: Remove wgCodeMirrorEnabled set in mw.config JS
This was used for backward compatibility after beta support was removed
by MaxSem in I1ad451acfd163c783e7b (T185030). As a todo, this backcompat
was planned to be removed in 2019 :).

Bug: T219342
Change-Id: I35c77add8b4815a26b1bea2df90eaeae05a9a9f7
2019-04-02 23:44:02 +01:00
jenkins-bot fc4d4b0c36 Merge "Do not load module 'ext.CodeMirror' when CodeEditor is active" 2019-03-20 21:31:03 +00:00
Fomafix f0757cb0dc Do not load module 'ext.CodeMirror' when CodeEditor is active
Change-Id: I8fd0de727f2ebb1bf9f23981438d6cafa962ad17
2019-03-20 21:01:35 +00:00
Derk-Jan Hartman 758523b65f Conditionally load CodeMirror lib
Also remove two unneeded dependencies

Bug: T209824
Change-Id: I5b528bde346780ca5ae5d615c4ca0d617a6cd615
2019-03-14 23:31:18 +00:00
Umherirrender 7cd71f47a7 Remove @staticvar doc annotation
It is unknown to doxygen

Change-Id: I60e98eb3a7e74796e877fd70e8b9b67b5e3b60df
2018-09-09 20:04:35 +02:00
Kunal Mehta 35edfa6018 Use new Parser accessors
And there's no need to manually call firstCallInit() anymore, the
Parser will call it in all the necessary places automatically.

Depends-On: Ida62767f3ca53f99609cae01d3a20051bb92ccab
Depends-On: Ia2d98baf6caed2cd779cb00aceba5785cf13d633
Change-Id: I7e2097fa733506985a4b252fc9b01b03f6c28885
2018-08-13 22:56:03 -07:00
Kunal Mehta 0ba594b8ad Don't use deprecated MagicWord methods
Change-Id: I992b966f25cea52002cb8ee91f94dd92ff8c717f
2018-08-12 21:44:24 -07:00
Fomafix 9bda90be76 Get Parser from service instead of global $wgParser
Also always call firstCallInit() which already calls
initialiseVariables().

Change-Id: I55808175c18430a0021e115b27c672635a62669b
2018-08-12 10:34:00 +02:00
Fomafix ca7f33f8ef Use ContentLanguage service instead of global $wgContLang
Depends-On: I193f5b9a95430b0a05573c361715e053e5411e32
Change-Id: I2b6b2392c5be923657cd508459662ba643b21362
2018-08-05 00:33:03 +02:00
Max Semenik 63647bb5dc Remove all BetaFeatures support
Bug: T185030
Change-Id: I1ad451acfd163c783e7b8ec604d8695c14342667
2018-06-13 16:42:40 -07:00
James D. Forrester 780fe9cb9f Beta Feature: Flag as requiring JavaScript
Bug: T194528
Change-Id: Ic37fec8a167fe0c7a12ff52634824dd2585a9e80
2018-05-11 19:51:14 +00:00
Ed Sanders d4d92f921f Never load ext.CodeMirror on RTL pages
This does not affect the VE integration, which
does support RTL.

Bug: T191923
Change-Id: I817498157bcc3ff0b92d1ee0e9cf9fc96be83d2f
2018-04-19 16:01:57 +00:00
MusikAnimal 4d2783eb3e Tests for MediaWiki CodeMirror syntax highlighting
Bug: T169592
Change-Id: I0750d3a320af5451f847e6062f82523fb18f12bc
2018-03-20 16:27:55 -04:00
Kunal Mehta f7e5949334 Move classes into includes/
Depends-On: Idbcb76f54eb57b0a56b46188526858038d698627
Change-Id: I2858e848137336aeabb18513f073bfccf64c0a6b
2018-02-10 09:27:42 +00:00