Commit graph

389 commits

Author SHA1 Message Date
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
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
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
WMDE-Fisch 6744545c61 Skip user setting for unnamed users
Bug: T329771
Change-Id: I0066c2411bf12fedb1e29cde8306b107c3ab95ba
2023-05-20 15:36:29 +03:00
Volker E ba64a52368 styles: Replace mentioning of WikimediaUI Base and add skin variables
It makes no difference to directly assign Codex Design System for
Wikimedia colors as values instead of re-assigning the outdated
`@wmui-color-*` variables.

Bump to required MediaWiki core version >= v1.41.0.

Also put stylelint-disable before the block it's actually needed.

Bug: T334934
Change-Id: I5696f160d39ef4edec7a1b966fe7e73608c86bdc
2023-05-16 17:58:24 +02:00
jenkins-bot 775de7751a Merge "Search for toolbar place in toolbarConfig as well as actionConfig" 2023-02-16 00:00:25 +00:00
Ed Sanders 47e42bc61b Search for toolbar place in toolbarConfig as well as actionConfig
The actionToolbar is deprecated and will be going away soon.

Change-Id: I475e987959a037eaa536986cba063ab3ccc0083e
2023-02-14 17:30:33 -08:00
Ed Sanders 2f5366dab9 CSS: Remove unused browser prefixes
Change-Id: I91dcffc7a05e6a12dd0ae006bd4195d5c5751704
2023-02-14 17:23:32 -08:00
Umherirrender d4924ebc48 build: Disable rule unit-disallowed-list inline
Bug: T279431
Change-Id: I75698f990c168fa6c9958cdcf9b6e1fe4a0113c9
2022-10-27 00:37:31 +02:00
jenkins-bot cbec99c8c4 Merge "Add tags from CodeMirrorPluginModules to extension tags list" 2022-10-05 14:27:22 +00:00
samtar 5061cc1228
ext.CodeMirror.js: Keep at 100% parent width
Force the CodeMirror area to stay at 100% parent width during a
resize event.

Bug: T305939
Change-Id: I99f5d0b0955521f522a549b2cf1f2205cb0e48c0
2022-08-04 12:54:40 +01:00
Thiemo Kreuz 7404a9f2a0 Minor optimizations to some patterns in mediawiki mode
Note that this .match() method is not the one you think it is.
This is StringStream.match() from the CodeMirror lib, not ES
String.match().

Change-Id: Ief5048ff78bcd035482e7a68044e24592d28cb6c
2022-08-04 10:36:52 +02:00
jenkins-bot 377efc459d Merge "Merge some more identical MediaWiki color scheme styles" 2022-06-20 12:00:21 +00:00
jenkins-bot 80278f0758 Merge "Fix inconsistent parsing of quoted tag attributes" 2022-06-17 12:13:03 +00:00
Thiemo Kreuz 263285e139 Merge some more identical MediaWiki color scheme styles
Bug: T307188
Change-Id: I50037fe3f8653941269699b140a84ff44d8e20ed
2022-06-16 16:15:56 +02:00
Thiemo Kreuz df1a084547 Use named colors in the MediaWiki style .less file
I leave some colors behind where I'm not entirely sure how to name
them.

Change-Id: Id3a248a116efaf2143f836f32606b1dc3d5ef290
2022-06-15 13:31:02 +02:00
Thiemo Kreuz 762c9e3eb4 Convert MediaWiki style sheet to LESS code
I did some reverse engeneering and derived the three base colors for
nested templates and parser functions as well as links, together with
a formula to calculate any mixture of the three.

You can manually compile the .less file:
lessc resources/mode/mediawiki/mediawiki.less resources/mode/mediawiki/mediawiki.css

Then compare:
git diff --word-diff=color -w HEAD^ -- resources/mode/mediawiki/mediawiki.css

You will see that some numbers change. These are rounding errors in
the old .css code.

Bug: T307188
Change-Id: Ic534a2fac73f9f737ae5238b87aa80b705b37786
2022-06-14 15:59:33 +00:00
Thiemo Kreuz c8c140b33d Merge identical styles in MediaWiki style sheet
To avoid code duplication and to make this easier to read and to
maintain.

Bug: T307188
Change-Id: I01ccdb7aecae6c80e7924250afdf0d7fafb486e2
2022-06-14 09:49:20 +02:00
WMDE-Fisch 574ceba9bf Remove $wgCodeMirrorColorblindColors feature flag
Bug: T307188
Change-Id: I7a8f2b02cad160df838ebfb167b63296123b4a08
2022-06-13 13:20:24 +02:00
Adam Wight 9f34c4d220 Remove $wgCodeMirrorEnableBracketMatching feature flag
Bug: T307188
Change-Id: Ibb21dea29c87d8fac898506c19f329273348c190
2022-06-13 10:34:41 +02:00
Adam Wight ba48e3c474 Merge accessibility-mindful colors into base styles
Bug: T307188
Change-Id: I32831cc546bc8fca2ee73e3d6742f87838791d1b
2022-06-10 16:20:43 +02:00
Adam Wight 396d50cd5d Remove $wgCodeMirrorAccessibilityColors feature flag
Get rid of the flag, without making any substantial changes to the
code.  A follow-up commit will merge the CSS into base rules.

Bug: T307188
Change-Id: I601df5047d0db3cfb9559538487d3d39bb6c7cf4
2022-06-10 16:18:42 +02:00
bhsd 44c31c9122 Fix special characters in section headers
When there are standalone special characters '<', '[', '{', and '~' in the section header, the ending '=' will not be highlighted while the ending characters in the next line are incorrectly highlighted. This is because the ending '=' is eaten as plain text at the end of function eatWikiText(). A less aggressive plain text matching does not hurt.

Bug: T309143
Depends-On: I47dad71df97f38c55550f71baf6dae67dbe0a2ba
Change-Id: I4a9c6c6cb2f7fbc212808e386124a56676fdbfb1
2022-05-24 23:09:09 +00:00
jenkins-bot 0418e65cad Merge "Add colorblind-friendly scheme" 2022-04-08 13:52:34 +00:00
WMDE-Fisch c3cda7edd7 Add colorblind-friendly scheme
Including an user options to enable/disable the scheme. Defaults
to false. Feature is only availible together with the new more
accessibile color scheme as the CSS depends on each other.

Set behind a new temporary feature flag.

Bug: T305027
Change-Id: I46d240a30eda5a1526ada1fe9b724f7b4594b426
2022-04-08 14:12:43 +02:00
jenkins-bot daf7103693 Merge "Use less for accessible-colors.css" 2022-04-07 12:10:38 +00:00
jenkins-bot fe9836d3b9 Merge "Use new event handler from WikiEditor for Realtime Preview" 2022-04-07 03:00:46 +00:00
Thiemo Kreuz f1aa4c71f6 Fix inconsistent parsing of quoted tag attributes
Turns out the MediaWiki parser behaves odd when confronted with syntax
like this:

  <ref name="a>b"> … </ref>

XML and HTML parsers are usually expected to respect the pair of double
quotes. But our parser doesn't. What it actually does is this:

  <ref name="a"> b"> … </ref>

This change makes the syntax highlighter behave the same. This makes it
easier to spot this issue when editing wikitext.

Bug: T270880
Change-Id: I14bdf6630889fb6d0dea53890a693f00d9356f54
2022-04-06 15:32:56 +00:00
jenkins-bot eec80985fc Merge "Prepare tests for later change" 2022-04-06 10:24:27 +00:00
WMDE-Fisch ede8b043bd Use less for accessible-colors.css
Change-Id: I4ed291ce0ef6e85b4540fcaef36892a521a99c17
2022-04-06 10:21:47 +00:00
Sam Wilson fa8296c312 Use new event handler from WikiEditor for Realtime Preview
Fixes the issue with the change handler not working.

Bug: T303767
Depends-On: Iee4c885f92dd9ec985a3f9fd92a2fafc00f2e9ff
Change-Id: Idb97a67f940eee69e09679196d0de71e76ef3672
2022-04-06 13:22:17 +08:00
ElijahPepe 2451c7f944 Reload CodeMirror to fix a caret issue
A common issue, reported in VPI as Possible Thursday weirdness, with
source editor users using syntax highlighting is that the caret can
often be misplaced as to where the user selects. This PR adds code
to reload CM when loaded to adjust for this behavior.
Moved to after CM has finished initialising. Tested working.
Add another instance of codeMirror.refresh().

Bug: T305333
Change-Id: I9a81ffd41a3ba1321b7b5744ba096583cbb1d96c
2022-04-05 22:37:31 +01:00
Sam Wilson 1310fbf645 Support WikiEditor's realtime-preview feature
Add support for enabling, resizing, and disabling the new
realtime-preview feature.

