Opened 18 years ago
Closed 17 years ago
#880 closed New Feature (fixed)
Organize the code in namespaces
Reported by: | Owned by: | Frederico Caldeira Knabben | |
---|---|---|---|
Priority: | Normal | Milestone: | CKEditor 3.0 |
Component: | General | Version: | |
Keywords: | SF Confirmed V3ProtoStruct Review+ | Cc: | Frederico Caldeira Knabben |
Description ¶
Hello all, I have been taking a look at FCKeditor as an HTMLArea control and I must say I really like what I see. I am going to look into tweaking the code in order place it in a YUI-esque class structure. I’d like to detail what I’m looking at doing to see if you’d be interested in integrating it back into the main project. If you've not yet taken a look at YUI its got some REALLY cool ideas - http://developer.yahoo.com/yui/index.html. The best thing I've learned from the YUI is its awesome use of class structures. Basically, everything Yahoo has released in its YUI is housed under a single 'global' JavaScript variable named 'YAHOO'. So, if you want to use the calendar, you access it via 'YAHOO.widget.Calendar', if you want to use the DOM module, you access it via 'YAHOO.util.Dom'. I can see that with fairly little effort, the FCKeditor could be modified to work in the same fashion. For example...
var FCKeditor = function( instanceName, width, height, toolbarSet, value )
would be changed to...
FCK.editor = function( instanceName, width, height, toolbarSet, value )
Thanks to the FCKeditor's current use of JavaScript objects (‘var FCKeditor = function’), it would be pretty simple to modify it to function like the YUI. Plus the only JavaScript naming restrictions users would have to abide by is not having a variable/function named 'FCK'. I’ve used this idea with much success in one or my own projects. All of my JavaScript now resides under a single variable/class structure and I believe the FCKeditor could also benefit. Anyway… I’ve attached the base creator .js for the FCK variable/class. If you’re interested in using this idea throughout the project, please do let me know.
Moved from SF:
http://sourceforge.net/tracker/index.php?func=detail&aid=1478128&group_id=75348&atid=543656

Change History (8)
comment:1 Changed 18 years ago by
Cc: | Frederico Caldeira Knabben added |
---|---|
Reporter: | changed from Martin Kou to thecampbeln@… |
Changed 18 years ago by
Base FCK class creator. Moved from SF. Original author: thecampbeln
comment:2 Changed 18 years ago by
Keywords: | Discussion added |
---|---|
Milestone: | → FCKeditor 3.0 |
Summary: | YUI (Yahoo UI)-like Class Structuring → Organize the code in namespaces |
We're considering using a namespace system at version 3.0. Targeting it for reference.
comment:3 Changed 17 years ago by
Keywords: | Confirmed V3ProtoStruct added; Discussion removed |
---|
comment:4 Changed 17 years ago by
Keywords: | Review? added |
---|
The CKEditor prototype branch implements the CKEDITOR namespace as proposed in the ODE docs.
An easy way to see the namespace in action, is by loading one of the sample in Firefox and inspect the DOM tab in FireBug. You will note that the CKEDITOR object will be the only user variable defined in the DOM, containing the entire editor code.
The namespace object is created in the "core/ckeditor_base.js" file. It guarantees that the object will not be overwritten if the editor script is included more than once in the page.
comment:5 Changed 17 years ago by
Owner: | set to Frederico Caldeira Knabben |
---|---|
Status: | new → assigned |
comment:6 Changed 17 years ago by
Keywords: | Review+ added; Review? removed |
---|
comment:7 Changed 17 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |

Hi,
Thanks for the idea and for the information.
Actually the use of namespaces is nice to organize coding better... if you have a complex class structure.
With FCKeditor, you have only one class, the FCKeditor, and so, it would not have much sense to make it more complex.
Even if wanted, a preferred name for it would be "FCKeditor.Editor" or "FredCK.FCKeditor".
All users are invited to left your thoughts about it.
Thanks again for the ideas. Maybe they can become useful.
FredCK
Moved from SF. Original poster: fredck