Opened 8 years ago

Closed 8 years ago

#14741 closed Bug (invalid)

toolbarconfigurator is silent about missing "config.js"

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

Description

Steps to reproduce

  1. move "config.js" to "config-x.js"
  2. launch toolbarconfigurator

Expected result

An error message, explaining the "config.js" was not found.

Actual result

Silence. The configurator just shows no details.

Other details (browser, OS, CKEditor version, installed plugins)

Mac OS, Chrome, CKEDITOR.version="%VERSON%" (Yes, in the debugger, that is what it says. Looks like a bug to me. Get a Mac and try it.)

Please note: As an advanced programmer, the first thing I did upon starting with CK was to take control of the configuration file. Specifically, I addressed the problem that the file "config.js" is part of the distribution, and therefore is a terrible place to put any of my code. I am not going to put my code into a file that can be destroyed if I choose to over-lay a new distribution on top of an old one, or other such maintenance. (See later paragraph on how you should change your distribution so that it is safer.) My solution was to do the following:

(1) Put my actual config into a completely separate directory.

(2) In the CK directory, put a symbolic link "config-ACTUAL.js", pointing to step 1 file.

(3) In the application, as a member of the "config" object passed to CKEDITOR.replace(), I put in { ..., customConfig: "config-ACUTAL.js", ... }

(4) To make sure that this was all working, and that the system was not grabbing the old "config.js", I renamed it to "config-original.js".

The net result was that there was no "config.js" in the "ckeditor" directory. I intentionally did not want a "config.js" to exist there. This seemed like a pretty reasonable thing to do, and I have dealt with these kinds of situations many times.

The bottom line is: When your program fails to find a critical resource, the program should report this to the user. Pretty basic stuff.

Regarding over-lay of distribution files on top of locally customized files, the solution I use for the products I develop would be applied to your product as follows:

(1) The distribution should include a file called "config-BY-VENDOR.js".

(2) The distribution should not include "config.js"

(3) For the "CKEDITOR.replace()" command, assuming there is no "customConfig" member, attempt to read "config.js" as usual.

(4) Detect and report a missing, critical resource. In this case, if the "config.js" file is missing, pop up a message that says "File 'config.js' is missing (and no 'customConfig' used). You must copy "config-BY-VENDOR.js" to "config.js" to proceed.

(5) The "samples/toolbarconfigurator" program should use "config-BY-VENDOR.js". You don't want to use "config.js" because it might be contaminated by the local developer (like me).

(6) As mentioned in the topic of this ticket, if "sample/toolbarconfigurator" does not find a critical resource, it should inform the user.

Good luck. Have fun. If I'm ever in Warsaw I will try to visit your office (if you have one) to say "hello".

Alexander

Change History (1)

comment:1 Changed 8 years ago by Jakub Ś

Keywords: toolbarconfigurator removed
Resolution: invalid
Status: newclosed
Version: 4.5.10 (GitHub - master)

If you are an advanced developer then you should know that first thing to do when starting with new product is reading the documentation (and you didn’t do that :) ) . Now, taking the sarcasm aside here are your options:

  1. You should leave config.js where is it. You can leave it empty but leave the file alone. CKEditor need some sort of default entry point. This is how it works and we are not planning to change it.
  2. You can define path to customConfig directly in HTML page in two ways:
    1. CKEDITOR.replace( 'myfield', { customConfig: 'path/to/your/config' } );
    2. This second way can be used to present custom config file to toolbar configurator.
      <script src="../../ckeditor.js"></script>
      	<script>
      		CKEDITOR.config.customConfig='http://192.168.1.112/ckeditor/config-x.js' ;
      ...
      

NOTES:

  1. You could even set customConfig path in default config.js file but if it is going to be blindly overwritten this is probably not a good idea.
  2. Version can be checked in ckeditor/CHANGES.md file. Your version is at the very top. You can also execute CKEDITOR.version in console and you will get it as well.
  3. When you rename config.js to config-x.js there will be an error displayed in Console or Network tab (all our errors are displayed in console instead of alerts). The message there says that config.js file was not found (HTTP 404). Such message should be enough for any developer to find out what is going on. Also when working with JS application, having console opened is a must IMHO.

Please let me know what you think but i believe that this was just a matter of using available options which you were not fully aware of. Hope this helps. Issue will be closed for now but it can always be reopened.

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy