mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeMirror
synced 2024-11-27 15:40:00 +00:00
fix highlighting space behind page name in Templates (v 1.0.1)
* fix code mirror options * fix code mirror font * fix code mirror border Change-Id: I7b8063cd8c5e6450b9cea0f76ed27a8ffb9ae990
This commit is contained in:
parent
c8bd7736f9
commit
67a828cf3e
|
@ -15,7 +15,7 @@ if ( !defined( 'MEDIAWIKI' ) ) {
|
|||
die( 'This file is an extension to MediaWiki and thus not a valid entry point.' );
|
||||
}
|
||||
|
||||
const CODEMIRROR_VERSION = '1.0.0';
|
||||
const CODEMIRROR_VERSION = '1.0.1';
|
||||
|
||||
// Register this extension on Special:Version
|
||||
$wgExtensionCredits['parserhook'][] = array(
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
$( document ).ready( function () {
|
||||
var myCodeMirror = CodeMirror.fromTextArea(document.getElementById("wpTextbox1"), {
|
||||
mode: "text/mediawiki",
|
||||
styleActiveLine: true,
|
||||
lineNumbers: true,
|
||||
//lineNumbers: true,
|
||||
lineWrapping: true,
|
||||
indentUnit: 4,
|
||||
indentWithTabs: true
|
||||
//indentUnit: 4,
|
||||
//indentWithTabs: true
|
||||
//matchBrackets: true,
|
||||
//autoCloseBrackets: true
|
||||
//autoCloseBrackets: true,
|
||||
mode: "text/mediawiki"
|
||||
});
|
||||
} );
|
||||
|
|
3
resources/lib/codemirror/lib/codemirror.css
vendored
3
resources/lib/codemirror/lib/codemirror.css
vendored
|
@ -3,7 +3,8 @@
|
|||
.CodeMirror {
|
||||
/* Set height, width, borders, and global font properties here */
|
||||
font-family: monospace;
|
||||
height: 300px;
|
||||
height: 400px;
|
||||
border: 1px solid #CCC;
|
||||
}
|
||||
.CodeMirror-scroll {
|
||||
/* Set scrolling behaviour here */
|
||||
|
|
|
@ -17,12 +17,19 @@ CodeMirror.defineMode("mediawiki", function(config, parserConfig) {
|
|||
state.tokenize = inParserFunctionName;
|
||||
return "strong";
|
||||
}
|
||||
stream.eatWhile(/[^\|}]/);
|
||||
stream.eatWhile(/[^\|\}\s]/);
|
||||
state.tokenize = inTemplateArgumentSeparator;
|
||||
return "link";
|
||||
}
|
||||
|
||||
function inTemplateArgumentSeparator(stream, state) { // {{ Page name |
|
||||
if (stream.eatSpace() && !stream.eol()) {
|
||||
var peek = stream.peek();
|
||||
if ( peek !== "|" && peek != "}" ) {
|
||||
state.tokenize = inTemplatePageName;
|
||||
return "link";
|
||||
}
|
||||
}
|
||||
if (stream.eat("|")) {
|
||||
state.tokenize = inTemplateArgument;
|
||||
return "tag strong";
|
||||
|
@ -33,8 +40,11 @@ CodeMirror.defineMode("mediawiki", function(config, parserConfig) {
|
|||
return "tag bracket";
|
||||
}
|
||||
}
|
||||
if ( stream.eol() ) {
|
||||
return null;
|
||||
}
|
||||
stream.next();
|
||||
return null;
|
||||
return "error";
|
||||
}
|
||||
|
||||
function inTemplateArgument(stream, state) { // {{ Page name |
|
||||
|
|
Loading…
Reference in a new issue