Bug: T293347
Bug: T303767
Change-Id: I8c8c25fe56be55a61f4b8d1d2ef8cf74483aa241
2022-03-24 12:02:03 +08:00
jenkins-bot bec93b7b5a Merge "build: Update devDependencies" 2022-03-16 20:35:03 +00:00
jenkins-bot fa9462342d Merge "Highlight headings with trailing comments" 2022-03-16 20:16:20 +00:00
Ed Sanders 80336b322a build: Update devDependencies
Change-Id: Ia0f3481cb4e153338ef68c1d44951d897ddc7195
2022-03-13 22:56:14 +00:00
AntiCompositeNumber a84828c08c
Highlight headings with trailing comments
Bug: T171074
Change-Id: I1c8399b839a9be5e5aa0ece36dc86a5848936b5f
2022-03-11 17:13:14 -05:00
jenkins-bot 5e28656544 Merge "Trigger focus/blur event handlers attached to textarea" 2022-03-10 22:53:23 +00:00
Thiemo Kreuz 40e4d6b1d0 Prepare tests for later change
Change-Id: Ib0bf448e68f3051d8f1072417927f9a047ed9f06
2022-03-10 18:47:17 +00:00
jenkins-bot c22868121e Merge "Highlight multi-line tags" 2022-03-04 21:09:42 +00:00
Thiemo Kreuz 20debba3b0 Enable eslint for our custom code in the matchbrackets addon
The resulting code style in this file is a little mixed. I tried to
stick to the existing style. Most notably is the indention with
2 spaces instead of 1 tab. But I couldn't disable the spaces inside
round brackets. They make the code so much more readable.

What this patch effectively does is enabling the eslint check for our
custom code in this addon, excluding all old code, and exclusing a few
rules that conflict to heavily with the old code style.

Change-Id: I12f953cb0a6fd35e405b6cc348abfb2c11e70696
2022-03-03 21:07:19 +00:00
bhsd d23dc77d16 Highlight multi-line tags
CodeMirror is already able to highlight multi-line tags if the tag name is followed by any non-whitespace characters in the same line. This commit fixes the other condition where the tag name is followed by whitespace only in the same line.

Bug: T201684
Change-Id: I8cb4a53ee0fe7fc8612a58331a1a3e57d00d7630
2022-02-23 17:02:22 -08:00
AntiCompositeNumber b136622875
Add tags from CodeMirrorPluginModules to extension tags list
Currently, only registered parser tags are included in the list of
extension tags to be highlighted. This patch allows extensions that do
not register their tags as parser tags (Extension:Translate) to still
define them for highlighting using the existing CodeMirrorPluginModules
annotation.
This patch also removes the special-casing for <translate>, as it can be
defined in Translate instead.

Bug: T284883
Co-Authored-by: Tacsipacsi <tacsipacsi@jnet.hu>
Depends-On: I860c944eaeeb7771629a1ed2352c05cfd8d7ca80
Change-Id: Iba2b0b874ebbace7a892af9e1d9896e8b17ade78
2022-02-19 18:36:51 -05:00
bhsd b9abcbc12e Trigger focus/blur event handlers attached to textarea
When CodeMirror is focused/blurred, the same event will triggered on its corresponding textarea.

Bug: T197632
Change-Id: Ib71b6774a60dd434bdc8a27b9eab433dcc1c65f0
2022-02-19 12:23:17 -08:00
bhsd ca0e8f20a4 Highlight tags in link text
HTML and extension tags should be highlighted as the text of internal or external links.

Bug: T184341
Change-Id: Ib1f2047936b395afd86720e2a7c921e382229cdd
2022-02-19 06:11:34 +00:00
Ed Sanders 0faac32661 eslint: Lint Gruntile.js using server rules
Change-Id: Ib0e7d62343689bb993476cb1ad40f93fc89a7190
2022-02-07 16:25:32 +00:00
Thiemo Kreuz 963e636f83 Restore focus also when switching syntax highlighting on
The same already happens when switching it off, see line #249.

I noticed there is still a (random?) chance the selection gets lost
when switching back and forth between syntax highlighting on and off.
This is not what this patch is about.

Bug: T298488
Change-Id: I541f96be9e6fb2f9032df4b86657d01f0eac5679
2022-01-03 18:00:26 +01:00
jenkins-bot 92051b550f Merge "Reduce noise in syntax highlighting tests" 2021-12-22 13:52:04 +00: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
jenkins-bot 0f70fd33e5 Merge "Fix syntax highlighting test failing when Cite isn't loaded" 2021-12-14 07:26:21 +00:00