Skip to content

Commit

Permalink
CKEditor support codedance#62
Browse files Browse the repository at this point in the history
  • Loading branch information
tyama committed Oct 9, 2015
1 parent 4969542 commit d08a679
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions jquery.are-you-sure.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,32 @@
return false; // break
}
});


// ckeditor
if (typeof (evt.editor) !== 'undefined') {
if (CKEDITOR.instances[evt.editor.name].checkDirty()) {
setDirtyStatus($("#" + evt.editor.name).parents('form'), true);
return;
}else{
setDirtyStatus($("#" + evt.editor.name).parents('form'), false);
}
}

setDirtyStatus($form, isDirty);
};

var initForm = function($form) {
//ckeditor
if (typeof(CKEDITOR) !== 'undefined') {
CKEDITOR.on('instanceReady', function () {
for (var instanceName in CKEDITOR.instances) {
CKEDITOR.instances[instanceName].removeListener("change", checkForm);
CKEDITOR.instances[instanceName].on("change", checkForm);
CKEDITOR.instances[instanceName].removeListener("keyup", checkForm);
CKEDITOR.instances[instanceName].document.on("keyup", checkForm);
}
});
}
var fields = $form.find(settings.fieldSelector);
$(fields).each(function() { storeOrigValue($(this)); });
$(fields).unbind(settings.fieldEvents, checkForm);
Expand Down Expand Up @@ -151,7 +172,7 @@

var reinitialize = function() {
initForm($(this));
}
};

if (!settings.silent && !window.aysUnloadSet) {
window.aysUnloadSet = true;
Expand Down

0 comments on commit d08a679

Please sign in to comment.