FCKEditor: Remove & prevent

tags from wrapping your content

For some reason, FCKEditor automatically wraps any content entered into the textbox with a <p> tag. This can cause for some problems in your layout when you're actually displaying the content. Instead of trying to fix this in your layout with CSS, there is a quick and easy way to turn the auto-wrap off in FCKEditor: Change the FCKConfig.EnterMode setting from 'p' to 'br' . There are a few ways to handle this:

  • Edit fckconfig.js :
    Change FCKConfig.EnterMode = 'p'; to FCKConfig.EnterMode = 'br';
  • Change the setting programatically when you instantiate the object, like so (in PHP):
    <?php
    include_once('fckeditor/fckeditor.php');
    $oFCKeditor = new FCKeditor('description');
    $oFCKeditor->BasePath = '/fckeditor/';
    $oFCKeditor->Value = 'some text';
    $oFCKeditor->Config['EnterMode'] = 'br'; // turn off auto <p> tags wrapping content
    $oFCKeditor->Create();
    ?>

I prefer the latter way because you can do it on a page by page basis, and there's no messing with FCK's core JavaScript files.

你可能感兴趣的:(JavaScript,PHP,css,fckeditor)