Skip to content
This repository has been archived by the owner on Sep 11, 2019. It is now read-only.

CKEDITOR.resourceManager.addExternal does not behave as described #111

Closed
drame1499 opened this issue Oct 22, 2014 · 2 comments
Closed

CKEDITOR.resourceManager.addExternal does not behave as described #111

drame1499 opened this issue Oct 22, 2014 · 2 comments

Comments

@drame1499
Copy link

If an empty String is supplied as fileName the description tells:
"If provided with a empty string, will implicitly indicates that path argument is already the full path."

The implementation does test with if (!fileName) which also matches an empty string.

I ran into this problem when trying to get ckeditor-4.4.5 to work in an jsf-enabled application where the path returned by getUrl is for example: styles.js?ln=ckeditor/ckeditor-4.4.5.
AddExternal takes ckeditor-4.4.5 as the filename instead of using the already full path provided.
Changing the call in styles.js from:
CKEDITOR.stylesSet.addExternal(styleSetName, externalPath ? partsStylesSet.slice(1).join(':') : CKEDITOR.getUrl('styles.js'), '');
to
CKEDITOR.stylesSet.addExternal(styleSetName, externalPath ? partsStylesSet.slice(1).join(':') : CKEDITOR.getUrl('styles.js'), ' ');
with one space provided as the filename fixed the problem for me.

The test should be something like if(fileName ===undefined || fileName === null), but I am not a javascript developer.

@Reinmar
Copy link
Member

Reinmar commented Oct 23, 2014

Hi. You're right about the issue. It turns out that it works most of the time, because this code discovers the file name:

            // If "fileName" is not provided, we assume that it may be available
            // in "path". Try to extract it in this case.
            if ( !fileName ) {
                path = path.replace( /[^\/]+$/, function( match ) {
                    fileName = match;
                    return '';
                } );
            }

But not in your case.

I moved the bug report to http://dev.ckeditor.com/ticket/12586#comment:1 because this repo is only about the SDK, not the editor itself.

@Reinmar Reinmar closed this as completed Oct 23, 2014
@drame1499
Copy link
Author

Thank you.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants