mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeEditor
synced 2024-11-24 07:13:27 +00:00
CodeEditor: Keep experimental Geshi editor working
Still experimental, not really functional, but this fixes it to at least run again. Change-Id: Ia71aa9421179654a063c706e0cbf3016a2fcc280
This commit is contained in:
parent
b7413b5ff8
commit
7bfd574cbe
|
@ -98,6 +98,9 @@ $wgResourceModules['ext.codeEditor.geshi'] = array(
|
|||
'scripts' => array(
|
||||
'ext.codeEditor.geshi.js'
|
||||
),
|
||||
'styles' => array(
|
||||
'ext.codeEditor.geshi.css'
|
||||
),
|
||||
'messages' => array(
|
||||
'editsection',
|
||||
'savearticle'
|
||||
|
|
3
modules/ext.codeEditor.geshi.css
Normal file
3
modules/ext.codeEditor.geshi.css
Normal file
|
@ -0,0 +1,3 @@
|
|||
.mw-geshi .mw-editsection {
|
||||
float: right;
|
||||
}
|
|
@ -42,7 +42,7 @@ $( function () {
|
|||
geshiLang = matches[1];
|
||||
}
|
||||
mediaWiki.loader.using( 'ext.codeEditor.ace.modes', function () {
|
||||
var map, canon, $container, $save, $cancel, $controls, setLanguage, closeEditor;
|
||||
var map, $container, $save, $cancel, $controls, setLanguage, closeEditor;
|
||||
|
||||
// @fixme de-duplicate
|
||||
map = {
|
||||
|
@ -69,12 +69,6 @@ $( function () {
|
|||
xml: 'xml'
|
||||
};
|
||||
|
||||
// Disable some annoying commands
|
||||
canon = require( 'pilot/canon' );
|
||||
canon.removeCommand( 'replace' ); // ctrl+R
|
||||
canon.removeCommand( 'transposeletters' ); // ctrl+T
|
||||
canon.removeCommand( 'gotoline' ); // ctrl+L
|
||||
|
||||
$container = $( '<div>' )
|
||||
.attr( 'style', 'top: 32px; left: 0px; right: 0px; bottom: 0px; border: 1px solid gray; position: absolute;' )
|
||||
.text( $main.text() ); // quick hack :D
|
||||
|
@ -122,7 +116,7 @@ $( function () {
|
|||
$cancel = $( '<button>' )
|
||||
.text( 'Close' ).click( function ( event ) {
|
||||
$xcontainer.remove();
|
||||
$div.css( 'display', 'block' );
|
||||
$div.show();
|
||||
event.preventDefault();
|
||||
} );
|
||||
$controls = $( '<div>' )
|
||||
|
@ -135,7 +129,7 @@ $( function () {
|
|||
$xcontainer.width( $main.width() )
|
||||
.height( $main.height() * 1.1 + 64 + 32 );
|
||||
|
||||
$div.css( 'display', 'none' );
|
||||
$div.hide();
|
||||
$xcontainer.insertAfter( $div );
|
||||
|
||||
codeEditor = ace.edit( $container[0] );
|
||||
|
@ -148,9 +142,14 @@ $( function () {
|
|||
};
|
||||
setLanguage( geshiLang );
|
||||
|
||||
// Remove some annoying commands
|
||||
codeEditor.commands.removeCommand( 'replace' ); // ctrl+R
|
||||
codeEditor.commands.removeCommand( 'transposeletters' ); // ctrl+T
|
||||
codeEditor.commands.removeCommand( 'gotoline' ); // ctrl+L
|
||||
|
||||
closeEditor = function () {
|
||||
$xcontainer.remove();
|
||||
$div.css( 'display', 'block' );
|
||||
$div.show();
|
||||
};
|
||||
} );
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue