Skip to content

Instantly share code, notes, and snippets.

@michaelstephens
Created September 9, 2013 17:05
Show Gist options
  • Save michaelstephens/6498551 to your computer and use it in GitHub Desktop.
Save michaelstephens/6498551 to your computer and use it in GitHub Desktop.
How to detect a change to ck_editor
window.onbeforeunload = (e) ->
e = e or window.event
isDirty = false
for i of CKEDITOR.instances
isDirty = true if CKEDITOR.instances[i].checkDirty()
if isDirty is true
e.returnValue = "Your document has UNSAVED CHANGES If you continue those changes will be LOST."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment