Opened 12 years ago

Closed 11 years ago

#880 closed New Feature (fixed)

Organize the code in namespaces

Reported by: thecampbeln@… 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

Attachments (1)

fck.js (2.6 KB) - added by Martin Kou 12 years ago.
Base FCK class creator. Moved from SF. Original author: thecampbeln

Download all attachments as: .zip

Change History (8)

comment:1 Changed 12 years ago by Martin Kou

Cc: Frederico Caldeira Knabben added
Reporter: changed from Martin Kou to thecampbeln@…

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

Changed 12 years ago by Martin Kou

Attachment: fck.js added

Base FCK class creator. Moved from SF. Original author: thecampbeln

comment:2 Changed 12 years ago by Frederico Caldeira Knabben

Keywords: Discussion added
Milestone: FCKeditor 3.0
Summary: YUI (Yahoo UI)-like Class StructuringOrganize the code in namespaces

We're considering using a namespace system at version 3.0. Targeting it for reference.

comment:3 Changed 11 years ago by Frederico Caldeira Knabben

Keywords: Confirmed V3ProtoStruct added; Discussion removed

comment:4 Changed 11 years ago by Frederico Caldeira Knabben

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 11 years ago by Frederico Caldeira Knabben

Owner: set to Frederico Caldeira Knabben
Status: newassigned

comment:6 Changed 11 years ago by Martin Kou

Keywords: Review+ added; Review? removed

comment:7 Changed 11 years ago by Frederico Caldeira Knabben

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