function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Žiga MakucŽiga Makuc 

CKEditor refreshing page after Winter '15 release

Does anyone have similar problem? I have CKEditor enabled for my custom rich text area fields on a custom object. The CKEditor included in Salesforce does not work anymore. It refreshes page repeatedly and you can't edit anything.

My solution was to download CKEditor and put it as Static Resource but I had to find the appropriate version (tried 15 so far)...and only one seem to be working with current data - so that it doesn't change it. But I'm still working on it, and haven't found the best solution so far. Any suggestions? Raising a case on Salesforce didn't help me, they told me it should work.
Best Answer chosen by Žiga Makuc
Žiga MakucŽiga Makuc
We found a solution to the problem:

Instead of line
if (e.editor.config.magic) return;
which is in the newer version never true, and thus always refreshes page (destroys it in next step), you can put global variables
editorNo=0;
noOfEditorsOnAPage=1;
and then instead of previously mentioned line put this:
if(editorNo>=noOfEditorsOnAPage){
    return;
}else{
    editorNo++;
}

This solves refreshing, but Salesforce also upgraded CKEditor which deletes styles in your html. Probably if you use everything with classes instead of styles this works well.

All Answers

BalabanBalaban
We are having the same issue, let me know if you find a solution.
Žiga MakucŽiga Makuc
Of many versions, CKEditor 4.0 did the same job as the integrated one in Salesforce. Though the appearance is not exactly the same, it did not erase stylings and other things from records while editing. Hopefully it will help you as well.
Elisabeth DoserElisabeth Doser
We are having the same issue. I was working with a SF developer on an actionregion in my page on Friday and discovered the issue this morning. He indicated the refresh was probably due to the actionregion. We removed the actionregion from the page and now the CKEditor is not working at all. Still looking into it.
Žiga MakucŽiga Makuc
We found a solution to the problem:

Instead of line
if (e.editor.config.magic) return;
which is in the newer version never true, and thus always refreshes page (destroys it in next step), you can put global variables
editorNo=0;
noOfEditorsOnAPage=1;
and then instead of previously mentioned line put this:
if(editorNo>=noOfEditorsOnAPage){
    return;
}else{
    editorNo++;
}

This solves refreshing, but Salesforce also upgraded CKEditor which deletes styles in your html. Probably if you use everything with classes instead of styles this works well.
This was selected as the best answer
Elisabeth DoserElisabeth Doser
Ziga - thanks for the fix. It worked for me. However, I have another problem. I exposed the CKeditor to use the spell check and now I don't see it in the toolbar at the top. Is anyone else having that issue? What is the resolution? 
Žiga MakucŽiga Makuc
Probably they disabled it by default. Try re-enabling it by adding this configuration:
config.disableNativeSpellChecker = false;

 
Elisabeth DoserElisabeth Doser

That didn't work either. I was reading CKEditor documentation and it says the default version of the toolbar is the full toolbar of course. Spell check options should appear on the Editing toolbar (after Find, replace, and select all). I have those 3 options but nothing else.
This is the whole reason I overrode standard functionality in Quoting - so I could have spell check in my Scope of Work box. 



 

Joe ProvidityJoe Providity
I tried the fix above but it was still refreshing the full editor.  I was able to fix it with a simple boolean variable (loaded) that kept it from loading more than once.

<script>

var loaded = false;

$(document).ready(function(){

        CKEDITOR.on('instanceReady', function(e) { 
            //if (e.editor.config.magic) return;
            
            if (loaded){
                return true;
            }

            var target = e.editor.config.bodyId;
            var name = e.editor.name;
            e.editor.destroy();

            CKEDITOR.editorConfig = function( config ) { config.magic = true; }
            CKEDITOR.replace(name, {
                        height : 600, 
                        bodyId : target
            });
            
            loaded = true;
        });
    });
</script>