| 47 | var FCKReferences = function( ) { this.EditMode = FCK.EditMode ; } |
| 48 | FCKReferences.prototype.GetState = function() { FCK.EditMode == FCK_EDITMODE_WYSIWYG ? FCK_TRISTATE_OFF : FCK_TRISTATE_DISABLED } ; |
| 49 | |
| 50 | FCKCommands.RegisterCommand( 'MW_References', new FCKReferences() ) ; |
| 51 | tbButton = new FCKToolbarButton( 'MW_References', 'References', 'Insert <references /> tag', FCK_TOOLBARITEM_ICONTEXT, true, true ) ; |
| 52 | tbButton.IconPath = FCKConfig.PluginsPath + 'mediawiki/images/tb_icon_ref.gif' ; |
| 53 | if ( !FCKConfig.showreferences ) { //hack to disable MW_References button |
| 54 | tbButton.Create = function() {return 0;} |
| 55 | tbButton.Disable = function() {return 0;} |
| 56 | } |
| 57 | FCKToolbarItems.RegisterItem( 'MW_References', tbButton ) ; |
| 58 | |
| 59 | FCKReferences.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 | |