Commit graph

115 commits

Author SHA1 Message Date
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
Alexander Vorwerk 6bf535cffc Avoid using User::getOptionKinds()
User::getOptionKinds() is deprecated and should be replaced with UserOptionsManager::getOptionKinds()

Bug: T277600
Change-Id: Ie30ae74839f91aa48c53a5ebf680adb21eb9b047
2021-05-03 11:39:48 +00: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 5956c74773 Finalize event platform migration
Bug: T275005
Change-Id: I55c4282dea0820a31bf8d7d428913512a35c6986
2021-02-24 16:38:09 +01:00
Adam Wight 36212a7877 Log user edit count bucket
Bug: T269986
Change-Id: Iff3c983a59738312bc39bf65e2428526724fe139
2021-01-27 09:03:28 +00:00
Thiemo Kreuz 473a711aaa Rename our customized matchbrackets addon
Bug: T269096
Change-Id: I5b58099166f71ccc1b3b19334f28e8bbaafaceb3
2021-01-20 11:17:59 +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
Andrew Kostka 7d01567c4f Record usage statistics for syntax highlighting
Bug: T260138
Change-Id: Ic9b95d6331bf85704822a69483880faaaa578a0e
2020-11-25 15:18:01 +01:00
Reedy 55e2bd0558 Move CodeMirrorPluginModules from config to attributes
Change-Id: I38c33f5d140a88f9eda1df7094a203fd7009412e
2020-05-12 18:29:44 +00:00
Reedy 58289325f4 Convert to manifest_version 2
Bug: T252470
Change-Id: I23fea7028e5adc0a95b783aa0a3caf80c04f6a00
2020-05-12 16:53:47 +00:00
James D. Forrester 63e30576de extension.json: Simplify hook calls as we only ever use one
Change-Id: Idcf9725791cc9f861ca2708c0cd25f45f0d9d68f
2020-05-11 20:20:08 +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
Ed Sanders 4d53bcbe09 VE: Don't load CodeMirror code until tool is activated
This saves about 300k uncompressed / 80k compressed whenever VE loads!

Change-Id: I7cf1c35292c2ea48cc15ceb4c22d4473a25484e9
2020-03-19 20:23:24 +00:00
Derk-Jan Hartman 99db78cd23 CodeMirror: Add COPYING file and credit for CodeMirror authors
Bug: T234086
Change-Id: I44460b26fc367f0415073a7221226069799e1b1c
2020-03-02 21:34:06 +00:00
AronDemian d70bd9d1ae Unify monospace font stack. Avoid potential sizing bug caused by weird browser behavior with font-family: monospace;
Problem: browsers implicitly and unexpectedly set the font-size to something around 13px with `font-family: monospace;`, but not with `font-family: monospace,monospace;`.
See:  http://code.iamkate.com/html-and-css/fixing-browsers-broken-monospace-font-handling/

Bug: T176636
Change-Id: Ied24a0cde7db4a6092d2cd7a6207d0a361424c3f
Related: T245568
Related: T245476
2020-02-28 04:44:07 +00:00
Timo Tijhof 1bfbc6e045 Remove use of jquery.ui module aliases
This increases the extension's dependency to MW 1.34+.

Bug: T219604
Change-Id: Ic78f8eba5c18bfa6ee3e70277504cf7b17975387
2019-11-25 22:45:01 +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
Max Semenik c8f75d5ac5 Restore GetPreferences hook handler registration
Accidentally removed in I1ad451acfd1

Bug: T198537
Change-Id: I71788de31a23373f4e0528211ce3ec89fc5f9d3b
2018-07-03 14:25:01 -07:00
Max Semenik 63647bb5dc Remove all BetaFeatures support
Bug: T185030
Change-Id: I1ad451acfd163c783e7b8ec604d8695c14342667
2018-06-13 16:42:40 -07:00
Fomafix 31c24340f7 Remove dependencies on deprecated modules 'mediawiki.api.*'
In core the modules 'mediawiki.api.*' get merged into 'mediawiki.api'
and get deprecated in ecc812f06e included in MediaWiki 1.32.

