From 23c8cc53c50b599a94d629007ed327cf42d19dfe Mon Sep 17 00:00:00 2001 From: Damian Czepierga Date: Thu, 1 Dec 2011 12:38:41 +0100 Subject: [PATCH] [#1358024] by dczepierga: Add support for CKEditor module --- node-edit-protection.js | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/node-edit-protection.js b/node-edit-protection.js index e518a73..9ba5f51 100644 --- a/node-edit-protection.js +++ b/node-edit-protection.js @@ -34,6 +34,17 @@ Drupal.behaviors.nodeEditProtection = function(context) { $(window).unload(function() { var clicked = $(this).attr('node_edit_protection_clicked'); var edited = $(this).attr('node_edit_protection_edited'); + + //Add CKEditor module support (http://drupal.org/project/ckeditor) + if (typeof(Drupal.settings.ckeditor) != 'undefined' && typeof(CKEDITOR) != 'undefined' && typeof(CKEDITOR.instances) != 'undefined') { + for (var i in CKEDITOR.instances) { + if (CKEDITOR.instances[i].checkDirty()) { + edited = true; + break; + } + } + } + if(edited && !clicked) { return Drupal.node_edit_protection.confirmNavigate(); } -- 1.7.4.msysgit.0