This is only done for wikitext because CJK brackets can cause unexpected
errors in other languages.
Bug: T362992
Change-Id: Icf98e8fd7e0392845df2e3b7d3201e7f94f95a3f
Brings it down from ~3 secs on my machine to ~600 ms.
This also allows for debuggers, and essentially eliminates the need
for source maps on your local (though we should probably still look
into them for prod).
Change-Id: I4c164b409b2c327e439e1524d4a898693bd8d907
CodeMirror 5 does not work on RTL pages. This commit does a crude check
of the `dir` attribute of `.mw-body-content .mw-parser-output` because
the VisualEditor surface and even the native textarea isn't available
when the module is first loaded.
Bug: T363752
Change-Id: If3825d6e5467d2bcff2d83e838081bf041243920
Add highlighting for a special one-line definition list syntax `;a:b`. Also highlight `;a` in bold.
Bug: T170042
Change-Id: Ia3bdf481469368fcb5a7651729dde4b5f3682ed8
A 'ext.CodeMirror.input' hook is added to give integrations direct
access to the ViewUpdate object when changes are made in CodeMirror.
Bug: T174811
Change-Id: Idb6166996abb7d64ac8a956f362aea5eda0392bc
Documentation is at https://w.wiki/9kxt
The idea is that modules ending in `.init` imply they initialize
CodeMirror and maniuplate the DOM. The others only export classes for
use in integreations.
In doing so, 'ext.CodeMirror.v6.WikiEditor' now only exports the
CodeMirrorWikiEditor class, while 'ext.CodeMirror.v6.WikiEditor.init'
is added for use on #wpTextbox1 through action=edit.
Bug: T174811
Change-Id: Iec62ac9dc77918904bed886d2d46ccc03e0927f7
We want to get moving on rolling out CodeMirror 6 to LTR wikis, but want
to slow rollout to RTL wikis since we are still ironing out some issues
there, specifically T358804.
Bug: T170001
Bug: T358804
Change-Id: Iac30ffe2746139326159fd406fab3b097b3187f5
Bidi isolation is still not exactly 'stable'. Instead of removing it, we
look for the URL query param `cm6bidi=1`. This allows users to test out
bidi isolation and give feedback as we iterate on it. Once stable, this
should be removed and bidi isolation should be on by default -- and
eventually, can be opted out of via CodeMirror preferences (T359498).
Bug: T358804
Change-Id: If7e024f0da71ddf1b0a38c0fc49f033ddbe745fd
The number sign in `[[Link#Section]]` is supposed to have the class
.cm-mw-link, but didn't because it was missing a TagStyle which actually
gives it the CSS class. Now it does.
Add test case for all known CSS classes.
Bug: T348019
Follow-Up: I8f8a81f362bed60dea14ecde9487a2b0c89225e8
Change-Id: I613f8bead76523fbe1a9f05ed75d81893b8737d3
This adds the `ext.CodeMirror.v6.init` ResourceLoader module which
allows use of CodeMirror on `#wpTextbox1` without the use of WikiEditor
(the 'usebetatoolbar' preference). In order for users to opt-in to using
CodeMirror, we make the existing 'usecodemirror' option into a visible
preference. In addition, with two preferences related to CodeMirror, we
group them under a new heading 'Syntax highlighting'. More preferences
may be added later to this section following T359498.
When WikiEditor is not enabled, the layout of the action=edit page has
the textarea as a sibling to other visible content, like `.editOptions`.
Because of this, we can't simply append the CodeMirror DOM to the parent
like we were before, as that would put the visible editor beneath the
edit summary, Publish button, etc. Instead we rework the CodeMirror to
first add a wrapper around the textarea and use that as the parent. This
way, `.cm-editor` is always in the same place in the DOM as the native
textarea.
Line wrapping and focus/blur events are also moved to CodeMirror, as
these are needed when not using WikiEditor.
Bug: T190108
Change-Id: I4bc069e0d398aa7088e4f50bbd0ddda458b289c3
This fixes a careless error introduced in I1338afeefa where we don't do
a strict equality test and thus if the tag is the first element (at
position 0), the following bracket is also treated as the start
position. Here we simply do a strict equality test against null (the
reset value), and viola, several issues are fixed.
Bug: T358804
Change-Id: I86021d363ecc33a7551bc887439dc1902914026f
We don't have access to the HTML attributes for .cm-panels, so we just
use CSS to set the direction.
Bug: T359611
Change-Id: I1d40ae4f7dc093f585051d388c70cde151faa5e6
Restore the ResourceLoaderGetConfigVars hook which CodeMirror 5 still
relies on when it checks $wgCodeMirrorLineNumberingNamespaces.
In CM6, this is set in the config provided by DataScript.php.
Partially reverts I67518c0968
Bug: T347211
Follow-Up: I67518c0968f64c79e290f57b4884d30a161212d3
Change-Id: Id34858da68f7e08d16f8d1312bbbd355ccf8d140
Realtime Preview is unique to WikiEditor, so we only add support in
CodeMirrorWikiEditor.
Bug: T360708
Change-Id: I2122a114359c74d311777b5f2872149e64d95254
The Tab key should navigate to the edit summary from the editor, or to
the Realtime Preview pane if it is open.
Change-Id: I7810bfd098f6b9dd5afab9aa534685d3e4166af6