2012/12/15

No more releases for the onChange plugin

I know that the current version doesn't work correctly with the inline mode of CKEditor 4, but after reading some long threads it seems that some people doesn't like to use a third party plugin for this behavior and CKSource might release their own version, so I don't see any reason to keep updating my own one, specially due to the time that it can take to do a full review of all the ways that v4 can work in all the browsers.

If someone provides patches, I'll release those versions, but I just won't bother to test them (at least until I start using CKEditor 4, but I can't be sure when it will be ready to replace CKEditor 3 for me)

8 comments:

inghamc said...

I found that onChange successfully detects changes in CKEditor v4 inline editors, but doesn't distinguish between multiple editors -- a change in any inline editor generates a change event for them all. Luckily, editor.checkDirty() can weed out the false positives:

CKEDITOR.on('instanceCreated', function(instanceCreatedEvent) {
var newCKEditor = instanceCreatedEvent.editor;

newCKEditor.config.minimumChangeMilliseconds = 1500;

newCKEditor.on('change', function (changeEvent) {
var editor = changeEvent.editor;
// The onchange plugin fires on every inline editor in a page, so we
// must check (and reset) the dirty flag to detect actual changes.
// FUTURE: CKEditor is supposed to generate change events without a plugin
// in version 4.2: http://dev.ckeditor.com/ticket/9794
if (editor.checkDirty()) {
// ... ok, we've really changed: respond here ...
editor.resetDirty();
}
});

Hope this is helpful to someone

Toni said...

Too bad as we really need a way to detect change events in CKEditor 4.

Seems odd that they don't have this already, though, in a nicely packaged scheme since onchange is a standard DOM event and so their "element" (as complex as it is) should offer it, but alas that is not the case.

Alfonso said...

Hint: As I said, the problem is only with inline editing and it doesn't seems too complex to fix.

I tried one day and it seemed to work, but as I don't have time and energy to test such situations I'm not going to release something that half-works again, specially as I said because it seems that everyone prefers a plugin from CKSource instead of me and they said that they will create their own version.

Unknown said...

Maybe you can help me, I have an issue with plugins that drives me crazy!

How can I launch a plugin without the toolbar????

Imagine that i buy your map plugin.

I have a script in my cms that calculate for me some geo-coordinates.

I want to add a button in my page that call your plugin with my coordinates and insert the map. I will pass to your plugin all the parameters, buy I don't want to use the toolbar button and I don't want to comile the dialog.

Is possibile to "fire" a plugin with a layout button?????

Alfonso said...

You can launch a dialog by executing its command, you don't need a toolbar for that. Look at the API sample to learn how to execute commands.

If on the other side you want to "execute the dialog" without showing it, that can't be done (at least in an easy way) because by default the dialogs aren't a simple command and even its code isn't loaded until you launch it.
You would need to copy the code that you're interested or modify the dialog to expose the functions that you want.

Unknown said...

Thank you very much for your help.

I'm trying with iframe plugin witout any success!

I take as sample plugin Timestamp.

http://docs.cksource.com/CKEditor_3.x/Tutorials/Timestamp_Plugin

It's an easy plugin, and with the button I can add the time in my editor without any problem.

I want to launch the plugin with a button in my cms, and this looks impossible.

My goal is to create a plugin that insert in the editor a piece of code. If this code is compatible with the editor, like maps, I see the result. If the code is not compatible, like a js gallery, I have a placeholder.

I can write the plugin but I cannot fire this plugin without a button!

Alfonso said...

You're really confused.
A CKEditor plugin can include one or more commands (or even no command at all), so you can't "fire a plugin".

You are talking instead about commands and as I told you, you can execute a command, but if that commands launches a dialog, then it's really hard and you will have to do a bit of work in order to use that dialog from your code.

And I'm still wondering what's the relationship between your problem and the onChange plugin (BTW, an example of a plugin without any command, so you can't launch it at all)

Unknown said...

Sorry Alfonso, I write in the wrong comment. I'm looking at the maps plugin but I have two tabs opened and I write an off topic comment.

By the way I found a solution defining a command in the plugin and launching the command from my toolbar. This editor is so powerful but the documentation if you want to go out of the rules is a bit poor. Thank you for your patience.