It seems that when switching from Source mode to WYSIWYG mode *and* your html doesnt begin with a <p>, FCKEditor wraps the entire content with a <p> and </p>. This causes quite a few hiccups when you are editing a block with some PHP code in it.

Any way to disable this "feature"?

Comments

jadwigo’s picture

This is a feature of the HTML sanitizing routines of FCKEditor... It is neccesary for many browsers that would otherwise just crash

One idea is to start with a blank paragraph, or any element (for example a <div></div>)

And maybe turning on the protected source (see fckeditor.config.js if FCKConfig.ProtectedSource.Add( /<\?[\s\S]*?\?>/g ) ; // PHP style server side code is there and enabled) might help

tcconway’s picture

Brilliant! encasing it in a <div> works great. Any way to make that the default, as opposed to using <p>?

wwalc’s picture

You need to change/add this:

FCKConfig.EnterMode = 'div' ; // p | div | br
FCKConfig.ShiftEnterMode = 'br' ; // p | div | br

in fckeditor.config.js

najibx’s picture

Also, it automatically, created :

<html dir="ltr">
    <head>
        <title></title>
    </head>
    <body>
        <p>

content .....

Which cause some spaces on the top on the content. I can remove it, but when edit, it will be there again.

wwalc’s picture

This is created:

<html dir="ltr">
    <head>
        <title></title>
    </head>
    <body>

when in fckconfig.js you have:

FCKConfig.FullPage = true ;

Unless you edit page with all HTML headers etc., disable it:

FCKConfig.FullPage = false ;
najibx’s picture

Hi wwalc,

Can you explain to me the meaning of "Unless you edit page with all HTML headers etc., disable it:".
Anyhow, I disable it, but it still there. BTW, I didn't have this issue before ...only after I upgrade to 2.5 Beta

I select the "Full HTML" input format :
* Web page addresses and e-mail addresses turn into links automatically.
* Lines and paragraphs break automatically.

wwalc’s picture

Drupal input filter has nothing common with that, it's a different thing.

The setting that cause troubles is FCKConfig.FullPage either inf fckconfig.js or fckeditor.config.js. You've probably changed it accidentically.
Add the following in fckeditor.config.js:

FCKConfig.FullPage = false ;

If nothing happens and your browser still shows:

<html dir="ltr">
    <head>
        <title></title>
    </head>
    <body>

purge your browser's cache and reopen it.

FCKConfig.FullPage should be set to true only if you edit full page (from <html> to </html>), but in Drupal you usually edit just the content of a block inside <body>.

najibx’s picture

It's the browser's cache. This does the trick. Awesome. I am a happy man now ....

thanks man.

wwalc’s picture

Status: Active » Closed (fixed)