Difference between revisions of "Talk:WYSIWYG"

From Organic Design
(mwforums)
(fix ugly code and use php tags not pre)
Line 4: Line 4:
 
place it in the extensions directory of mediawiki
 
place it in the extensions directory of mediawiki
 
add the following lines to the end of mediawiki LocalSettings.php:
 
add the following lines to the end of mediawiki LocalSettings.php:
<pre>
+
{{code|<php>
 
+
require_once( "$IP/extensions/ckeditor/ckeditor.php" );
require_once("$IP/extensions/ckeditor/ckeditor.php");
 
  
 
$wgHooks['EditPage::showEditForm:initial'][] = 'showEditForm';
 
$wgHooks['EditPage::showEditForm:initial'][] = 'showEditForm';
function showEditForm($form){
+
function showEditForm( $form ) {
global $wgOut;
+
    global $wgOut;
$wgOut->addScriptFile( '/extensions/ckeditor/ckeditor.js' );
+
    $wgOut->addScriptFile( '/extensions/ckeditor/ckeditor.js' );
$script =
+
    $script = "<script type=\"text/javascript\">
"<script type=\"text/javascript\">
+
        window.onload = function() { CKEDITOR.replace( 'wpTextbox1' ); };
window.onload = function()
+
        if( window.removeEventListener ) window.removeEventListener( 'load', mwSetupToolbar, false );
{
+
        else if( window.detachEvent ) window.detachEvent( 'onload', mwSetupToolbar ) ;
CKEDITOR.replace( 'wpTextbox1' );
+
    </script>";
};
+
    $wgOut->addHTML( $script );
if ( window.removeEventListener )
+
    return true;
window.removeEventListener( 'load', mwSetupToolbar, false ) ;
+
}
else if ( window.detachEvent )
+
</php>}}
window.detachEvent( 'onload', mwSetupToolbar ) ;
 
</script>";
 
 
 
$wgOut->addHTML($script);
 
 
 
return true;
 
}  
 
 
 
</pre>
 
  
 
This is from [http://www.mwusers.com/forums/showthread.php?16957-CKEditor-with-MediaWiki mwforums].
 
This is from [http://www.mwusers.com/forums/showthread.php?16957-CKEditor-with-MediaWiki mwforums].

Revision as of 10:09, 22 August 2011

To use ckeditor with mediawiki:

download and unpack the source ckeditor package place it in the extensions directory of mediawiki add the following lines to the end of mediawiki LocalSettings.php:

{{{1}}}

This is from mwforums.