Ticket #1837: 1837_2.patch

File 1837_2.patch, 4.1 KB (added by Artur Formella, 11 years ago)
  • FCKeditor.body.php

     
    283283                global $wgFCKEditorExtDir, $wgFCKEditorDir, $wgFCKEditorHeight, $wgUser;
    284284                global $wgStylePath, $wgStyleVersion, $wgDefaultSkin, $wgExtensionFunctions;
    285285                global $wgFCKWikiTextBeforeParse;
     286                global $wgHooks;
    286287
    287288                if (!isset($this->showFCKEditor))
    288289                {
     
    361362                if (!empty($userStyles)) {
    362363                        $script .= 'sEditorAreaCSS += ",'.implode(',', $userStyles).'";';
    363364                }
     365               
     366                $showRef = false;
     367                if (isset ($wgHooks['ParserFirstCallInit']) && (in_array('wfCite',$wgHooks['ParserFirstCallInit']) )){
     368                        $showRef = true;
     369                }else if (isset ($wgExtensionFunctions) && (in_array('wfCite',$wgExtensionFunctions) )){
     370                        $showRef = true;
     371                }
     372
    364373                $script .= '
    365374var showFCKEditor = '. $this->showFCKEditor .';
    366375var popup = false;              //pointer to popup document
     
    382391oFCKeditor.Config["EditorAreaCSS"] = "'.$wgScriptPath.'/'.$wgFCKEditorExtDir.'/css/fckeditor.css" ;
    383392oFCKeditor.ToolbarSet = "'. $wgFCKEditorToolbarSet .'" ;
    384393oFCKeditor.ready = true;
     394oFCKeditor.Config["showreferences"] = '.(($showRef)?'true':'false').';
    385395';
    386396                $script .= '</script>';
    387397               
  • fckeditor_config.js

     
    1212        ['Cut','Copy','Paste',/*'PasteText','PasteWord',*/'-','Print'],
    1313        ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
    1414        ['SpecialChar','Table','Image','Rule'],
    15         ['MW_Template','MW_Special','MW_Ref','MW_Math'],
     15        ['MW_Template','MW_Special','MW_Ref','MW_References','MW_Math'],
    1616        '/',
    1717        ['FontFormat'],
    1818        ['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'],
  • plugins/mediawiki/fckplugin.js

     
    3636tbButton.IconPath = FCKConfig.PluginsPath + 'mediawiki/images/tb_icon_template.gif' ;
    3737FCKToolbarItems.RegisterItem( 'MW_Template', tbButton ) ;
    3838
    39 tbButton = new FCKToolbarButton( 'MW_Ref', 'Reference', 'Insert/Edit Reference' ) ;
     39tbButton = new FCKToolbarButton( 'MW_Ref', 'Ref', 'Insert/Edit Reference', FCK_TOOLBARITEM_ICONTEXT ) ;
    4040tbButton.IconPath = FCKConfig.PluginsPath + 'mediawiki/images/tb_icon_ref.gif' ;
     41if ( !FCKConfig.showreferences ) {              //hack to disable MW_Ref  button
     42        tbButton.Create = function()            {return 0;}
     43        tbButton.Disable  = function()  {return 0;}
     44}
    4145FCKToolbarItems.RegisterItem( 'MW_Ref', tbButton ) ;
    4246
     47var FCKReferences = function( ) this.EditMode = FCK.EditMode ;
     48FCKReferences.prototype.GetState = function()   ( FCK.EditMode == FCK_EDITMODE_WYSIWYG ? FCK_TRISTATE_OFF : FCK_TRISTATE_DISABLED ) ;
     49
     50FCKCommands.RegisterCommand( 'MW_References', new FCKReferences() ) ;
     51tbButton = new FCKToolbarButton( 'MW_References', 'References', 'Insert <references /> tag', FCK_TOOLBARITEM_ICONTEXT, true, true ) ;
     52tbButton.IconPath = FCKConfig.PluginsPath + 'mediawiki/images/tb_icon_ref.gif' ;
     53if ( !FCKConfig.showreferences ) {              //hack to disable MW_References  button
     54        tbButton.Create = function()            {return 0;}
     55        tbButton.Disable  = function()  {return 0;}
     56}
     57FCKToolbarItems.RegisterItem( 'MW_References', tbButton ) ;
     58
     59FCKReferences.prototype.Execute = function()
     60{
     61        if ( FCK.EditMode != FCK_EDITMODE_WYSIWYG )
     62                return ;
     63       
     64        FCKUndo.SaveUndoStep() ;
     65
     66        var e = FCK.EditorDocument.createElement( 'span' ) ;
     67        e.setAttribute("_fck_mw_customtag", "true");
     68        e.setAttribute("_fck_mw_tagname", "references");
     69        e.className = "fck_mw_references";
     70       
     71        oFakeImage = FCK.InsertElement( FCKDocumentProcessor_CreateFakeImage( 'FCK__MWReferences', e ) ) ;
     72}
     73
    4374tbButton = new FCKToolbarButton( 'MW_Math', 'Formula', 'Insert/Edit Formula' ) ;
    4475tbButton.IconPath = FCKConfig.PluginsPath + 'mediawiki/images/tb_icon_math.gif' ;
    4576FCKToolbarItems.RegisterItem( 'MW_Math', tbButton ) ;
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy