From 130430dc0c2c14d882de91b52866967301090caf Mon Sep 17 00:00:00 2001
From: Damian Czepierga <damian@czepierga.pl>
Date: Thu, 1 Dec 2011 12:20:05 +0100
Subject: [PATCH] [#1358004] by dczepierga: Add support for CKEditor module

---
 node-edit-protection.js |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/node-edit-protection.js b/node-edit-protection.js
index e11c31e..d47ecb9 100755
--- a/node-edit-protection.js
+++ b/node-edit-protection.js
@@ -33,6 +33,16 @@
 
 			// Handle backbutton, exit etc.
 			window.onbeforeunload = function() {
+				//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()) {
+							edit = true;
+							break;
+						}
+					}
+				}
+				
 				if (edit && !click) {
 					click = false;
 					return (Drupal.t("You will lose all unsaved work."));
-- 
1.7.4.msysgit.0