Change-Id: I07471baa50edbd4d5a7ff904b46602729612ccde
2018-05-21 14:37:21 +02:00
Kunal Mehta c6d9adbe83 Set extension type to editor
This extension doesn't even register a parser hook.

Change-Id: Ia31cae5504f404e130bfd77322ec53c79e085f22
2018-04-26 00:33:09 -07:00
MusikAnimal 7d99bbefde Remove 'Try syntax highlighting' popup for all users
A Node script was used to remove the now unused i18n messages.
This same script sorts the messages alphabetically, so it looks
like some unrelated messages were changed, but they weren't.

Bug: T191297
Change-Id: I69cce06133c1d055d31d12ebc8408123c187b574
2018-04-12 18:22:31 -04:00
jenkins-bot 6772e087e5 Merge "Tests for MediaWiki CodeMirror syntax highlighting" 2018-03-29 23:17:39 +00:00
Ed Sanders 6d92dd818d Use upstream OOUI icons for WikiEditor toolbar
Also uses upstream tool-active styling, which was
based on cm-on.svg.

Depends-On: I3e6f65f6f290778d3fbfa22f5d212c26fee12a86
Change-Id: Ib42be9f8b87efe1387eb5c77698fd2f0af0a673d
2018-03-23 13:43:30 +00:00
MusikAnimal 4d2783eb3e Tests for MediaWiki CodeMirror syntax highlighting
Bug: T169592
Change-Id: I0750d3a320af5451f847e6062f82523fb18f12bc
2018-03-20 16:27:55 -04:00
jenkins-bot 220a68a9f9 Merge "textSelection: Replace encapsulateSelection with replaceSelection" 2018-02-13 17:25:25 +00:00
Kunal Mehta f7e5949334 Move classes into includes/
Depends-On: Idbcb76f54eb57b0a56b46188526858038d698627
Change-Id: I2858e848137336aeabb18513f073bfccf64c0a6b
2018-02-10 09:27:42 +00:00
Ed Sanders 3e0d9773d4 textSelection: Replace encapsulateSelection with replaceSelection
encapsulateSelection is now defined in terms of other methods,
so we don't need to duplicate it here.

Follows on from T185917.

