1function FCKParagraphToLineBreak(p) { 2 3} 4 5FCKCommands.RegisterCommand( 'Delete_P' , new FCKParagraphToLineBreak('paragraphToLineBreak') ) ; 6 7 8 // FCKCommands.RegisterCommand( 'Delete_P', new FCKDialogCommand( "Delete P", "Delete P", FCKConfig.PluginsPath + 'paradelete/paradelete.html', 450, 300 ) ) ; 9 10 11// Create a toolbar button 12var oDelPara = new FCKToolbarButton( 'Delete_P',FCKLang.ParagraphToBreak ) ; 13oDelPara.IconPath = FCKConfig.PluginsPath + 'paradelete/delete_p.gif' ; 14 15FCKToolbarItems.RegisterItem( 'Delete_P', oDelPara ) ; 16 17// put it into the contextmenu 18FCK.ContextMenu.RegisterListener( { 19 AddItems : function( menu, tag, tagName ) { 20 // when the option is displayed, show a separator then the command 21 menu.AddSeparator() ; 22 // the command needs the registered command name, the title for the context menu, and the icon path 23 menu.AddItem( 'Delete_P', FCKLang.ParagraphToBreak, oDelPara.IconPath) ; 24 } 25} 26); 27 28 29FCKParagraphToLineBreak.prototype.Execute = function() { 30 var oEditor = FCKParagraphToLineBreak.oEditor; 31 if(!oEditor) { 32 oEditor = top.oDokuWiki_FCKEditorInstance.EditorWindow.parent; 33 } 34 35 var oParaDel = new FCK.paraDelObject(oEditor); 36 str = oParaDel.debug(); 37 if(!str) { 38 alert('Please select the lines to edit'); 39 return; 40 } 41 oParaDel.replace(); 42 43}; 44 45FCKParagraphToLineBreak.prototype.GetState = function() 46{ 47 return FCK_TRISTATE_OFF; 48}; 49 50 51var oEditorStatusInstance; 52FCKParagraphToLineBreak._StatusListener = function(editorInstance){ 53 if(FCK_STATUS_COMPLETE){ 54 FCKParagraphToLineBreak.oEditor = editorInstance.EditorWindow.parent; 55 } 56} 57FCK.Events.AttachEvent('OnStatusChange',FCKParagraphToLineBreak._StatusListener); 58 59