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
Add core's change handler for CodeMirror changes as well, to
save in-progress edit data.
Depends-On: I32c13c1eeec55dc442b0a00ede9cb74422b0307e
Bug: T342882
Change-Id: I352470752130c7b9b2dfc55a066cecf785d40067
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
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
Fixes the issue with the change handler not working.
Bug: T303767
Depends-On: Iee4c885f92dd9ec985a3f9fd92a2fafc00f2e9ff
Change-Id: Idb97a67f940eee69e09679196d0de71e76ef3672
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
Add support for enabling, resizing, and disabling the new
realtime-preview feature.
Bug: T293347
Bug: T303767
Change-Id: I8c8c25fe56be55a61f4b8d1d2ef8cf74483aa241
When CodeMirror is focused/blurred, the same event will triggered on its corresponding textarea.
Bug: T197632
Change-Id: Ib71b6774a60dd434bdc8a27b9eab433dcc1c65f0
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
This patch also minifies existing code. Note that [] is true in
JavaScript, unlike in PHP.
Bug: T285660
Change-Id: Ic80903ebd1364505fd4aaf7f53b53324a235fd79
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
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
These changes to the color scheme are hidden behind a feature
flag for the time being.
Bug: T271895
Change-Id: I0a4b03e0f3bc8239f31edbbd5ae55661607b76f6
This does not have an effect any more with all the other
optimizations in place.
This reverts commit 094f20902c.
Bug: T274369
Change-Id: I288039a35270093bd22b5a073e70f6b769088c13
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
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
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
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
* 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
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
Also refactor out single use functions and call enableCodeMirror
from within addCodeMirrorToWikiEditor.
Change-Id: I77d37ae401483e187fe0bc355d7173b57fbe454b