Ticket #1837: 1837_3.patch

File 1837_3.patch, 2.2 KB (added by Artur Formella, 16 years ago)
  • 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 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy