Opened 6 years ago

Closed 6 years ago

#11573 closed New Feature (invalid)

New event: DirtyStateChanged

Reported by: Joel Owned by:
Priority: Normal Milestone:
Component: General Version:
Keywords: Cc:

Description

Two very useful events for sites monitoring editor dirty state would be editorGotDirty and editorGotClean. The events would always be fired when the return value of checkDirty() would change. Here's a a use case:

    CKEDITOR.on('editorGotDirty', function(e) {
        console.log("editor is now dirty");
        // Form containing ckeditor is now dirty, set flag
    });

This would be useful in replacing checkDirty() polling and listening to the 'change' event - I use the change event in combination with checkDirty to detect changes. This event would make a LOT of checkDirty calls redundant and quite possibly increase performance for complicated dirty checks that check other things than the editor dirty state too.

I think it might not be that difficult to implement; wouldn't this be fired always when the save button state is changed?

Better naming might be suitable.

Change History (1)

comment:1 Changed 6 years ago by Piotrek Koszuliński

Resolution: invalid
Status: newclosed

CKEditor offers editor#change event and editor#checkDirty/resetDirty methods to make it easier to deal with content changes. It has to offer change event because it could not be easily implemented "outside" editor's code and the "dirty" methods because, due to integration with other components, it's hard to implement them as well and they are simply a basic methods which editor should have. But that's in our opinion enough. Additional tools should be implemented "outside" (by 3rd party plugins or integration code), because there may be dozens of use cases and requirements which would make official plugin a mess if it was meant to handle all this, when implementing just single case, using features which editor offers, is rather trivial.

Unless it's proven that such feature could not be implemented using existing CKEditor API or that it cannot be implemented in acceptable way in terms of performance, we're not willing to add it. However, we should definitely do better in terms of documentation for integrating CKEditor with other systems. We're working on this and the situation will be improving gradually.

PS. Save button is always on.

PPS. Have you checked addons repo?

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