Change-Id: I1f99b3140ed363658ed2724a58c8b34ef20769fa
2018-02-09 10:31:47 +00:00
Kunal Mehta e3f0df1cfc Use SPDX 3.0 license identifier
SPDX released version 3 of their license list (<https://spdx.org/licenses/>),
which changed the FSF licenses to explicitly end in -only or -or-later
instead of relying on an easy to miss + symbol.

Bug: T183858
Change-Id: Iddfe5ea4519690d2b14f6a363d87c648a0050e25
2018-01-04 02:55:40 -08:00
jenkins-bot d25705d804 Merge "Disable WebkitTextFillColor in Firefox+OSX" 2017-12-12 19:44:09 +00:00
Fomafix 63720b9c20 Rename CodeMirror.hooks.php to CodeMirrorHooks.php
This avoids the MediaWiki.Files.ClassMatchesFilename.NotMatch exception
in .phpcs.xml.

Change-Id: I599016f4754f24b16394bdf1ba45bb20862fcd2a
2017-12-02 20:27:01 +01:00
Reedy 5be0a26626 Set required MW to 1.25.0 in extension.json
Change-Id: I7e76cfca9a476be7dd766d14231d0a2ee67cb942
2017-12-01 03:23:49 +00:00
Ed Sanders 80241fb717 Disable WebkitTextFillColor in Firefox+OSX
Avoids opaque selection covering text.

Bug: T175223
Change-Id: Iede96501d4a03ccd80488b4661c18647eb9118e1
2017-11-30 18:05:52 +00:00
Niharika Kohli a0062e3100 Make textbox height flexible with CodeMirror
Bug: T170906
Bug: T176449 (hopefully)
Change-Id: Ic0ac663c413db5c29ae786d3c17f7396ad620226
2017-11-06 17:20:51 -08:00
Sam Wilson b4b9da7e51 Join the popup label into one message
The popup label was being styled as two words from two different
i18n messages, each a different colour. This combines them into
one, moves the identifing class name up to the outer span, and
colours both words blue (the outer braces are left black).

Bug: T174219
Change-Id: Id1166f48ae4b3b8daff29be56dd92ef330dd9cef
2017-09-11 10:23:22 +08:00
jenkins-bot 13a4780879 Merge "Remove $wgCodeMirrorEnableFrontend" 2017-08-25 18:31:20 +00:00
Florian Schmidt 00a0baf8b6 Remove $wgCodeMirrorEnableFrontend
Not needed/used anymore.

Bug: T172470
Change-Id: I9aa03c97bd775248f3a2cfb316df77eb7ef86457
2017-08-24 17:55:08 +02:00
Fomafix 93844520cc Add dependency to module 'mediawiki.user'
ext.CodeMirror.js uses mw.user.isAnon from module 'mediawiki.user'.

Change-Id: If1a98914ad58e9ed004089a6c2ebf3295974712b
2017-08-24 11:12:33 +02:00
Ed Sanders 659e0963f1 Separate out CodeMirror config data and add to VE mode
Bug: T172958
Change-Id: I2d7969782ee9f02347f7aa0c7f0eebb2d592904d
2017-08-13 12:06:41 -04:00
jenkins-bot 0971aabc42 Merge "Move JS config vars from page HTML into RL module" 2017-08-04 12:54:08 +00:00
Max Semenik 0f6d8818be Move JS config vars from page HTML into RL module
Bug: T172458
Change-Id: I60bfab0028a21c3942508f5ad6377df9a285c7de
2017-08-04 13:37:54 +06:00
Max Semenik a749945897 ext.CodeMirror.loader is unused, remove
Change-Id: I2b51fb2e4e20fef088503567ba0cf818a1d2c857
2017-08-03 17:54:28 -07:00
Umherirrender 453335f16e Fix indent in json files
Change-Id: Id873facdf4d0aece5883f3ced79f7fb17aa6de8a
2017-07-18 20:14:34 +02:00
Max Semenik c6ccd44f95 Remove i18n shim
Change-Id: I187328ea888589aa33500dda25c73cff18261e07
2017-07-08 21:07:51 +00:00
Niharika29 55092521c3 Make sure popup appears for both classic and wikitext editors
Bug: T165003
Change-Id: I4b1c9498df7931643ea3c39d6d2afd9384e47de0
2017-07-04 00:15:56 +00:00
Niharika29 e3d24a9d32 Add missing dependency
Bug: T165003
Change-Id: I77669035aa425230fe254e776fdb9a5cdd4715c7
2017-06-30 19:35:17 +00:00
Niharika29 99e31d152f Show a popup for first time Codemirror users
Bug: T165003
Change-Id: I545a57bdb273ab6906711e2d65dc029293ecc02a
2017-06-29 00:20:14 +00:00
niharika29 48358c1f57 Add syntax highlight as a beta feature
Bug: T165543
Change-Id: If7eb2dc3f7c00a91e5ca39ae564f63efa07bbead
2017-06-20 05:07:53 +00:00
Ed Sanders de6b08919b Use consistent label for button across editors
Change-Id: I1a299522e95cdb4a6e5bdbdda1c65d4fcec22133
2017-05-08 16:54:10 +01:00
Ed Sanders 7b01a98ad0 VisualEditor source mode support
Long-term todo:
* Performance will be poor on large pages due
  to using a auto-height textarea which CodeMirror
  doesn't optimise.

Change-Id: I16598fcdbeee51e6fae88376ec81f1c8552b383d
2017-05-08 16:54:10 +01:00
Pavel Astakhov c9b4aa65fd Refactor the Integration with other extensions (v 4.0.0)
This patch makes initialization easier and cheaper.

Since only the PhpTags extension uses the CodeMirrorGetAdditionalResources
  hook it was removed. Instead, the CodeMirrorPluginModules and
  CodeMirrorTagModes properties are used in extension.json file.

This patch adds ext.CodeMirror.lib.mode.php module for the PhpTags
  extension (with dependences). In CodeMirror there are a lot of modes
  they will be registered on request (if they will be requered for
  extensions).

Examples of integration:
* Cite: I1bf156fa813af4d5f891619f692047bbdb8a1a86
* PhpTags: Ie339f0475e63885e603defaee2cdcccd6a95fafc

Bug: T163238
Change-Id: Idb7a1a5769a1047ef2f7cd25a7152f73a6613225
2017-05-04 21:20:21 +01:00
Pavel Astakhov b7bc84d783 Remove some outdated code
Since WikiEditor uses wikiEditor-toolbar-doneInitialSections event
  we don't need to add it to ResourceLoader dependencies.

Bug: T161475
Change-Id: I7c7c3ba495c0292d2df052145e7930c86fcb48f5
2017-04-18 14:07:51 +06:00
Kaldari fe11d52eaa Explicitly declare mediawiki.api.options module dependency
Change-Id: Ie1915e6c0d0671d7f3327d0ad80542ca967dab98
2017-03-26 22:26:49 -07:00
Ed Sanders 3980fa0af0 Cleanup and use SVG icons
Change-Id: Idcad8e2554c5e44155c88bd925186095e3aad930
2017-03-27 02:59:13 +00:00
Pavel Astakhov 7854e7c06b Update the CodeMirror library to 5.9 (v 3.4.0)
Change-Id: Ia36b0573809d632c0521477cea72268b5524efae
2015-12-14 11:28:57 +06:00
Pavel Astakhov 740cc73d1a Go to next field when TAB key is pressed (v 3.3.0)
Bug: T118180
Change-Id: Ic86736f0c2b657bd3b56c16f9243a4f123af6d5e
2015-11-18 14:34:08 +06:00
Pavel Astakhov 82f8acd450 Fix conflict with the CodeEditor extension (v 3.2.3)
CodeMirror will be not initialized if CodeEditor is used

Change-Id: I78ab2814beb0e40a878f6a02b7d3967c216afce6
2015-11-18 11:34:36 +06:00
Pavel Astakhov 3db709ef0c Skip setCodeEditorPreference for anon users (v 3.2.2)
Change-Id: If4f208b3edd73a100404f09f170fb3a060ce1c3c
2015-10-29 09:15:29 +06:00
Pavel Astakhov 991be29500 fix highlighting parameters inside a template transclusion (v 3.2.1)
Bug: T108450
Change-Id: Ic686fe6aa211988d8458037c275779f512d03563
2015-08-20 10:32:11 +06:00
Pavel Astakhov 9acce89672 fix bold and italic apostrophes (v 3.2)
Bug: T108455
Change-Id: Ie9e0d734004d062e4c347f7940eb34bdc231d026
2015-08-19 21:10:31 +06:00
Pavel Astakhov 66b518d8dd fix highlighting of external links, multiple apostrophes end link (3.1.14)
Change-Id: Ibbb4850edc04ed6b184fa59c51e1978d60cd1269
2015-08-14 13:22:47 +06:00
Pavel Astakhov 491f186e14 fix matching hr ---- (v 3.1.13)
Change-Id: I7ea6fa891d2c53da4ac9bd62319dad702a11b8d7
2015-08-14 12:03:41 +06:00
Pavel Astakhov e681dc6ce2 Add setContents to textSelection and JS hook for #wpTextbox1 (v 3.1.12)
Bug: T108711
Change-Id: I65f25108863339fdcfc55c030a1158c2cd789b91
2015-08-14 11:49:12 +06:00
Pavel Astakhov c6f14176ca Convert to ExtensionRegistration (v 3.1.11)
Remove group ext.CodeMirror, too. There is no need to load CodeMirror
in it's own request, it can be loaded with all other modules.

Change-Id: I16958866847b66c523e2edfe841ca20694ec7ccc
2015-08-11 13:12:51 +06:00