Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#8192 closed Bug (invalid)

CKEditor dow not work properly if editor.js loaded indirectly

Reported by: speller Owned by:
Priority: Normal Milestone:
Component: General Version:
Keywords: Cc:

Description

I have loader PHP script on server for loading javascripts and stylesheets. When I load CKEditor by this way:

<script type="text/javascript" src="/getmisc.php?f=/_admin/ckeditor/ckeditor.js"></script>

CKEditor is shown, but without buttons icons and other visual elements. When I just change loading path to this:

<script type="text/javascript" src="/_admin/ckeditor/ckeditor.js"></script>

CKEditor loads fine and everything is OK. I have this line in config.js:

config.baseHref = '/getmisc.php?f=/_admin/ckeditor/';

and even I leave it unchanged and load directly only editor.js CKEditor loads correctly. Just change editor.js to second (indirect) way and CKEditor do not loaded properly.

Change History (12)

comment:1 Changed 8 years ago by Jakub Ś

Status: newpending

Aren't you getting any errors in firebug console or in firebug net tab?

If you can't see any icons than this script must be causing something with paths. That is why you can't see them.

Waiting for your feedback.

comment:2 Changed 8 years ago by Jakub Ś

Perhaps setting the window.CKEDITOR_BASEPATH might help.

Please read the "The CKEditor Path" section from the http://docs.cksource.com/FCKeditor_3.x/Design_and_Architecture/SSI

Please give us feedback if it helped.

comment:3 Changed 8 years ago by speller

The only visible errors in FireFox console is:

[13:41:39.071] GET http://localsport.rus/images/sprites.png [HTTP/1.1 404 Not Found 16мс] [13:41:39.099] GET http://localsport.rus/icons.png [HTTP/1.1 404 Not Found 0мс]

But if I correct urls to these images in the Kama stylesheets these images are loaded, but nothing happens - editor remain incorrect. No JavaScript errors are seen in FireFox and Chrome consoles. Only these two 404 errors are seen in Fiddler too.

comment:4 in reply to:  2 Changed 8 years ago by speller

Replying to j.swiderski:

Perhaps setting the window.CKEDITOR_BASEPATH might help.

Please read the "The CKEditor Path" section from the http://docs.cksource.com/FCKeditor_3.x/Design_and_Architecture/SSI

Please give us feedback if it helped.

Yes, it helped, thak you, but partially. If I set this:

window.CKEDITOR_BASEPATH='/_admin/ckeditor/';

Everything is OK. But if I set it to

window.CKEDITOR_BASEPATH='/getmisc.php?f=/_admin/ckeditor/';

It not work.

comment:5 Changed 8 years ago by Jakub Ś

window.CKEDITOR_BASEPATH has to be set before editor instance is created. I assume you have read the documentation mentioned in the link above and have done that but I'm writing about it just in case as one of potential causes.

Perhaps those images are requested with text\html instead of E.g. image/png.

Could we ask you to provide us with a screenshot / screenshots that occur in Firebug console and net tab. That way it may be easier for us to determine what is wrong.

comment:6 Changed 8 years ago by Wiktor Walc

Just to make things clear - the global variable window.CKEDITOR_BASEPATH must be set before loading the editor script (ckeditor.js), not before creating an instance.

comment:7 Changed 8 years ago by speller

Screenshot of FireFox console is here: http://imageshack.us/photo/my-images/196/36258478.gif/ (in russian)

Code of loading is:

<script type="text/javascript">
window.CKEDITOR_BASEPATH='/getmisc.php?f=/_admin/ckeditor/';
//window.CKEDITOR_BASEPATH='/_admin/ckeditor/';
</script>
		
<script type="text/javascript" src="/getmisc.php?f=/_admin/ckeditor/ckeditor.js">//</script>
<script type="text/javascript" src="/getmisc.php?f=/_admin/ckfinder/ckfinder.js">//</script>
	
<textarea class="" name="anotation[5]" rid="5" cols="100" rows="10"></textarea>

<script type="text/javascript">
var editor = CKEDITOR.replace('anotation[5]',{
	height: '120' ? '120' : 300
});
CKFinder.setupCKEditor(editor, '/_admin/ckfinder');
</script>

PS: CKFinder added later, but it have no effect to result.

comment:8 Changed 8 years ago by speller

Firebug console is clean and show no error.

comment:9 Changed 8 years ago by Jakub Ś

Resolution: invalid
Status: pendingclosed

Tank you for the screenshot. It helped a lot.

It seems that your script is the one to blame. The reason is that although your script sends files correctly, URLs in CSS files send by this script are not properly read by a browser. URL like background-image:url(images/sprites.png); will be just concatenated with main path giving the result www.example.com/images/stripes.png. Browser is unable to find stripes.png under this address and thus returns 404.

To solve the problem you should:

  1. quit using this script (good idea)
  2. create some mod_rewrite rules for these “trouble files”
  3. change paths in your CSS files (bad idea)

comment:10 in reply to:  3 Changed 8 years ago by speller

Hi, I think you was not completly intentive or I wrote not clear. I wrote:

if I correct urls to these images in the Kama stylesheets these images are loaded, but nothing happens - editor remain incorrect.

I mean after correcting stylesheets to provide full urls to images (with my script, in each image:url(...)) no 404 errors happens, but even when no 404 errors happens editor still shown incorrectly.

comment:11 Changed 8 years ago by Jakub Ś

I assume that by "CKEditor is shown incorrectly" you mean

CKEditor is shown, but without buttons icons and other visual elements.

If so then the reason may be the same as for those two images. Each plug-in has its path to image which may be disrupted by your script
Have you tried to use CKEditor without this loading script? If not, please try it. That way we will know whether to look further or you have to change something in your script (good idea) / paths to images in every plug-in(bad idea).

comment:12 Changed 8 years ago by Alfonso Martínez de Lizarrondo

The fact is that we don't know what that script is doing, you have provided only a screenshot of the firefox console, but that doesn't provide any real info to find out what might be wrong.

We don't know how the CKEditor instance looks like in your environment, what's the html in the page, if only the graphics are missing and it's working otherwise, etc...

So nothing can be fixed here, we only know that if you are using a custom script then you have errors and it works otherwise, so the only advise that we can provide is to stop using that script as Jakub suggested.

Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy