Commit graph

384 commits

Author SHA1 Message Date
Timo Tijhof d97fa84d2b Fix invalid reference to core resources/ directory
This works by accident due to the CWD being mediawiki-core in most
cases during web requests, and Less.php implicitly falling back to that
as path expansion point when all attempts to expand the path fail (e.g.
relative to current file, and relative to a supported Less import dir
such as core `mediawiki.less/`.

Importing raw files from elsewhere in core is unstable, and is not
supported as this fails on some webserver configurations, as well as
in CLI contexts such as maintenance scripts that rebuild a cache, or
otherwise end up (in)directly computing part of a ResourceLoader
module.

The use case of themeing extension styles to the current skin (with
Vector using WikimediaUI) is subject of T112747 and T265941.

Follows-up I9eb07dd43.

Bug: T296639
Change-Id: I6d2be2941d6088b947ea7f18818add97f129760d
2021-11-30 00:58:58 +00:00
Thiemo Kreuz bab5c5232d Disable line numbering in all Android browser versions
This patch also minifies existing code. Note that [] is true in
JavaScript, unlike in PHP.

Bug: T285660
Change-Id: Ic80903ebd1364505fd4aaf7f53b53324a235fd79
2021-09-03 11:37:03 +00:00
WMDE-Fisch ade62be37e Improve text color & background in line numbers on VE
Bug: T287383
Change-Id: I1ece09c12bfbcb4709d5659d87f3045327729f10
2021-09-02 13:54:31 +02:00
jenkins-bot 79284952de Merge "Fire a hook when the CodeMirror editor is switched" 2021-07-13 04:39:52 +00:00
Inductiveload a57d7b7c1c Fire a hook when the CodeMirror editor is switched
This allows gadgets to react to the changing editor (for example
to rebind event handlers on the new active editor) without having
to use something like an MutationObserver.

Bug: T284282
Change-Id: I83f0a3c29b01031ae370b7d1207457586f0d25d6
2021-06-16 02:29:55 +01:00
Ed Sanders 3be6ae4b12 Move var declarations inline
Change-Id: I5a390c5621cefce1b396831654d54a74d0a63e9f
2021-06-15 15:50:09 +01:00
jenkins-bot 6fd33d774f Merge "Fix MediaWiki highlighter partly failing on quoted attributes" 2021-04-30 12:43:30 +00:00
Thiemo Kreuz 032bed3c61 Fix MediaWiki highlighter partly failing on quoted attributes
In T270880 an example with a slash in <ref name="a/b"> is
described. The same issue happens with several other characters
including the closing bracket, e.g. <ref name="a>b">. This patch
fixes all of this by accepting _all_ characters between double
and single quotes.

Bug: T270880
Change-Id: I03a1e1a25af692dc703b44a57b2d23d6fc15c8c9
2021-04-23 20:43:33 +02:00
jenkins-bot f569bf8d75 Merge "Fix bracket matching getting stuck when leaving the brackets" 2021-04-23 14:58:23 +00:00
Thiemo Kreuz 26a05d1dd0 Allow HTML comments and newlines in template names
Bug: T277767
Change-Id: I0a82af178d768e5f4d3dd81b1759c0ce72310397
2021-04-23 15:34:20 +02:00
Thiemo Kreuz 5186c6f3a2 Fix bracket matching getting stuck when leaving the brackets
Bug: T278840
Bug: T280978
Change-Id: Ia552fcd829ce38cbb7ac7fd7ebecad971a83e4c3
2021-04-23 14:48:23 +02: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
Thiemo Kreuz 6937d0e51c Fix incomplete (auto)clear for highlighted brackets
The issue can be reproduced as described in T278840. What
happens is that an (auto)clear is triggered and removes all
marks, but the cached values in `currentMarks` remain. The next
time the same marks are found, they are discarded and don't
show up, because the cache says they are already there, when
they are not.

Bug: T278840
Change-Id: If83bd99e924f579854cfe4b01fab4ef86892933b
2021-04-09 11:07:26 +02:00
Adam Wight f2b6cec8f6 Reposition line numbering to be flush with the title
Bug: T267911
Change-Id: I8aab2f53ebba63a93f5a6bd63d616db801965ae0
2021-04-08 13:22:10 +02:00
Thiemo Kreuz 7365cc9a96 Enable line numbering
Line numbering will be unconditionally enabled.

Bug: T267911
Change-Id: I9eb07dd433e352ed5cea5dc978d469ee2ea6f347
2021-04-08 09:53:23 +02:00
jenkins-bot f1ef877d28 Merge "Update color scheme to meet accessibility standards" 2021-03-09 16:08:25 +00:00
WMDE-Fisch 9bea2a7905 Refine bracket matching styling
Adds a custom class for matched brackets to allow better integration
with custom bracket styles. The brackets won't be bold in the 2017WTE.
Bold font might lead to misalignment there. See ticket.

Note: box-shadow seems to be supported for quite some time by all
relevant browsers

Bug: T270926
Change-Id: Ica1e301f63a106a96db3bfaba4b2f322af64b009
2021-03-08 09:26:07 +01: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
jenkins-bot 05241f1259 Merge "Add accesskey to CodeMirror input field" 2021-03-02 09:26:32 +00:00
Jon Harald Søby e325bc2e13 Add accesskey to CodeMirror input field
Add the same accesskey that the normal <textarea> uses.

Bug: T259347
Change-Id: I67c3b9d374203a5dabc29cc8c61fa76e2b64cb5a
2021-02-25 14:06:51 +01:00
jenkins-bot 92524135c0 Merge "Revert "Lower maxHighlightLineLength limit to 5000"" 2021-02-10 16:35:47 +00:00
Thiemo Kreuz (WMDE) 0268f68170 Revert "Lower maxHighlightLineLength limit to 5000"
This does not have an effect any more with all the other
optimizations in place.

This reverts commit 094f20902c.

Bug: T274369
Change-Id: I288039a35270093bd22b5a073e70f6b769088c13
2021-02-10 16:19:10 +00:00
Thiemo Kreuz cfecfbc099 Fix remaining bottleneck in wikitext syntax highlighter
I was wondering why the performance when editing wikitext is
still so bad, and profiled it again. Turns out
StringStream.match() is still the bottleneck (even if already
100 times better than before Icbb1122).

The method is called with many different patterns from
mode/mediawiki/mediawiki.js. I profiled them individually and
found a single outlier. The idea is the same as in Icbb1122.
A pattern that is able to find something *in* a string is
doing nothing but wasting time, as StringStream.match() ignores
every result that is not at the start of the string.

The change adds the missing ^ anchor and wraps the regex pattern
from mw.config.get( 'wgUrlProtocols' ) (that is something like
"ftp:\/\/|http:\/\/|https:\/\/|…") in (?:…), which is a
non-matching group. This is necessary because of the | in the
pattern. The result is a pattern that looks like /^(?:…|…|…)/i.

I remember looking at this code while working on Icbb1122, but
didn't include it in the patch, and then forgot about it.

Bug: T270237
Bug: T270317
Change-Id: Iea2fd116b68704c3186b0edf965006cc7c6eda82
2021-02-05 16:07:40 +01:00
Adam Wight 81bd2fe546 Clean-up: inline array merge
Change-Id: Ie976bf70f4117db09b53e6192f983930c7e6a458
2021-02-01 13:24:05 +01:00
jenkins-bot 96b81c3420 Merge "Log user edit count bucket" 2021-01-27 09:11:17 +00:00
Adam Wight 36212a7877 Log user edit count bucket
Bug: T269986
Change-Id: Iff3c983a59738312bc39bf65e2428526724fe139
2021-01-27 09:03:28 +00:00
Thiemo Kreuz 6bc81ffd50 Improve matchbrackets performance when moving the cursor
My previous patch Icbb1122 focused on the behavior of the
matchbrackets addon when the text is *edited*. This patch here
is about moving the cursor without changing the text. I
realized the addon re-draws everything every time the cursor
moves, even if the highlighted pair of brackets is still the
same. This triggers very expensive code in the CodeMirror lib.

I had a look at this expensive code, but did not found an easy
win. It just is what it is: an expensive re-draw. Instead I
introduced a caching layer that remembers the positions of the
previously highlighted brackets and bails out as early as
possible when nothing changed.

The biggest chunk of code is that "did something change?"
comparison. It looks expensive, but typically isn't. There are
typically only 2 elements in the array for a single
opening–closing pair. (Possibly more when there are multiple
text selections.) The elements in the two arrays are typically
in the same order. (Except the cursor is on the closing
bracket.) Which means the nested `every` → `for` loop will
typically be executed 2 times only – one time for each of the
2 elements.

I won't upload this change upstream because it is only relevant
together with our custom "in the middle" bracket highlighting.
With our customization we have many, many situations where the
highlighted brackets don't change. This (almost) doesn't happen
upstream.

Bug: T270317
Change-Id: I789b45362388f0818e797f789f6af427a35e3e06
2021-01-27 08:54:32 +00:00
Thiemo Kreuz 473a711aaa Rename our customized matchbrackets addon
Bug: T269096
Change-Id: I5b58099166f71ccc1b3b19334f28e8bbaafaceb3
2021-01-20 11:17:59 +01:00
jenkins-bot 9ab93e1c54 Merge "Lower maxHighlightLineLength limit to 5000" 2021-01-20 10:03:06 +00:00
Thiemo Kreuz 094f20902c Lower maxHighlightLineLength limit to 5000
While working on T270317, I realized the performance of the
matchbrackets addon is not as good as described in
T270237#6739993. The issue with my original benchmark was that
I did it with a single pair of brackets with thousands of
characters between. A paragraph with thousands of brackets
behaves much worse. So bad that I feels painful when moving
the cursor.

Lowering the limit to something in the middle (between the
original 1000 and my 10000) makes it behave much, much better
on my machine.

Bug: T270237
Bug: T270317
Change-Id: I31f850f4c7778d6b5ff1d0eb17fdaf0edf7ae019
2021-01-19 15:04:14 +01:00
WMDE-Fisch 7ec8ebc84d Concretised comment around WMDE disabled line
Change-Id: Ibc4e1568bae78e92371e21314edc16857be7afed
2021-01-19 13:21:48 +01:00
Thiemo Kreuz 18a64328bb Disable non-matching highlighting via config flag
My upstream patch was accepted within 9 minutes:
https://github.com/codemirror/CodeMirror/pull/6565

Note: This backport includes another upstream commit that fixed
some typos.

Bug: T269096
Change-Id: Ib5b64214d7536bc952886f45290d537eab2f9bbb
2021-01-18 09:51:05 +00:00
Thiemo Kreuz a43acbeb6b Activate bracket matching for longer lines
The addon does have 3 settings:
- maxHighlightLineLength is for the current line where the
  cursor is. Bracket matching is simply not done when the
  current line is longer. The default is 1000, which is rather
  low.
- maxScanLineLength is for every other line that is scanned in
  the process. I don't understand why, but this limit is 10x
  higher.
- maxScanLines is the number of lines that can be scanned.

Simply raising the first to be 10000 as well fixes our issue.

Note that CodeMirror does have a limit of 10000 anyway. It's
called maxHighlightLength there. Lines that are longer get
syntax highlighting only for the first 10000 characters. The
rest of the line is black. Using the same limit in the addon
makes it's behavior consistent. Means: The user can see when
the syntax highlighting stops, and bracket matching stops
working the same time.

I benchmarked with both settings. It doesn't have a measurable
effect. Bracket matching is done in <1ms in both cases.

Bug: T270237
Change-Id: Ia56bf4c2fb023c9f117376242221d39f51196173
2021-01-14 11:28:02 +00:00
jenkins-bot ea8cffe3f2 Merge "Fix performance bottleneck in mediawiki syntax highlighter" 2021-01-14 11:22:33 +00:00
jenkins-bot 68ab91b64d Merge "Fix minor code style issues in matchbrackets addon" 2021-01-14 10:50:06 +00:00
Thiemo Kreuz 88984d2965 Fix minor code style issues in matchbrackets addon
Less ambiguous variable names. Less duplication. The minor
issues have been introduced in T270317.

Bug: T270317
Change-Id: I366396a61b76e19293ce8d14c2f346b97498fe40
2021-01-14 11:13:24 +01:00
Thiemo Kreuz f1cf1a534c Fix performance bottleneck in mediawiki syntax highlighter
I continued profiling the matchbrackets addon for T270237 and run into
performance issues that turned out to be unrelated to the addon. The
flame graph highlighted a "match" function. Note this is not the
String.match() from JavaScript, but something in the CodeMirror lib:

StringStream.prototype.match = function (pattern) {
  var match = this.string.match(pattern);
  if (match && match.index > 0) {
    return null;
  }
  return match;
}

(Note: I simplified this code so we can focus on the bug.)

When the pattern is a regular expression, it's executed via
JavaScript's String.match(). The function then checks if there was a
match and if it's at the start of the string. If not, it's not a
match and doesn't return one.

In other words: Even if there is a match somewhere in the string, the
function acts as if there was no match.

When we change all patterns to be anchored via ^, they don't scan the
entire string any more but return much ealier when there is no match
at the start of the string. We are effectively replacing nested loops
(hidden in the patterns) with single calls.

This bug exists since 2014.

The disabled line in the matchbrackets addon is just dead code. I
don't remove it to document the fact that we disabled it.

Bug: T270237
Bug: T270317
Change-Id: Icbb1122e6a3b26c0606726ff405e108931d185be
2021-01-13 16:58:57 +01:00
Thiemo Kreuz b0f9c23790 Update all syntax highlighters to latest version
We forgot to update these as well when we updated the lib.

Bug: T258999
Change-Id: I4dba51d82758975e46b75739c02ef2aa6cab5386
2021-01-13 09:41:29 +01:00
jenkins-bot 0bebeea02f Merge "Make private convertOffset function a shared method" 2021-01-13 07:22:29 +00:00
jenkins-bot 079a0ee325 Merge "Make bracket matching respect all limits" 2021-01-12 11:55:21 +00:00
jenkins-bot d01361dcdd Merge "Update matchbrackets addon to most recent version" 2021-01-12 11:48:28 +00:00
jenkins-bot 7f967cdd5d Merge "Add documentation for matchbrackets costomizations" 2021-01-12 11:48:26 +00:00
WMDE-Fisch de49f2c02a Enable bracket matching addon by defining the addons options
The addon does support some configuration options. These are passed
as properties of the `matchBrackets` CodeMirror option. Just passing
the boolean there hides that fact.

Bug: T270317
Bug: T270237
Change-Id: Iaa4b5ed8ef538e76cd1c96a09485e143112f1ae0
2021-01-12 11:55:22 +01:00
Thiemo Kreuz 0bb63f22d5 Make bracket matching respect all limits
This patch also removes all remaining FIXMEs. This code is not
a bottleneck. There is nothing to do.

Bug: T270317
Change-Id: Ie034440c98d8064a22811a1b569237dddb7b7436
2021-01-08 13:29:39 +01:00
Thiemo Kreuz 111243bc19 Update matchbrackets addon to most recent version
We "forgot" to update this addon when we did the update in
I6f0f030 (T258999).

Bug: T258999
Bug: T270317
Change-Id: Iab29e9e36f34b76551ddac497e40dc76669ba7c7
2021-01-08 11:39:28 +01:00
Thiemo Kreuz e6ca95499a Add documentation for matchbrackets costomizations
Bug: T270317
Change-Id: Ifb09c9122e4002215dc47b6e4546adddb7608dbf
2021-01-08 11:33:22 +01:00
Ed Sanders b59f296849 Guard against WikiEditor being removed by the time the hook runs
Bug: T271457
Change-Id: I73d2934847361592bceec51108404bf45ed4a5d7
2021-01-07 21:06:25 +00:00
Ed Sanders 7aceb6d65c Make private convertOffset function a shared method
Change-Id: I7e644ff998bd44e854b26dd9b11ba9a5d3bd0435
2021-01-06 14:57:32 +00:00
Thiemo Kreuz a43984fc67 Simplify onSelect handler implementation
Optimizations for the code introduced in Ic403e0a:
* Skip this entirely when something is selected (as discussed
  in Ic403e0a).
* Use a combination of existing methods. I benchmarked these
  again. This approach is "significantly" slower compared to
  the custom code from before. However, "significantly" here
  means something like 1 nanosecond vs. 4 nanoseconds. Both
  is effectively nothing.
* Use the same approach in another place. This one is triggered
  every time a change is made, e.g. a character typed. I
  benchmarked this as well. The new code is about 500x faster
  (yes, seriously).

Bug: T269094
Change-Id: I00fe595a89be7a257e27ed28d38568c81483338b
2021-01-05 22:50:04 +00:00
jenkins-bot 773b308fab Merge "Integrated bracket matching for CodeMirror with VisualEditor" 2021-01-05 11:37:57 +00:00
jenkins-bot 1ea61ad2aa Merge "Use wikiEditor.toolbarReady hook instead of ready event" 2020-12-31 03:29:51 +00:00
WMDE-Fisch 17fb4ceb7e Integrated bracket matching for CodeMirror with VisualEditor
Bug: T269094
Change-Id: Ic403e0a037127ed006e8d1168d710e6160a922d5
2020-12-29 21:34:16 +00:00
Ed Sanders 0c681f5300 ve-cm: Fix selection opacity when using fallback technique
The fallback technique makes the whole edit surface semi-transparent,
so reset native selections to full opacity.

Change-Id: If6cd585b1a09c549781fe82a3bdf18d64ac597b5
2020-12-28 23:38:16 +00:00
Ed Sanders 5bba5436a8 Use wikiEditor.toolbarReady hook instead of ready event
The hook avoids race conditions as it will run even if
CodeMirror loads after the toolbar.

Change-Id: Ida035fad473210add4a604b3c8d65d2d4edb49dc
2020-12-28 23:26:39 +00: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
Thiemo Kreuz 4a3c2dcad5 Update CodeMirror to 5.58.3
I had to make some CSS selectors more specific, because the
library changed

 .CodeMirror pre

to

 .CodeMirror pre.CodeMirror-line,
 .CodeMirror pre.CodeMirror-line-like

This is only relevant for entire lines (implemented as <pre>
elements). Most of the custom CSS is for characters, not lines.

In my tests in the Wikitext editor as well as VisualEditor I
could not spot any difference between the old and new version.

Bug: T258999
Change-Id: I6f0f030f972838727f3ef220feb105264f122798
2020-12-07 20:20:49 +00:00
Andrew Kostka 7d01567c4f Record usage statistics for syntax highlighting
Bug: T260138
Change-Id: Ic9b95d6331bf85704822a69483880faaaa578a0e
2020-11-25 15:18:01 +01:00
Thiemo Kreuz 3e9bb4fb08 Replace all .png images with rgba() background colors
The rgba() syntax is supported for a very, very long time now:
https://caniuse.com/#feat=mdn-css_types_color_alpha

Notes:

I realized the numbers in these file names are actually their
transparency in percent (more precisely their opaqueness).
4 is 4% which translates to 0.04 in the rgba() syntax.

I used Gimp to pick the opaque color values from the images.
Gimp makes this easy. No guesswork or calculations needed.

For multiple, stacked images I calculated the colors by
averaging their RGB values (considering how opaque each color
is). Note this is actually *more* precise than the stacked
images before. Stacking alpha colors is flawed. For example:
Let's say we have an rgba(255, 255, 255, 1) background.
Layering a half transparent rgba(255, 0, 0, 0.5) on top means
half the background shines through. This averages to
rgba( 255, 127, 127, 1). Now we stack rgba(0, 0, 0, 0.5) on
top. Again, half the background shines through, resulting in
rgba(127, 63, 63, 1).

When we apply the two colors the other way around, the result
is rgba(191, 63, 63, 1), a much brighter red.

This flaw doesn't happen when precalculating the averages, as
done in this patch.

Change-Id: I29026864714c5f90c2613af57f08693e7e2b996c
2020-08-11 14:24:20 +02:00
jenkins-bot f40872ec83 Merge "Fix 'setSelection' in textSelection API" 2020-07-15 19:21:51 +00:00
Ed Sanders 9f566d6046 Fix 'setSelection' in textSelection API
focus needs to come after setSelection

Change-Id: Ib073ddad445e05c4bc042b9c382a7d74369e29e1
2020-07-12 15:10:58 +00:00
Pavel Astakhov a9da1fa59e Load pluginModules in CodeMirrorAction class
Change-Id: Ia698be63171868cf568b136df89ce3e48eab1340
2020-07-10 17:12:23 +06:00
Ed Sanders 89f52f6fbb VE: Add explicit dependency on targetLoader
Change-Id: I3d67837b462e0b79e124eff158bd7f88b5aaf63e
2020-06-30 22:47:41 +01:00
Ed Sanders 2518861bc1 build: Update devDependencies
Change-Id: I2f2967a1525c6a66eba2f5fc225e74b89380c5dd
2020-06-12 22:51:38 +01:00
Bartosz Dziewoński d23ffa17cb Update VisualEditor styles for Vector changes
Bug: T252471
Change-Id: I6ba64f2deaa27172842ee5f71363708758324aff
2020-05-12 00:42:03 +02: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
Fomafix 6075e4cb83 Enable spellchecking on Firefox
The spellchecking was disabled for Firefox on non-Mac systems because
Firefox had a bug and inserts characters (like B) into the content when
enter an access key combination (like Shift+Alt+B).

Firefox 65 fixed the problem by changing the default for
dom.keyboardevent.keypress.dispatch_non_printable_keys_only_system_group_in_content
from false to true.

The old behavior can activated in about:config by setting
dom.keyboardevent.keypress.dispatch_non_printable_keys_only_system_group_in_content = false

This change reverts 29f6b48eeb.

Bug: T177509
Change-Id: I23773b2ea2a154269a5b3064cd8d9e9132051c38
2020-02-29 22:54:43 +01:00
AronDemian d0418ae8bb Don't let CodeMirror set the font to monospace if it's set on an ancestor.
Bug: T245568
Change-Id: I135bf0f7bf73e0d9faaa43c565cef43c5c934a34
2020-02-29 18:01:27 +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
Derk-Jan Hartman 006d4ba9d8 Add comment to make usage of jquery.ui module discoverable
Change-Id: I79a54686024b22e2851bd396bb51101ca84626fa
2020-02-25 22:44:34 +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
AronDemian f0e689d203 Remove the unnecessary 1.5em padding in MinervaNeue skin that misaligns highlights.
Bug: T245532
Bug: T245568
Change-Id: Ib29678eb38ebb5a5d2975a087e55b2ddd2a4b35d
Related: I135bf0f7bf73e0d9faaa43c565cef43c5c934a34 - T245476
2020-02-19 15:00:43 +01:00
Bartosz Dziewoński 5a1501d46f VE: Update padding to match VisualEditor changes
See Ib7ffbf09d5aa23fddb894aa3b081ec993ddcee2d.

Bug: T238678
Change-Id: Ia9d38599e76b63147318c6604dbd9b9fabf35b16
2019-12-13 14:54:03 +00:00
Ed Sanders a134e66777 Don't replace whitespace characters in VE
Bug: T153434
Depends-On: Ic4a5ab803c89b3671f452579bca0da08b779bdfe
Change-Id: Ic3d848ff86cceceeeea9385bfc49ad2241e3801b
2019-11-14 22:30:32 +00:00
Ed Sanders cf9885b586 Match tabSize to surface view CSS property
For browsers that don't support the property, assume
the default value of 8 is used.

Change-Id: Icb9a97fa79e08458bf717903f1d7b68e433e7904
2019-11-14 22:30:32 +00:00
Isarra 90ac9d3475 Remove Timeless VE styles, too many variables to do them properly here
Move this stuff to Timeless itself since we can just reuse the width cutoff
and padding variables directly there and don't need to worry about them
randomly changing.

Corresponding change: Ic64b9786cb7186dba3eb2042a3238149c3bb44c6

Bug: T230756
Change-Id: Ia7168341bcadbc60e307b58b67afc1975a2424f9
2019-08-20 20:26:45 +00:00
Derk-Jan Hartman d1a3e49265 Highlight match end tag with different capitalization
This recoginizes <ref></Ref>

Bug: T179321
Change-Id: Ib1e501f97654a019281eddd6cc69ea3b979daec7
2019-04-14 01:25:40 +02: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
jenkins-bot d48a8caa0d Merge "Conditionally load CodeMirror lib" 2019-03-15 08:50:49 +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
jenkins-bot 71a96af684 Merge "Make Special:JavaScriptTest pass on Webkit and on Firefox" 2019-03-12 10:32:28 +00:00
jenkins-bot f6c86b9867 Merge "build: Update eslint-config-wikimedia to 0.11.0" 2019-03-06 14:39:37 +00:00
jenkins-bot f048f45b50 Merge "Use 'wikiEditor-toolbar-doneInitialSections' as trigger" 2019-03-06 14:39:27 +00:00
Ed Sanders 37b49bfdc4 build: Update eslint-config-wikimedia to 0.11.0
Change-Id: I7ca5276791d9add0709387422016d7193e8d9945
2019-03-06 12:10:29 +00:00
Fomafix 9c04302f23 Use 'wikiEditor-toolbar-doneInitialSections' as trigger
Also refactor out single use functions and call enableCodeMirror
from within addCodeMirrorToWikiEditor.

Change-Id: I77d37ae401483e187fe0bc355d7173b57fbe454b
2019-03-06 12:09:28 +00:00
jenkins-bot 8a1e8552f3 Merge "Wait for DOM ready before querying DOM" 2019-03-06 11:59:14 +00:00
Fomafix 4181729151 Wait for DOM ready before querying DOM
This avoids a race condition on loading.

Change-Id: I31c01f9c2b2025b4a46d5afc6ada5044f750eff7
2019-02-25 21:55:31 +01:00
Fomafix ebd382f004 Make Special:JavaScriptTest pass on Webkit and on Firefox
CodeMirror inserts

 style="padding-right: 0.1px;"

only on Webkit.

The test case now strips this pattern from the rendered HTML before
comparing with the expected test case output.

Change-Id: I34b201f790d3d85a5f51d8200bf8219f11d14506
2019-02-25 08:14:58 +01:00
Fomafix 5161c6abe9 Make Special:JavaScriptTest pass with and without extension Cite
Change-Id: Ib3bae7968c7d1eb0d5f862f0410f016f47abcd15
2019-02-25 08:10:32 +01:00
Ed Sanders 7604581cc1 Remove obsolete aliases from closures
Bug: T208951
Change-Id: I64c2966b7c41d6b2b1911e2fb52e4c7364bf7964
2018-11-12 13:19:41 +00:00
James D. Forrester 8ac2d11b1b Drop support for MediaWiki core's removed "2006 wikitext editor"
Change-Id: Ib8d104ddf104cfeeee1fc7a055293a03fe8e2d3d
2018-10-25 14:06:59 -07:00
Bartosz Dziewoński 079d240a2c ve.ui.CodeMirror: Fix padding to match VisualEditor's padding
VisualEditor's default padding for the source editing surface was
changed in Icdc6f1e2a7544ebbd828f85ff370113a0e06983a (June 2018).

Since then the alignment of editing surface and CodeMirror syntax
highlighting surface was broken in skins that don't override the
default padding (basically every skin except Vector and MonoBook).
Unfortunately Vector and MonoBook happen to be the only skins we
officially support and actually test, so the issue went unnoticed.

Bug: T205154
Bug: T205658
Change-Id: Ic85a6c20b266f6b93ab8ec9c2d35acff679f31bc
2018-09-27 22:06:00 +02:00
Ed Sanders ef8c62c74b Use renamed ve.visibleWhitespaceCharacters
Change-Id: I246079505d4c37406b3f99ca17b7e8e926adaec5
2018-09-24 16:34:54 +01:00
jenkins-bot 7dd9688663 Merge "build: Update linters" 2018-09-13 12:27:47 +00:00
Ed Sanders 1be09a9a1d build: Update linters
Change-Id: I8d3aaf0b7d453033b72e5d6622b8f54df2c86bca
2018-09-12 00:03:19 +01:00
Derk-Jan Hartman d5124e2920 Make use of new WikiEditor 2010 toggle tool
Bug: T198781
Depends-On: I8b7fd41571a48fa4f6560790d94bb966972e740f
Change-Id: Id275142c0d50ca6a133129eebeee8cfc5c1ca99a
2018-07-25 01:12:28 +02:00
Derk-Jan Hartman 4ebe54a588 Focus before setting the cursor/selection
Bug: T197263
Change-Id: If5efed656746e3e40fcda118e487cdcb00e0114a
2018-06-26 21:55:09 +00:00
jenkins-bot 7fa197b2dc Merge "Accessibility: mark syntaxhighlight button as a switch" 2018-06-18 16:04:35 +00:00
Derk-Jan Hartman 42e3dc7cdb Accessibility: mark syntaxhighlight button as a switch
* Protect from setActive not being defined on the old toolbar button
* Use role is switch on the button, since WE only supports simple
buttons
* Add the checked attribute to reflect state of the toggle button

Bug: T196512
Bug: T197534
Change-Id: I48dfef1740f124105f65859ce4f51098f1157fd0
2018-06-18 15:53:37 +00:00
jenkins-bot 579611ff5e Merge "Accessibility: Disable both directions of tabbing in CodeMirror" 2018-06-18 03:41:25 +00:00