Skip to content

Instantly share code, notes, and snippets.

View michaelstephens's full-sized avatar

Michael Stephens michaelstephens

  • Procore Technology
  • United States
View GitHub Profile
@michaelstephens
michaelstephens / detect_change_ckeditor.js.coffee
Created September 9, 2013 17:05
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."