jquery.dirty icon indicating copy to clipboard operation
jquery.dirty copied to clipboard

Not working with rich text editor fields

Open gtu-myowin opened this issue 3 years ago • 1 comments

Hi, first of all, thank you very much for the handy plugin. It is really useful and I found it from a stack overflow answer.

My form has a rich text editor fields (CK Editors). Your plugin can detect the dirtiness of all other fields but those rich text editors. Is there any attributes to be set to make it work with rich text editors or it just isn't implemented? If it an unimplemented feature, is there a work around?

Thanks!

gtu-myowin avatar Feb 22 '22 11:02 gtu-myowin

After CKeditor is initialised, you need to add an event:

// add change event to set is dirty on the form
editor.model.document.on('change:data', () => {
    // find closest form to the textarea element
    element.closest('form').dirty('setAsDirty');
});

EPGDigital-MW avatar Mar 09 '22 18:03 EPGDigital-MW