First of all let me say that I'm not even a novice user of FCKEditor so I might be wrong....
I took a look at http://docs.fckeditor.net/FCKeditor_2.x ... OnkeyEvent to see how events should be created and I was shocked It should not be necessary to check if document.all exists and depending on it attach event handlers one way or the other. FCKEditor should take care of attaching the event behind the scene!
It might look something like....
var somevar = new FCKEditor.core.addButton({
text:"Bold",
tooltip:"",
listeners:{
'click' : function() {
// Do some stuff here....
},
'activate' : function() {
// Do some stuff here....
},
'inactivate' : function() {
// Do some stuff here....
}
}
});
That's certainly a bad example. FCKeditor does provide a way to handle events without caring about the browser, but you know, there are people that take the easy route, just copy and paste something that they have used in other place and then try to help other people with that code that is far from ideal.
Writing good docs and examples is a very important task, not only have the functions available in the API.
Yes, as Alfonso defined it, that example in the docs is just a bad example. It has been contributed by someone else, but actually we don't have hooks for the OnKey events, so that is a way to do that.
But, I understood your request, and actually we plan to make V3 totally event driven, which will make it much more powerful. We'll be defining it here (today, an empty page): http://docs.fckeditor.net/index.php?tit ... ent_Driven
Okay, so I might have found a bad example. Maybe we can work together to build a better documentation for V3. I will be happy to contribute ideas.
I can't say that I like the way the current implementation work. Why have more than one global variable? I'm refering to FCKEditorAPI and FCKEditor_OnComplete? Why not have only one name in the global space? I know that there will probably never be any other APIs using any of these global names... Please consider having events before, during and after all actions that might be extended. It could make FCKEditor stand out from the rest.
Re: Event-driven API
Re: Event-driven API
First of all let me say that I'm not even a novice user of FCKEditor so I might be wrong....
I took a look at http://docs.fckeditor.net/FCKeditor_2.x ... OnkeyEvent to see how events should be created and I was shocked
It should not be necessary to check if document.all exists and depending on it attach event handlers one way or the other. FCKEditor should take care of attaching the event behind the scene!
It might look something like....
Re: Event-driven API
FCKeditor does provide a way to handle events without caring about the browser, but you know, there are people that take the easy route, just copy and paste something that they have used in other place and then try to help other people with that code that is far from ideal.
Writing good docs and examples is a very important task, not only have the functions available in the API.
Re: Event-driven API
Yes, as Alfonso defined it, that example in the docs is just a bad example. It has been contributed by someone else, but actually we don't have hooks for the OnKey events, so that is a way to do that.
We already have instead another event system that is much more clear:
http://docs.fckeditor.net/FCKeditor_2.x ... API#Events
We just have very few events for now.
But, I understood your request, and actually we plan to make V3 totally event driven, which will make it much more powerful. We'll be defining it here (today, an empty page):
http://docs.fckeditor.net/index.php?tit ... ent_Driven
Frederico Knabben
CKEditor Project Lead and CKSource Owner
--
Follow us on: Twitter | Facebook | Google+ | LinkedIn
Re: Event-driven API
I can't say that I like the way the current implementation work. Why have more than one global variable? I'm refering to FCKEditorAPI and FCKEditor_OnComplete? Why not have only one name in the global space? I know that there will probably never be any other APIs using any of these global names... Please consider having events before, during and after all actions that might be extended. It could make FCKEditor stand out from the rest.