mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeMirror
synced 2024-11-23 22:03:28 +00:00
f3f46d8e05
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
47 lines
855 B
Plaintext
47 lines
855 B
Plaintext
.cm-editor {
|
|
border: 1px solid #c8ccd1;
|
|
}
|
|
// Override for WikiEditor.
|
|
.wikiEditor-ui-text .cm-editor {
|
|
border: inherit;
|
|
}
|
|
|
|
.cm-matchingBracket,
|
|
.cm-focused .cm-matchingBracket {
|
|
background-color: #eee;
|
|
box-shadow: inset 0 0 1px 1px #999;
|
|
font-weight: bold;
|
|
}
|
|
|
|
.cm-special-char-nbsp {
|
|
color: #888;
|
|
}
|
|
|
|
.cm-tooltip-fold {
|
|
cursor: pointer;
|
|
line-height: 1.2;
|
|
padding: 0 1px;
|
|
}
|
|
|
|
.cm-bidi-isolate {
|
|
/* @noflip */
|
|
direction: ltr;
|
|
unicode-bidi: isolate;
|
|
}
|
|
|
|
.ext-codemirror-wrapper {
|
|
height: 100%;
|
|
}
|
|
|
|
// Hide all buttons except CodeMirror on read only pages (T301615)
|
|
// This is the same hack that CodeEditor uses to customize the toolbar.
|
|
// WikiEditor should be updated to better handle read only pages (T188817).
|
|
.ext-codemirror-readonly {
|
|
.wikiEditor-section-secondary,
|
|
.group:not( .group-codemirror ),
|
|
.tabs,
|
|
.sections {
|
|
display: none;
|
|
}
|
|
}
|