Performance
End users who need to work with FCKeditor want the most short loading and
response time from it. They want to start reading and editing the content
quickly. This is a big problem for almost all on-line text editors.
There are many files that have to be downloaded from the server to make the
editor work:
-
The called page and all images and scripts not related to the editor.
-
If using Javascript integration, the JS file with the scripts to create the
editor
-
The page that works as the editor area (it's loaded in a IFrame)
-
All the JS files with the scripts for the editor engine (more than 10 for
version 1.x)
-
The language file
-
The editor's skin files
-
All images that are used as the toolbar buttons (every button has it's own
image)
All these calls generate a lot of work and traffic throw the client's browser
and the server. And worth, as many files are called, even if small
size, as much time to wait.
Two solutions have been developed for version 2.0 to solve this problem:
accurate loading order and scripts compression.
Loading Order
From version 2.0, the editor separe it's loading into steps:
-
The called page (that holds the editor) and the script to loaded the
editor is loaded.
-
The basic scripts to create the editor are loaded
-
The editor's skin and language files are loaded
-
The editor is created
-
The content is loaded in the editor
-
[ At this point the user can start reading and writing with some limitations
(drag-and-drop is disabled - cut and paste are disabled - the toolbar is
not yet available ]
-
The editor's engine scripts are loaded
-
The toolbar is created and shown to the user (even if the buttons images are
not yet loaded)
-
[ At this point the editor has all it's feature enabled ]
-
The toolbar icons are loaded.
Scripts Compression
The editor's scripts (JS files) are now pre-processed before packing any
new version. This are the processing steps:
-
Remove all comments from the code.
-
Remove all unuseful blank spaces, tabs and carriage returns
-
Merge the scripts in fewer files.
With this process we can reduce the file sizes up to 50%. Another good
think is that the editor code can now be fully commented (I avoid code
commenting on version 1.x to reduce the files size).
The original code will still be available in the package in a folder called
"_source".