Nested templates have background shading relative to their level of
nesting. See the newly added test case as an example. Without these
tokens registered, the styling won't show properly.
Since these tokens aren't referenced directly by the StreamParser, nor
do they have a parent Tag, we don't need them as constants like we do
for other tokens.
Bug: T348019
Change-Id: I87bb99d538344957987b2bd88f902a1427a36522
The ResizingDragBar makes the editor resizable, so we need to set the
CodeMirror height to 100%. This only happens when the Realtime Preview
module is loaded.
This fixes a critical issue introduced by I4deeda192b that caused blank
renderings when scrolling large documents.
Bug: T357794
Follow-Up: I4deeda192bdc233101ba61739a636f8fd143c1de
Change-Id: Ib49d1d9e71df3653b13dfd44a8efedbf1ef9cd93
This only effects users of the CM6 CodeMirror class, so doesn't (yet)
solve the issue for the 2017 editor which is partly what T245568 is for.
I135bf0f7bf supposedly fixed it for the 2010 editor, but that fix
apparently doesn't work anymore, and thus those styles have simply been
removed (the .CodeMirror element is never a child of the edit font
classes).
This change also incidentally fixes font sizing issues by ensuring the
styles are applied to `.cm-content` and not `.cm-editor`. This prior bug
was most notably visible in other skins such as Timeless and Monobook.
The colorblind CSS class is now applied in the same way using the
EditorView.contrentAttributes facet.
Bug: T245568
Change-Id: Iaaf65e47ce8ed9303147aadc7e18a9aaa051405b
Popular extensions like Charinsert use this method to wrap text around a
selection. This patch adds support for multiple selections in CM6.
Some options to encapsulateSelection do not yet have explicit support
here, such as 'peri', but it's unclear if they are truly needed.
Bug: T211205
Change-Id: Idc0abb64eb036fa4a60382aca401d1dba1722405
This removes the need for a separate init module. Using
`__non_webpack_require__` will force Webpack to compile as `require`
instead of `__webpack_require__`, allowing ResourceLoader to inject the
virtual file.
Change-Id: I00203f4665b49cb92ee9db356445fdc2ab17fc5f
The highlightSpecialChars() should act mostly identical to CM5. An
example is the soft hyphen (U+00AD). These are highlighted as a red dot
because they are non-printable characters.
The i18n may seem like overkill, but CM6 would otherwise actually print
the same message in plain English and without a way to localize it.
Per request at T181677, we also highlight non-breaking space and the
narrow non-breaking space. These are shown as a faint gray dot, to match
CM6's highlightWhiteSpace() extension. That extension isn't used here
because it would also highlight normal spaces, which we don't want.
Bug: T181677
Change-Id: Iac1a8cf78e4cd0a27abc917f4b70bdfbaf86252a
Merging `inTableCaptioin` method into `eatTableRow` with an additional parameter so that table caption attributes can be respected. This patch also distinguishes double pipes (`||`) which start a new table cell and single pipe (`|`) which ends the attributes.
Bug: T324374
Change-Id: If2d4600067c587fe0b6a6edb332fd4e55abec607
In the parser, '*', '#', ';' and ':' can actually become nested lists (<ul>, <ol>, <dt> and <dd>) in any possible combinations. This patch does not yet support the `; dt : dd` syntax.
This patch also fixes the 'Unknown highlighting tag undefined' warning.
Bug: T184272
Bug: T170042
Change-Id: I13cc55fadbc9b03fd7c70eab123f7e378d52898d
This is essentially the CM6-style variant of the same code used for
TagModes in CM5. The big difference is in CM6, every tag must be
registered in order to be used. We do this dynamically when
CodeMirrorModeMediaWiki is intantiated. As of this patch only tags
that contain mediawiki (formerly 'text/mediawiki') are supported,
such as <ref>.
The CM6 tag registration surfaced an old bug, now fixed: when using
different capitalization on extension-supplied tags, the CSS class name
used to match that. I.e. <REF> would produce .cm-mw-ext-REF, when it
should be .cm-mw-ext-ref
Also remove the old line-level styles. With I17b1f0b7a6, line-level
styling was added for section headings. Doing the same for tags like
<nowiki> and <pre> isn't as important, and can be addressed later or
not at all.
Add test case for extension tag with no supplied TagMode
Other minor cleanup, including removing old commented out code
Bug: T348684
Change-Id: Ibfff1fc6eacc42b95f557abb40774a65c46ba373
This is merely a CSS hack which seems to work well for me. The only required JS change is to wrap plain text in section heading in a span, the CSS class of which is unused.
Bug: T351686
Change-Id: I17b1f0b7a6fdf9c090309f558349a06ccec4257f
Since <nowiki> and <pre> ignore wikitext, the CM5 implementation
cleverly leveraged the tagModes system so that only HTML entities are
processed. We're effectively doing the same here, only we don't need to
register them as proper TagModes. A FIXME is left to remove the entries
from extension.json after the CM6 upgrade is complete.
Note that line-level styling is still missing, see T351686#9431669.
As a result, multi-line content in a <nowiki> or <pre> may emit JS
warnings, but this is expected until T351686 is resolved.
Bug: T348684
Change-Id: Ia834c4609faf38af3c8f6b791544a7441b5cfb0a
This removes treating an HTML entity in a template name as a separate
token, and thus deprecates the .cm-mw-template-name-mnemonic CSS class.
In CM6 we have to register tokens for them to show, and this one seems
of little use to begin with. HTML entities should always be styled as a
such, especially in page titles where they are treated post-processing.
i.e. [[/dev/null]] links to [[/dev/null]].
The rename to .cm-html-entity and associated code is to better reflect
what it is. $rarr; is a mnemonic form while / is not, but both are
entities. Deprecations are noted in the README, with the old classes
to be removed later after on-wiki usage has been updated.
Bug: T348019
Change-Id: I1184fb5d7d37084c80af1abd5f3cb5f2091b085c
This merely ports over Ica3fb110ce and Id5e50c2baf to the CM6
stream parser. Also port the test that was added in I7907b4743b
Bug: T292967
Bug: T348019
Follow-Up: Ica3fb110cebb5650f66be321b533ed030e2c9698
Change-Id: I54b1624131ea63f403ebc1f6f900556ca868b7f4
This is more or less a exact port of the old stream parser, with the big
notable change being that all configuration-related code lives in a
separate class, CodeMirrorModeMediaWikiConfig. A smaller change is that
closing HTML tags that are marked as errors now have the ending '>'
character highlighted red, when it didn't before.
Integration with other extensions and modes is saved for a future patch
(T348684). This means <nowiki>, <ref> and other extension-supplied
markup is not yet highlighted.
The entry point for WikiEditor integration is now at
ext.CodeMirror.v6.WikiEditor.init.js, which needs to first require the
virtual file set via the DataScript (PHP) class. This can't be
integrated into the CM6 code because it needs to be precompiled before
ResourceLoader can use it (T281781).
Known issues, to be addressed separately:
* No support for TagModes / PluginModes (T348684)
* Identical adjacent tokens produce excess markup (T352917)
* Section headings do not have line-level styling (T351686)
Bug: T348019
Change-Id: I8f8a81f362bed60dea14ecde9487a2b0c89225e8
User-options related classes are being moved to the MediaWiki\User\Options namespace in MediaWiki Core; reflect that change here.
Bug: T352284
Depends-On: I9822eb1553870b876d0b8a927e4e86c27d83bd52
Change-Id: Ib0022571e750becc87c56adcb2d5bdb203b6254d
This was working before somehow… but according to the CodeMirror docs,
it never syncs with the textarea automatically, so regardless this is
a necessary safeguard at least.
Repro steps:
1) Have CodeMirror turned on
2) Open a page for editing
3) Add content
4) Toggle CodeMirror off
With this patch, it should now always be synced.
Also add selenium test to ensure this doesn't break again.
Bug: T317243
Change-Id: Ie44e62fe5838bf32f40c6a3595ec3f541380cfe1
Consistently use
$this->getServiceContainer()
instead of
MediaWikiServices::getInstance()
in tests.
Also use namespaced classes
* MediaWiki\Output\OutputPage instead of OutputPage and
* MediaWiki\User\User instead of User.
Change-Id: I0cc39ba6cc706bf01581687e440ef9fb4ad39d81
Since wikEd and DotsSyntaxHighlighter are both popular gadgets in and
outside WMF wikis, they are included in this setting by default.
Change-Id: If6c953858f9cf73024959b5a3b71b33ab7b48b4c
Add a new $wgCodeMirrorV6 temporary feature flag that when enabled,
will load the 'ext.CodeMirror.v6.WikiEditor' module that is built
against CodeMirror 6. You can also pass in the ?cm6enable=1 query
parameter to force use of CodeMirror 6. This is currently only
implemented for the 2010 editor.
Due to packaging constraints with CodeMirror 6, we now use Webpack to
bundle the files, which are then used by ResourceLoader. This is similar
to what is done for Extension:Popups, MobileFrontend, among other
extensions.
A new generic class CodeMirror can be used on other areas where syntax
highlighting is desirable, but not necessarily for editing (i.e. without
WikiEditor).
This commit merely lays the foundation for CodeMirror 6 and updates
WikiEditor to use it. The actual MediaWiki syntax highlighting will come
with a future commit.
With the new Webpack build, the Gruntfile was removed and the tasks
moved to npm commands.
Bug: T317243
Change-Id: I2239d2449b2db3b638551f847eb4eff1aafa6276
Tests that create a user account actually use the database and
most be marked as such or they will thow an exception.
See Ic4a72fbfaee730b8417848ae0603443d4995fefc
Change-Id: I827b536006130c9813a2a079eab01be112e691be
Includes a bit untangling of the setup. Concurrent tests should not
overwrite each others user settings so one of the tests gets it's
own user.
Bug: T337862
Change-Id: Iae245063932d4c5d9e6b61c1fe102505d70c1039
Extensions using Phan need to be updated simultaneously with core due
to T308443.
Bug: T308718
Depends-On: Id08a220e1d6085e2b33f3f6c9d0e3935a4204659
Change-Id: I47dad71df97f38c55550f71baf6dae67dbe0a2ba
* 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
Replace User::getOption() with UserOptionsLookup::getOption() since this method will be hard-deprecated.
Bug: T296083
Change-Id: I405251092fd94fa70a33319d313c5140c8cebc21
User::getOptionKinds() is deprecated and should be replaced with UserOptionsManager::getOptionKinds()
Bug: T277600
Change-Id: Ie30ae74839f91aa48c53a5ebf680adb21eb9b047
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