TheDJ has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/127451

Change subject: CodeEditor: Keep experimental Geshi editor working
......................................................................

CodeEditor: Keep experimental Geshi editor working

Still experimental, not really functional, but this fixes it to at
least run again.

Change-Id: Ia71aa9421179654a063c706e0cbf3016a2fcc280
---
M CodeEditor.php
A modules/ext.codeEditor.geshi.css
M modules/ext.codeEditor.geshi.js
3 files changed, 16 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CodeEditor 
refs/changes/51/127451/1

diff --git a/CodeEditor.php b/CodeEditor.php
index 5cb5cf2..68ca529 100644
--- a/CodeEditor.php
+++ b/CodeEditor.php
@@ -93,6 +93,9 @@
        'scripts' => array(
                'ext.codeEditor.geshi.js'
        ),
+       'styles' => array(
+               'ext.codeEditor.geshi.css'
+       ),
        'messages' => array(
                'editsection',
                'savearticle'
diff --git a/modules/ext.codeEditor.geshi.css b/modules/ext.codeEditor.geshi.css
new file mode 100644
index 0000000..30e17cf
--- /dev/null
+++ b/modules/ext.codeEditor.geshi.css
@@ -0,0 +1,3 @@
+.mw-geshi .mw-editsection {
+       float: right;
+}
diff --git a/modules/ext.codeEditor.geshi.js b/modules/ext.codeEditor.geshi.js
index 72d81c8..5ecf745 100644
--- a/modules/ext.codeEditor.geshi.js
+++ b/modules/ext.codeEditor.geshi.js
@@ -17,7 +17,7 @@
 
                        $link = $( '<a>' )
                                .text( mediaWiki.msg( 'editsection' ) )
-                               .attr( 'href', '#' )
+                               .attr( 'href', '' )
                                .attr( 'title', 'Edit this code section' )
                                .click( function ( event ) {
                                        openEditor( $div );
@@ -42,7 +42,7 @@
                                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 = {
@@ -68,12 +68,6 @@
                                        scala: 'scala',
                                        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;' )
@@ -122,7 +116,7 @@
                                $cancel = $( '<button>' )
                                        .text( 'Close' ).click( function ( 
event ) {
                                                $xcontainer.remove();
-                                               $div.css( 'display', 'block' );
+                                               $div.show();
                                                event.preventDefault();
                                        } );
                                $controls = $( '<div>' )
@@ -135,7 +129,7 @@
                                $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 @@
                                };
                                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();
                                };
                        } );
                };

-- 
To view, visit https://gerrit.wikimedia.org/r/127451
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia71aa9421179654a063c706e0cbf3016a2fcc280
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CodeEditor
Gerrit-Branch: master
Gerrit-Owner: TheDJ <hartman.w...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to