From 5efc89d514c3a16ebf25715a3b1f3c5326dbec99 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Sun, 15 Mar 2015 23:48:02 +0000 Subject: [PATCH] Warn when leaving editor with undeployed changes --- public/red/ui/deploy.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/public/red/ui/deploy.js b/public/red/ui/deploy.js index c76b31e8a..b18dfb7ee 100644 --- a/public/red/ui/deploy.js +++ b/public/red/ui/deploy.js @@ -72,12 +72,15 @@ RED.deploy = (function() { RED.nodes.on('change',function(state) { if (state.dirty) { + window.onbeforeunload = function() { + return "You have undeploy changes.\n\nLeaving this page will lose these changes."; + } $("#btn-deploy").removeClass("disabled"); } else { + window.onbeforeunload = null; $("#btn-deploy").addClass("disabled"); } }); - } function save(force) {